goods-instrument.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="container instrument clearfix">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <template v-else>
  5. <view class="instrument-btn" v-if="buttonName" :style="{paddingBottom :isIphoneX ? '68rpx' : '34rpx'}">
  6. <view class="btn" @click="ButtonNavigateTo(buttonLinkType,buttonLinkParam.id,buttonLink,buttonLinkKeyword)">{{ buttonName }}</view>
  7. </view>
  8. <view class="banner clearfix">
  9. <view class="banner-image">
  10. <image :src="banner" mode=""></image>
  11. </view>
  12. <view class=content v-if="linkId == 6">
  13. <text>{{ content }}</text>
  14. </view>
  15. </view>
  16. <view class="instrument-list clearfix" :style="{paddingBottom :isIphoneX ? '83px' : '34px'}">
  17. <view class="list-item-cell" v-for="(item,index) in list" :key="index">
  18. <view class="list-item-title">
  19. <view class="title" :class="item.link ? 'float' : ''">
  20. <text>{{ item.title }}</text>
  21. </view>
  22. <view class="more" v-if="item.link" @click="NavToDetailPage(item)">
  23. <text>查看更多</text>
  24. <text class="iconfont icon-xiangyou"></text>
  25. </view>
  26. </view>
  27. <view class="list-item-pros">
  28. <view class="item-pros" v-for="(pros,prosIndex) in item.floorData" :key="prosIndex" @click="NavToDetailPage(pros)">
  29. <view class="item-pros-image">
  30. <image :src="pros.image" mode=""></image>
  31. </view>
  32. <view class="item-pros-name">{{ pros.title }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <!-- 侧边 -->
  39. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  40. </view>
  41. </template>
  42. <script>
  43. export default{
  44. components:{
  45. },
  46. data(){
  47. return{
  48. isIphoneX:this.$store.state.isIphoneX,
  49. banner:'',
  50. list:[],
  51. linkId:0,
  52. isScrollTop:false,
  53. linkTitle:'',
  54. skeletonShow:true,
  55. content:'',
  56. buttonName:'',
  57. buttonLink:'',
  58. buttonLinkType:'',
  59. buttonLinkParam:{},
  60. buttonLinkKeyword:''
  61. }
  62. },
  63. onLoad(option) {
  64. console.log(option)
  65. let _self = this
  66. this.linkId = option.linkId
  67. this.linkTitle = option.title
  68. this.GetPageTopicInfo()
  69. },
  70. methods:{
  71. GetPageTopicInfo(){//获取数据
  72. this.ProductService.GetPageTopic({pageId:this.linkId, source:2}).then(response =>{
  73. let { floorList, page } = response.data
  74. this.list = floorList
  75. this.banner = page.image
  76. this.content = page.content
  77. this.buttonLink = page.buttonLink
  78. this.buttonName = page.buttonName
  79. this.buttonLinkType = page.linkType
  80. this.buttonLinkParam = page.linkParam
  81. this.buttonLinkKeyword = page.keywords
  82. uni.setNavigationBarTitle({title:page.title})
  83. uni.setStorageSync('pageLabel',`${page.contentLabel}`)
  84. this.skeletonShow = false
  85. }).catch(error =>{
  86. this.$util.msg(error.msg,2000)
  87. })
  88. },
  89. NavToDetailPage(pros) {//跳转
  90. if(pros.linkType){
  91. const typeMap = {
  92. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.title}`,
  93. 2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
  94. 4:`/pages/h5/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
  95. 5:`/pages/goods/product?id=${pros.linkParam.id}`,
  96. // 7:`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`,
  97. 8:'/pages/h5/activity/activity-list',
  98. 9:'/pages/second/form/introduce',
  99. 10:'/pages/second/product/product-list',
  100. 11:'/pages/second/form/form',
  101. 12:`/pages/search/search?keyWord=${pros.linkParam.keyword}`,
  102. 13:`/pages/h5/article/path?link=${pros.link}`,
  103. 14:`/pages/h5/article/path?link=${pros.link}`,
  104. 15:`/pages/h5/article/path?link=${pros.link}`,
  105. 17:'/pages/login/register-select',
  106. 18:`/pages/h5/article/path?link=${pros.link}`,
  107. 19:`/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`
  108. }
  109. const url = typeMap[pros.linkType]
  110. uni.navigateTo({
  111. url:url
  112. })
  113. }
  114. },
  115. ButtonNavigateTo(linkType,linkId,linkHref,keyword) {//跳转
  116. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  117. }
  118. },
  119. onPageScroll(e){//实时获取到滚动的值
  120. if(e.scrollTop>600){
  121. this.isScrollTop = true
  122. }else{
  123. this.isScrollTop = false
  124. }
  125. },
  126. onShareAppMessage(res) {
  127. //分享转发
  128. if (res.from === 'button') {
  129. // 来自页面内转发按钮
  130. }
  131. return {
  132. title: `${this.linkTitle}`,
  133. path: `/pages/goods/goods-instrument?linkId=${this.linkId}&title=${this.linkTitle}`,
  134. imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
  135. }
  136. },
  137. onShow() {
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. page{
  143. background-color: #F7F7F7;
  144. }
  145. .instrument{
  146. width: 100%;
  147. height: auto;
  148. .banner{
  149. box-sizing: border-box;
  150. padding:24rpx;
  151. width: 100%;
  152. .banner-image{
  153. width: 100%;
  154. height: 248rpx;
  155. border-radius: 16rpx;
  156. float: left;
  157. image{
  158. width: 100%;
  159. height: 248rpx;
  160. border-radius: 16rpx;
  161. }
  162. }
  163. .content{
  164. width: 100%;
  165. margin-top: 10rpx;
  166. float: left;
  167. box-sizing: border-box;
  168. background-color: #FFFFFF;
  169. font-size: $font-size-26;
  170. color: #666666;
  171. text-align: justify;
  172. line-height: 36rpx;
  173. }
  174. }
  175. .instrument-btn{
  176. width: 100%;
  177. box-sizing: border-box;
  178. padding: 7rpx 24rpx;
  179. background-color: #FFFFFF;
  180. position: fixed;
  181. bottom: 0;
  182. left: 0;
  183. z-index: 999;
  184. .btn{
  185. width: 100%;
  186. height: 100%;
  187. background-image: $btn-confirm;
  188. line-height: 84rpx;
  189. border-radius: 42rpx;
  190. text-align: center;
  191. font-size: 26rpx;
  192. color: #FFFFFF;
  193. }
  194. }
  195. .instrument-list{
  196. width: 100%;
  197. height: auto;
  198. box-sizing: border-box;
  199. padding: 0 24rpx;
  200. .list-item-cell{
  201. width: 100%;
  202. height: auto;
  203. float: left;
  204. .list-item-title{
  205. width: 100%;
  206. height: 88rpx;
  207. line-height: 88rpx;
  208. float: left;
  209. .title{
  210. font-size: $font-size-28;
  211. line-height: 80rpx;
  212. color: $text-color;
  213. font-weight: bold;
  214. &.float{
  215. float: left;
  216. }
  217. }
  218. .more{
  219. font-size: $font-size-26;
  220. line-height: 80rpx;
  221. color: #999999;
  222. height: 80rpx;
  223. float: right;
  224. .icon-xiangyou{
  225. font-size: $font-size-28;
  226. margin-left: 10rpx;
  227. }
  228. }
  229. }
  230. .list-item-pros{
  231. width: 100%;
  232. height: auto;
  233. float: left;
  234. .item-pros{
  235. width: 340rpx;
  236. height: 414rpx;
  237. float: left;
  238. margin-right: 20rpx;
  239. margin-bottom: 20rpx;
  240. background-color: #FFFFFF;
  241. border-radius: 16rpx;
  242. &:nth-child(2n){
  243. margin-right: 0;
  244. }
  245. .item-pros-image{
  246. width: 340rpx;
  247. height: 340rpx;
  248. float: left;
  249. image{
  250. width: 340rpx;
  251. height: 340rpx;
  252. display: block;
  253. border-radius: 16rpx 16rpx 0 0;
  254. }
  255. }
  256. .item-pros-name{
  257. width: 100%;
  258. height: 74rpx;
  259. line-height: 74rpx;
  260. box-sizing: border-box;
  261. padding: 0 24rpx;
  262. white-space: normal;
  263. word-break: break-all;
  264. overflow: hidden;
  265. text-overflow: ellipsis;
  266. display: -webkit-box;
  267. -webkit-box-orient: vertical;
  268. -webkit-line-clamp: 1;
  269. text-align: center;
  270. font-size: $font-size-26;
  271. line-height: 74rpx;
  272. text-align: center;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. </style>