instrument-recommend.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template name="recommend">
  2. <!-- 项目仪器推荐 -->
  3. <view class="recommend clearfix">
  4. <view class="recommend-list" v-if="list.length>0">
  5. <view class="row-list" v-for="(pros, idx) in list" :key="idx" @click.stop="NavToDetailPage(pros)">
  6. <view class="list-image"><image :src="pros.image" mode=""></image></view>
  7. <view class="list-name">{{pros.title}}</view>
  8. </view>
  9. </view>
  10. <view class="recommend-empty" v-else>暂无相关推荐商品</view>
  11. </view>
  12. </template>
  13. <script>
  14. import authorize from '@/common/authorize.js'
  15. export default{
  16. name:'recommend',
  17. props:{
  18. list: {
  19. // Unistars类型
  20. type: Array
  21. }
  22. },
  23. data() {
  24. return{
  25. }
  26. },
  27. created() {
  28. },
  29. methods:{
  30. NavToDetailPage(value) {//跳转
  31. /**
  32. * 页面跳转类型
  33. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  34. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  35. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  36. **/
  37. if(value.linkType){
  38. const typeMap = {
  39. 1:`/pages/goods/goods-instrument?linkId=${value.linkParam.id}&title=${value.title}`,
  40. 2:`/pages/goods/instrument-details?id=${value.linkParam.id}`,
  41. 5:`/pages/goods/product?id=${value.linkParam.id}`,
  42. 7:`/supplier/pages/user/my-shop?shopId=${value.linkParam.id}`,
  43. 8:`/h5/pages/activity/activity-list`,
  44. 9:`/second/pages/form/introduce`,
  45. 10:`/second/pages/product/product-list`,
  46. 11:`/second/pages/form/form`,
  47. 12:`/search/pages/search/search?keyWord=${value.title}`,
  48. 13:`/h5/pages/article/path?link=${value.link}`,
  49. 14:`/h5/pages/article/path?link=${value.link}`,
  50. 15:`/h5/pages/article/path?link=${value.link}`,
  51. 17:`/pages/login/register-select`,
  52. 18:`/h5/pages/article/path?link=${value.link}`,
  53. 19:`/search/pages/search/search-supplier?keyWord=${value.title}`
  54. }
  55. const url = typeMap[value.linkType];
  56. this.$api.navigateTo(url)
  57. }
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .recommend{
  64. background: #F7F7F7;
  65. width: 100%;
  66. .recommend-empty{
  67. width: 702rpx;
  68. height: 100rpx;
  69. line-height: 100rpx;
  70. padding: 0 24rpx;
  71. font-size: $font-size-28;
  72. color: #999999;
  73. text-align: center;
  74. }
  75. .recommend-list{
  76. width: 100%;
  77. height: auto;
  78. position: relative;
  79. box-sizing: border-box;
  80. padding: 0rpx 24rpx;
  81. .row-list{
  82. width: 340rpx;
  83. height: auto;
  84. float: left;
  85. margin-right: 20rpx;
  86. margin-bottom: 20rpx;
  87. border-radius: 20rpx;
  88. background: #FFFFFF;
  89. &:nth-child(2n){
  90. margin-right: 0;
  91. }
  92. .list-image{
  93. width: 100%;
  94. height: 340rpx;
  95. border-radius: 20rpx 20rpx 0 0;
  96. image{
  97. width: 100%;
  98. height: 340rpx;
  99. border-radius: 20rpx 20rpx 0 0;
  100. }
  101. }
  102. .list-name{
  103. font-size: $font-size-28;
  104. color: $text-color;
  105. line-height:88rpx;
  106. padding: 0 10rpx;
  107. overflow: hidden;
  108. white-space: nowrap;
  109. text-overflow: ellipsis;
  110. }
  111. }
  112. }
  113. .swiper__recommenddots-box{
  114. position: absolute;
  115. bottom: -20rpx;
  116. left: 0;
  117. right: 0;
  118. /* #ifndef APP-NVUE */
  119. display: flex;
  120. /* #endif */
  121. flex: 1;
  122. flex-direction: row;
  123. justify-content: center;
  124. align-items: center;
  125. height: 60rpx;
  126. background: #FFFFFF;
  127. .swiper__dots-item{
  128. width: 8rpx;
  129. height: 8rpx;
  130. border-radius: 100%;
  131. margin-left: 6px;
  132. background-color:rgba(0,0,0,.3);
  133. }
  134. .swiper__dots-long{
  135. width: 32rpx;
  136. height: 8rpx;
  137. border-radius: 4rpx;
  138. background-color: #000;
  139. transition: all 0.4s;
  140. }
  141. }
  142. }
  143. </style>