index.vue 4.1 KB

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