trajectory.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view class="trajectory">
  3. <view class="title">访问轨迹</view>
  4. <time-axis v-for="item,index in trajectoryList" :key="item.userID" @click.native="handleLink(item)">
  5. <template #title>
  6. <text>{{ item.accessTime }}(停留时长{{ item.accessDuration }})</text>
  7. </template>
  8. <template #content>
  9. <view class="time-axis-content">
  10. <image
  11. :src="fileType(item)"
  12. class="axis-product"
  13. mode=""
  14. ></image>
  15. <view class="axis-product-info">
  16. <view class="product-title">【{{ item.pageType | pageTypeChange }}】</view>
  17. <view class="product-info" v-if="item.title">{{ item.title }}</view>
  18. </view>
  19. </view>
  20. </template>
  21. </time-axis>
  22. </view>
  23. </template>
  24. <script>
  25. import TimeAxis from './time-axis.vue'
  26. export default {
  27. props: {
  28. trajectoryList: {
  29. type: Array,
  30. default: () => []
  31. }
  32. },
  33. components: {
  34. TimeAxis
  35. },
  36. filters: {
  37. pageTypeChange(val) {
  38. const obj = {
  39. '6': '商品',
  40. '11': '文章',
  41. '8': '搜索记录',
  42. '69': '文件',
  43. '70': '图片',
  44. '71': '视频'
  45. }
  46. return obj[val]
  47. },
  48. },
  49. data() {
  50. return {}
  51. },
  52. methods: {
  53. handleLink(item) {
  54. if (Number(item.pageType) >= 69) {
  55. console.log(item.pagePath)
  56. uni.setStorageSync('databaseurl', item.pagePath)
  57. uni.navigateTo({
  58. url: `/pages/h5/article/path?databaseurl=1`
  59. })
  60. }
  61. },
  62. fileType(item) {
  63. if (item.titleImage) return item.titleImage
  64. if (item.title && Number(item.pageType) === 69) {
  65. return item.title?.indexOf('.pdf') !== -1
  66. ? 'https://static.caimei365.com/app/mini-database/H5-pdf.png'
  67. : item.title?.indexOf('.docx') !== -1
  68. ? 'https://static.caimei365.com/app/mini-database/H5-doc.png'
  69. : 'https://static.caimei365.com/app/mini-database/H5-ppt.png'
  70. }
  71. else return '../../../../static/temp/icon-new@2x.png'
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .trajectory {
  78. margin: 24rpx auto;
  79. width: 702rpx;
  80. background-color: #fff;
  81. border-radius: 16rpx;
  82. padding: 40rpx 32rpx;
  83. box-sizing: border-box;
  84. .title {
  85. color: #333333;
  86. font-size: 28rpx;
  87. font-weight: bold;
  88. margin-bottom: 30rpx;
  89. }
  90. }
  91. .axis-product {
  92. width: 136rpx;
  93. height: 136rpx;
  94. object-fit: contain;
  95. }
  96. .axis-product-info {
  97. display: flex;
  98. flex-direction: column;
  99. height: 136rpx;
  100. width: 426rpx;
  101. color: #333333;
  102. font-size: 26rpx;
  103. margin-left: 24rpx;
  104. .product-info {
  105. margin-top: 16rpx;
  106. overflow: hidden;
  107. -webkit-line-clamp: 2;
  108. text-overflow: ellipsis;
  109. display: -webkit-box;
  110. -webkit-box-orient: vertical;
  111. height: 73rpx;
  112. width: 426rpx;
  113. }
  114. }
  115. .time-axis-content {
  116. display: flex;
  117. align-items: center;
  118. }
  119. </style>