index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 && userInfo.chain">
  16. <cate-two></cate-two>
  17. </view>
  18. <view v-else>
  19. <u-empty mode="permission" icon-size="500" text="请使用企业身份登录"
  20. src="/static/images/permission.png">
  21. <router-link to="/pages/login/login" slot="bottom"
  22. class="flex row-center user-login white m-t-16 p-t-16 p-b-16 p-l-50 p-r-50">
  23. 点击登录
  24. </router-link>
  25. </u-empty>
  26. </view>
  27. <!-- 意见反馈按钮 -->
  28. <router-link :to="'/pages/feedback/feedback'"
  29. style="width: 200rpx; height: 200rpx; position: fixed; right: 0; bottom: 100rpx; display: none;">
  30. <image src="/static/images/icon_feedback.png" style="width: 100%; height: 100%;"></image>
  31. </router-link>
  32. <!-- 组件 产业链 -->
  33. <chain v-model="showChainPopup" @change="handleChain"></chain>
  34. <u-tabbar :list="tabarList"></u-tabbar>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. mapGetters,
  40. mapActions,
  41. mapMutations
  42. } from 'vuex'
  43. import {
  44. pxToRpx
  45. } from '@/utils/tools'
  46. import Chain from "./components/chain.vue"
  47. const app = getApp()
  48. const homeItem = {
  49. name: '首页'
  50. }
  51. export default {
  52. components: {
  53. Chain
  54. },
  55. data() {
  56. return {
  57. keyword: '',
  58. top: 172,
  59. showChainPopup: false
  60. }
  61. },
  62. onLoad() {
  63. uni.setStorageSync('TABBAR_TYPE', 'map');
  64. this.setTabarList({
  65. type: 'map'
  66. })
  67. },
  68. onShow() {
  69. // this.getHomeFun();
  70. this.getUser().then(() => {
  71. if (this.userInfo.nickname && !this.userInfo.chain) {
  72. this.showChainPopup = true
  73. }
  74. })
  75. },
  76. onHide() {},
  77. onPullDownRefresh() {
  78. this.getUser().then(() => {
  79. uni.stopPullDownRefresh();
  80. })
  81. },
  82. methods: {
  83. ...mapMutations(["setTabarList"]),
  84. ...mapActions(['getUser']),
  85. topImageLoad(e) {
  86. setTimeout(() => {
  87. uni.createSelectorQuery().in(this).select('#top-image').boundingClientRect(data => {
  88. console.log("得到布局位置信息" + JSON.stringify(data));
  89. this.top = pxToRpx(data.height) - 100
  90. }).exec();
  91. }, 30)
  92. },
  93. searchTalents() {
  94. let {
  95. keyword
  96. } = this;
  97. if (!keyword) {
  98. this.$toast({
  99. title: '请输入关键字'
  100. })
  101. return;
  102. }
  103. uni.navigateTo({
  104. url: '/pages/talents/talents?keyword=' + this.keyword
  105. })
  106. },
  107. handleChain(chain) {
  108. this.getUser().then(() => {
  109. uni.stopPullDownRefresh();
  110. })
  111. },
  112. },
  113. computed: {
  114. ...mapGetters(['userInfo', 'appConfig', 'tabarList']),
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. page {
  120. padding: 0;
  121. }
  122. .top-image {
  123. width: 100%;
  124. }
  125. .index-header {
  126. background-color: #E8B175;
  127. color: #fff;
  128. .header-text {
  129. min-height: 100rpx;
  130. text-align: justify;
  131. }
  132. .header-border {
  133. border-top: 1px dashed #fff;
  134. }
  135. }
  136. .class-list {
  137. background-color: #fff;
  138. color: $-color-primary;
  139. .class-list-item {
  140. padding: 30rpx;
  141. .item-img {
  142. width: 50rpx;
  143. height: 50rpx;
  144. // padding: 9rpx;
  145. // background-color: #E8B175;
  146. border-radius: 8rpx;
  147. image {
  148. width: 100%;
  149. }
  150. }
  151. }
  152. }
  153. .count {
  154. border-bottom: $-solid-border;
  155. }
  156. .user-login {
  157. background: #DD4250;
  158. box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(243, 113, 113, 0.39);
  159. border-radius: 12rpx 12rpx 12rpx 12rpx;
  160. border: 2rpx solid #DD4250;
  161. }
  162. </style>