club-visit-detail.vue 7.2 KB

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