index.vue 2.5 KB

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