index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. <view v-else>
  19. <u-empty mode="permission" margin-top="180" icon-size="600" 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. <u-tabbar :list="tabarList"></u-tabbar>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mapGetters,
  38. mapActions,
  39. mapMutations
  40. } from 'vuex'
  41. import {
  42. pxToRpx
  43. } from '@/utils/tools'
  44. const app = getApp()
  45. const homeItem = {
  46. name: '首页'
  47. }
  48. export default {
  49. data() {
  50. return {
  51. keyword: '',
  52. top: 172
  53. }
  54. },
  55. onLoad() {
  56. uni.setStorageSync('TABBAR_TYPE', 'map');
  57. this.setTabarList({
  58. type: 'map'
  59. })
  60. },
  61. onShow() {
  62. // this.getHomeFun();
  63. this.getUser();
  64. },
  65. onHide() {},
  66. onPullDownRefresh() {
  67. this.getUser().then(() => {
  68. uni.stopPullDownRefresh();
  69. })
  70. },
  71. methods: {
  72. ...mapMutations(["setTabarList"]),
  73. ...mapActions(['getUser']),
  74. topImageLoad(e) {
  75. setTimeout(() => {
  76. uni.createSelectorQuery().in(this).select('#top-image').boundingClientRect(data => {
  77. console.log("得到布局位置信息" + JSON.stringify(data));
  78. this.top = pxToRpx(data.height) - 100
  79. }).exec();
  80. }, 30)
  81. },
  82. searchTalents() {
  83. let {
  84. keyword
  85. } = this;
  86. if (!keyword) {
  87. this.$toast({
  88. title: '请输入关键字'
  89. })
  90. return;
  91. }
  92. uni.navigateTo({
  93. url: '/pages/talents/talents?keyword=' + this.keyword
  94. })
  95. }
  96. },
  97. computed: {
  98. ...mapGetters(['userInfo', 'appConfig', 'tabarList']),
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. page {
  104. padding: 0;
  105. }
  106. .top-image {
  107. width: 100%;
  108. }
  109. .index-header {
  110. background-color: #E8B175;
  111. color: #fff;
  112. .header-text {
  113. min-height: 100rpx;
  114. text-align: justify;
  115. }
  116. .header-border {
  117. border-top: 1px dashed #fff;
  118. }
  119. }
  120. .class-list {
  121. background-color: #fff;
  122. color: $-color-primary;
  123. .class-list-item {
  124. padding: 30rpx;
  125. .item-img {
  126. width: 50rpx;
  127. height: 50rpx;
  128. // padding: 9rpx;
  129. // background-color: #E8B175;
  130. border-radius: 8rpx;
  131. image {
  132. width: 100%;
  133. }
  134. }
  135. }
  136. }
  137. .count {
  138. border-bottom: $-solid-border;
  139. }
  140. .user-login {
  141. background: #DD4250;
  142. box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(243, 113, 113, 0.39);
  143. border-radius: 12rpx 12rpx 12rpx 12rpx;
  144. border: 2rpx solid #DD4250;
  145. }
  146. </style>