index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view style="height: 100vh; position: relative;">
  3. <scroll-view v-if="showList" class="scrollBox" scroll-y="true" @scrolltolower="loadingMore">
  4. <view v-if="list.length > 0">
  5. <view v-for="(item, index) in list" :key="index" class="list-item default-border defaultBgc" @click="jumpToEnterpriseDetail(item.enterprise.id)">
  6. <view class="sub-li-bottom">
  7. <view class="avatarBox">
  8. <image class="r-avatar" :src="getUserAvatar(item.contact.avatar, item.contact.sex)"></image>
  9. </view>
  10. <view class="ss-m-l-30" style="font-size: 28rpx;">
  11. <span class="MiSans-Normal ss-m-r-10">{{ item.contact?.name }}</span>
  12. <span class="MiSans-Normal">{{ item.post?.nameCn }}</span>
  13. </view>
  14. </view>
  15. <view class="ss-m-y-30" style="border-top: 1rpx solid #E1E4E9"></view>
  16. <view>
  17. <view class="d-flex align-center">
  18. <view class="">
  19. <image class="default-radius default-border" :src="item.enterprise.logoUrl" style="width: 50px; height: 50px; object-fit: contain;"></image>
  20. </view>
  21. <view style="flex: 1;" class="ss-m-l-30">
  22. <view class="enterprise-name ellipsis default-text-color MiSans-Semibold">{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</view>
  23. <!-- 行业规模 -->
  24. <view>
  25. <span class="tag-gap color-666" style="font-size: 24rpx;">
  26. <span class="MiSans-Normal ss-m-r-10">{{item.enterprise.industryName }}</span>
  27. <span class="MiSans-Normal">{{item.enterprise.scaleName }}</span>
  28. </span>
  29. </view>
  30. <view class="color-666 ss-m-t-10 MiSans-Normal" style="font-size: 22rpx;">查看时间:{{ timesTampChange(item.updateTime) }}</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <uni-load-more :status="status" />
  36. </view>
  37. <view v-else class="nodata-img-parent">
  38. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  39. </view>
  40. </scroll-view>
  41. <view v-else class="noviewlist">
  42. <view v-if="userInfo?.vipExpireDate > Date.now() && !userInfo?.entitlement?.viewersList">
  43. <span class="MiSans-Normal">当前会员套餐的权益不包含谁关注我,</span>
  44. <span class="text-line MiSans-Medium" @tap.stop="handleToBuyVip">点击去升级</span>
  45. </view>
  46. <view v-if="!userInfo?.vipExpireDate || (userInfo?.vipExpireDate && userInfo?.vipExpireDate < Date.now())">
  47. <span class="MiSans-Normal">谁关注我为会员权益内容,</span>
  48. <span class="text-line MiSans-Medium" @tap.stop="handleToBuyVip">点击去开通</span>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script setup>
  54. import { ref, computed } from 'vue'
  55. import { getInterestedMePage } from '@/api/user'
  56. import { dealDictObjData, jumpToEnterpriseDetail } from '@/utils/position'
  57. import { getUserAvatar } from '@/utils/avatar'
  58. import { timesTampChange } from '@/utils/date'
  59. import { formatName } from '@/utils/getText'
  60. import { userStore } from '@/store/user'
  61. import { onShow } from '@dcloudio/uni-app'
  62. const status = ref('more')
  63. const queryParams = ref({
  64. pageNo: 1,
  65. pageSize: 10
  66. })
  67. const useUserStore = userStore()
  68. const userInfo = computed(() => useUserStore?.userInfo)
  69. // 当前会员套餐是否可查看此模块
  70. const showList = computed(() => (new Date().getTime() < useUserStore?.userInfo?.vipExpireDate) && useUserStore?.userInfo?.entitlement?.viewersList)
  71. const list = ref([])
  72. const getList = async () => {
  73. const res = await getInterestedMePage(queryParams.value)
  74. const arr = res?.data?.list || []
  75. if (arr?.length) {
  76. arr.forEach(e => {
  77. e.enterprise = dealDictObjData({}, e.enterprise)
  78. })
  79. list.value = list.value.concat(arr)
  80. }
  81. status.value = list.value?.length === +res.data.total ? 'noMore' : 'more'
  82. }
  83. onShow(() => {
  84. // 有会员权益能查看才请求接口
  85. if (showList.value) getList()
  86. })
  87. // 加载更多
  88. const loadingMore = () => {
  89. status.value = 'loading'
  90. queryParams.value.pageNo++
  91. getList()
  92. }
  93. // 跳转会员套餐
  94. const handleToBuyVip = () => {
  95. uni.navigateTo({
  96. url: '/pagesA/vipPackage/index'
  97. })
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. .list-item {
  102. margin: 30rpx;
  103. border-radius: 20rpx;
  104. padding: 30rpx;
  105. &:last-child {
  106. margin-bottom: 0;
  107. }
  108. &:first-child {
  109. margin-top: 0;
  110. }
  111. }
  112. .sub-li-bottom {
  113. display: flex;
  114. align-items: center;
  115. .avatarBox {
  116. max-width: 40px;
  117. max-height: 40px;
  118. }
  119. }
  120. .enterprise-name {
  121. font-weight: bold;
  122. font-size: 16px;
  123. width: 70vw;
  124. max-width: 70vw;
  125. }
  126. .noviewlist {
  127. position: absolute;
  128. top: 50%;
  129. left: 50%;
  130. width: 98%;
  131. text-align: center;
  132. transform: translate(-50%, -50%);
  133. color: #666;
  134. }
  135. .text-line {
  136. color: #00B760;
  137. font-weight: bold;
  138. padding-bottom: 2px;
  139. border-bottom: 1px solid #00B760;
  140. }
  141. </style>