index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <!-- 头部背景和搜索 -->
  4. <view>
  5. <image :src="appConfig.mobile_top_bg" class="top-image" id="top-image" mode="widthFix" @load="topImageLoad">
  6. </image>
  7. </view>
  8. <!-- 搜索 -->
  9. <router-link to="/pages/search/search" style="position: absolute; width: 100%; padding: 0 98rpx;height: 70rpx;"
  10. :style="{top: top + 'rpx'}">
  11. <u-search wrap-bg-color="transparent" bg-color="#ffffff" :disabled="false" :height="62" shape="square"
  12. :show-action="false"></u-search>
  13. </router-link>
  14. <!-- 分类树 -->
  15. <view class="content bg-body" v-if="userInfo.nickname">
  16. <cate-two></cate-two>
  17. </view>
  18. <!-- 意见反馈按钮 -->
  19. <router-link :to="'/pages/feedback/feedback'"
  20. style="width: 200rpx; height: 200rpx; position: fixed; right: 0; bottom: 100rpx; display: none;">
  21. <image src="/static/images/icon_feedback.png" style="width: 100%; height: 100%;"></image>
  22. </router-link>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. mapGetters,
  28. mapActions
  29. } from 'vuex'
  30. import {
  31. pxToRpx
  32. } from '@/utils/tools'
  33. const app = getApp()
  34. const homeItem = {
  35. name: '首页'
  36. }
  37. export default {
  38. data() {
  39. return {
  40. keyword: '',
  41. top: 172
  42. }
  43. },
  44. onShow() {
  45. // this.getHomeFun();
  46. this.getUser();
  47. },
  48. onHide() {},
  49. onPullDownRefresh() {
  50. this.getUser().then(() => {
  51. uni.stopPullDownRefresh();
  52. })
  53. },
  54. methods: {
  55. ...mapActions(['getUser']),
  56. topImageLoad(e) {
  57. setTimeout(() => {
  58. uni.createSelectorQuery().in(this).select('#top-image').boundingClientRect(data => {
  59. console.log("得到布局位置信息" + JSON.stringify(data));
  60. this.top = pxToRpx(data.height) - 100
  61. }).exec();
  62. }, 30)
  63. },
  64. searchTalents() {
  65. let {
  66. keyword
  67. } = this;
  68. if (!keyword) {
  69. this.$toast({
  70. title: '请输入关键字'
  71. })
  72. return;
  73. }
  74. uni.navigateTo({
  75. url: '/pages/talents/talents?keyword=' + this.keyword
  76. })
  77. }
  78. },
  79. computed: {
  80. ...mapGetters(['userInfo', 'appConfig']),
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. page {
  86. padding: 0;
  87. }
  88. .top-image {
  89. width: 100%;
  90. }
  91. .index-header {
  92. background-color: #E8B175;
  93. color: #fff;
  94. .header-text {
  95. min-height: 100rpx;
  96. text-align: justify;
  97. }
  98. .header-border {
  99. border-top: 1px dashed #fff;
  100. }
  101. }
  102. .class-list {
  103. background-color: #fff;
  104. color: $-color-primary;
  105. .class-list-item {
  106. padding: 30rpx;
  107. .item-img {
  108. width: 50rpx;
  109. height: 50rpx;
  110. // padding: 9rpx;
  111. // background-color: #E8B175;
  112. border-radius: 8rpx;
  113. image {
  114. width: 100%;
  115. }
  116. }
  117. }
  118. }
  119. .count {
  120. border-bottom: $-solid-border;
  121. }
  122. </style>