club-visit-detail.vue 6.7 KB

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