club-visit-details.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="container club-visit">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. />
  10. <template v-else>
  11. <view class="visit-content clearfix" v-if="list.length > 0">
  12. <view
  13. class="info-main-list"
  14. v-for="(visit, index) in list"
  15. :key="index"
  16. :class="index === list.length - 1 ? 'none' : ''"
  17. >
  18. <view class="info-title" v-if="visit.accessDate">{{ visit.accessDate }}</view>
  19. <view
  20. class="info-main"
  21. v-for="(record, recordIndex) in visit.record"
  22. :key="recordIndex"
  23. :class="recordIndex === visit.record.length - 1 ? 'none' : ''"
  24. >
  25. <view class="info-p"
  26. >访问时间:<text>{{ record.accessNewTime }}</text></view
  27. >
  28. <view class="info-p"
  29. >页面类型:<text>{{ record.pageType ? record.pageType : '--' }}</text></view
  30. >
  31. <view class="info-p"
  32. >页面标签:<text>{{ record.pageLabel ? record.pageLabel : '--' }}</text></view
  33. >
  34. <view class="info-p"
  35. >商品名称:<text>{{ record.productName ? record.productName : '--' }}</text></view
  36. >
  37. <view class="info-p">商品图片: <text v-if="!record.productImage">--</text></view>
  38. <view class="info-img" v-if="record.productImage"
  39. ><image :src="record.productImage" alt=""
  40. /></view>
  41. <view class="info-p"
  42. >访问来源:<text>{{ record.accessSource | accessSourceFilters }}</text></view
  43. >
  44. <view class="info-p"
  45. >访问客户端:<text>{{ record.accessClient | accessClientFilters }}</text></view
  46. >
  47. <view class="info-p"
  48. >访问时长:<text>{{ record.accessDuration }}</text></view
  49. >
  50. </view>
  51. </view>
  52. <!--加载loadding-->
  53. <tui-loadmore :visible="loadding" :index="3" type="black" />
  54. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText" />
  55. <!--加载loadding-->
  56. </view>
  57. <view class="vsit-content-none" v-else>
  58. <image
  59. class="none-image"
  60. src="https://static.caimei365.com/app/img/bg/bg_visit_none@2x.png"
  61. mode=""
  62. ></image>
  63. <view class="none-text">暂无数据</view>
  64. </view>
  65. </template>
  66. <!-- 侧边 -->
  67. <view class="scrollTop" :style="{ bottom: '150rpx' }">
  68. <view class="icon top" @click="onPageScrollTop" :class="isScrollTop ? 'show' : 'none'">
  69. <text class="iconfont icon-zhiding"></text>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import { mapState, mapMutations } from 'vuex'
  76. export default {
  77. data() {
  78. return {
  79. skeletonShow: true,
  80. isScrollTop: false,
  81. nomoreText: '上拉显示更多',
  82. hasNextPage: false,
  83. loadding: false,
  84. pullUpOn: true,
  85. pullFlag: true,
  86. listQuery: {
  87. clubId: 0,
  88. pageNum: 1,
  89. pageSize: 10
  90. },
  91. list: []
  92. }
  93. },
  94. filters: {
  95. accessClientFilters(value) {
  96. // 访问客户端
  97. const map = {
  98. '0': '网站',
  99. '1': '小程序'
  100. }
  101. return map[value]
  102. },
  103. accessSourceFilters(value) {
  104. // 访问来源
  105. if (!value) return '--'
  106. const map = {
  107. '0': '直接访问',
  108. '1': '百度搜索',
  109. '2': '360搜索',
  110. '3': '谷歌搜索',
  111. '4': '神马搜索',
  112. '5': '头条搜索',
  113. '6': '搜狗搜索',
  114. '7': '直接访问'
  115. }
  116. return map[value]
  117. }
  118. },
  119. computed: {},
  120. onLoad(option) {
  121. this.listQuery.clubId = option.clubId
  122. this.getClubRecordDetail()
  123. setTimeout(() => {
  124. this.skeletonShow = false
  125. }, 1000)
  126. },
  127. methods: {
  128. async getClubRecordDetail() {
  129. //获取记录详情
  130. try {
  131. this.listQuery.pageNum = 1
  132. const res = await this.UserService.getClubKeynoteRecord(this.listQuery)
  133. const data = res.data
  134. if (data.list && data.list.length > 0) {
  135. this.hasNextPage = data.hasNextPage
  136. this.list = data.list
  137. this.pullFlag = false
  138. setTimeout(() => {
  139. this.pullFlag = true
  140. }, 500)
  141. if (this.hasNextPage) {
  142. this.pullUpOn = false
  143. this.nomoreText = '上拉显示更多'
  144. } else {
  145. this.pullUpOn = true
  146. this.loadding = false
  147. this.nomoreText = '已至底部'
  148. }
  149. }
  150. } catch (error) {
  151. console.log('加载异常~', error.msg)
  152. }
  153. },
  154. async getOnReachBottomData() {
  155. try {
  156. this.listQuery.pageNum += 1
  157. const res = await this.UserService.getClubKeynoteRecord(this.listQuery)
  158. const data = res.data
  159. if (data.list && data.list.length > 0) {
  160. this.hasNextPage = data.hasNextPage
  161. this.list = this.list.concat(data.list)
  162. this.pullFlag = false // 防上拉暴滑
  163. setTimeout(() => {
  164. this.pullFlag = true
  165. }, 500)
  166. if (this.hasNextPage) {
  167. this.pullUpOn = false
  168. this.nomoreText = '上拉显示更多'
  169. } else {
  170. this.pullUpOn = false
  171. this.loadding = false
  172. this.nomoreText = '已至底部'
  173. }
  174. }
  175. } catch (e) {
  176. console.log('上滑加载异常~', error.msg)
  177. }
  178. },
  179. onPageScrollTop() {
  180. uni.pageScrollTo({
  181. scrollTop: 0,
  182. duration: 600
  183. })
  184. }
  185. },
  186. onPullDownRefresh() {
  187. setTimeout(() => {
  188. this.getClubRecordDetail()
  189. uni.stopPullDownRefresh()
  190. }, 200)
  191. },
  192. onReachBottom() {
  193. if (this.hasNextPage) {
  194. this.loadding = true
  195. this.pullUpOn = true
  196. this.getOnReachBottomData()
  197. }
  198. },
  199. onPageScroll(e) {
  200. //实时获取到滚动的值
  201. if (e.scrollTop > 800) {
  202. this.isScrollTop = true
  203. } else {
  204. this.isScrollTop = false
  205. }
  206. },
  207. onShow() {}
  208. }
  209. </script>
  210. <style lang="scss">
  211. page {
  212. height: auto;
  213. }
  214. .club-visit {
  215. width: 100%;
  216. .visit-content {
  217. width: 100%;
  218. height: auto;
  219. float: left;
  220. box-sizing: border-box;
  221. .info-main-list {
  222. width: 100%;
  223. height: auto;
  224. padding: 20rpx 0;
  225. margin-bottom: 24rpx;
  226. border-bottom: 20rpx solid #f5f5f5;
  227. box-sizing: border-box;
  228. &.none {
  229. border-bottom: none;
  230. }
  231. }
  232. .info-title {
  233. width: 100%;
  234. box-sizing: border-box;
  235. padding: 24rpx 24rpx 0 24rpx;
  236. position: relative;
  237. line-height: 48rpx;
  238. font-size: 40rpx;
  239. color: #333;
  240. font-weight: bold;
  241. }
  242. .info-main {
  243. width: 100%;
  244. height: auto;
  245. padding: 20rpx 0;
  246. border-bottom: 2rpx solid #f5f5f5;
  247. box-sizing: border-box;
  248. .info-p {
  249. width: 100%;
  250. box-sizing: border-box;
  251. padding: 0 24rpx;
  252. position: relative;
  253. line-height: 66rpx;
  254. font-size: 30rpx;
  255. color: #999999;
  256. text-overflow: ellipsis;
  257. overflow: hidden;
  258. display: -webkit-box;
  259. -webkit-line-clamp: 1;
  260. line-clamp: 1;
  261. -webkit-box-orient: vertical;
  262. text {
  263. color: #333333;
  264. }
  265. }
  266. .info-img {
  267. width: 200rpx;
  268. height: 200rpx;
  269. image {
  270. width: 200rpx;
  271. height: 200rpx;
  272. display: block;
  273. margin-left: 24rpx;
  274. border: 1px dashed #e2e2e2;
  275. }
  276. }
  277. &.none {
  278. border-bottom: none;
  279. }
  280. }
  281. }
  282. .vsit-content-none {
  283. width: 100%;
  284. min-height: 800rpx;
  285. background: #ffffff;
  286. border-radius: 24rpx;
  287. padding: 52rpx 24rpx;
  288. box-sizing: border-box;
  289. display: flex;
  290. align-items: center;
  291. justify-content: center;
  292. flex-direction: column;
  293. .none-image {
  294. width: 260rpx;
  295. height: 260rpx;
  296. margin-bottom: 20rpx;
  297. }
  298. .none-text {
  299. font-size: $font-size-28;
  300. color: #999999;
  301. line-height: 44rpx;
  302. }
  303. }
  304. }
  305. .scrollTop {
  306. width: 80rpx;
  307. height: 100rpx;
  308. position: fixed;
  309. right: 20rpx;
  310. z-index: 99;
  311. .icon {
  312. width: 80rpx;
  313. height: 80rpx;
  314. border-radius: 50%;
  315. float: left;
  316. margin: 10rpx 0;
  317. line-height: 80rpx;
  318. text-align: center;
  319. .contact-btn {
  320. width: 80rpx;
  321. height: 80rpx;
  322. background-color: rgba(0, 0, 0, 0);
  323. line-height: 80rpx;
  324. .iconfont {
  325. font-size: $font-size-44;
  326. color: #ffffff;
  327. }
  328. }
  329. &.top {
  330. background-color: rgba(0, 0, 0, 0.4);
  331. &.show {
  332. opacity: 1;
  333. }
  334. &.none {
  335. opacity: 0;
  336. }
  337. }
  338. .iconfont {
  339. font-size: $font-size-44;
  340. color: #ffffff;
  341. }
  342. }
  343. }
  344. </style>