goodsDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="content">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'商品详情'"></homenav>
  4. <view class="uni-margin-wrap">
  5. <swiper class="swiper" circular :indicator-dots="true" :autoplay="false" :interval="3000"
  6. :duration="duration" indicator-active-color="rgba(0, 0, 0, .3)" indicator-color="#EAEAEA">
  7. <swiper-item v-for="(item,index) in info.imgList">
  8. <view class="swiper-item" >
  9. <image @click="showImgList(item.imgPath)" :src="item.imgPath" mode="aspectFit" class="swiper-itemImg"></image>
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. <view class="msBox">
  15. <view class="name" v-if="loading">{{info.name}} </view>
  16. <view class="goodsMs"><span class="dian"></span>型号:{{info.specificationModel}}<span class="factoryNumber" v-if="info.factoryNumber">{{info.factoryNumber}}</span></view>
  17. <view class="goodsMs" v-for="(item,index) in info.extendDatas">{{item.key}}:{{item.value}}</view>
  18. <view class="goodsMs"><span class="dian"></span>
  19. <view class="carmodelremark ">适用车型:{{info.carmodelremark}}</view>
  20. </view>
  21. </view>
  22. <view style="height: 30rpx;background: #F4F5F7;" v-if="html"></view>
  23. <view class="detail" v-if="html">
  24. <view class="datailTitle" v-if="html">商品详情</view>
  25. <!-- <video style="width:750rpx;" class="edui-faked-video twtcs" src="https://66km.oss-cn-beijing.aliyuncs.com/yanghuziliao/shachepan/%E6%AC%A7%E6%B4%B2%E7%BB%B4%E4%BF%AE%E5%88%B9%E8%BD%A6%E7%9B%98%E7%89%87%E6%A0%87%E5%87%86%E6%9B%B4%E6%8D%A2SOP%E6%B5%81%E7%A8%8B.mp4" width="420" height="280" enable-danmu danmu-btn controls></video> -->
  26. <!-- <player-component vid="f3310d4pktb"></player-component> -->
  27. <!-- <rich-text :nodes="html"></rich-text> -->
  28. <u-parse :content="html" ></u-parse>
  29. <!-- <view v-html="html"></view> -->
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import homenav from "../../components/homenav/nav.vue"
  35. import uParse from '@/components/u-parse/u-parse.vue'
  36. export default {
  37. components: {
  38. homenav,uParse
  39. },
  40. data() {
  41. return {
  42. id:'',
  43. info:'',
  44. iStatusBarHeight:'',
  45. html:'',
  46. loading:false,
  47. }
  48. },
  49. onLoad(opt) {
  50. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  51. this.id=opt.id;
  52. this.queryPartDetail()
  53. },
  54. methods: {
  55. queryPartDetail(){
  56. uni.showLoading({ title: '加载中'});
  57. this.loading=false;
  58. this.$http('partsByOpen/queryPartDetail', {
  59. id:this.id,
  60. },'POST').then(res => {
  61. this.loading=true;
  62. uni.hideLoading();
  63. this.info=res.data;
  64. this.html = this.info.ozContent
  65. this.html = this.html.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
  66. this.html = this.html.replace(/\<iframe/gi, '<video style="width:750rpx;" ');
  67. this.html = this.html.replace(/\<\/iframe/gi, '</video');
  68. console.log(this.html)
  69. })
  70. },
  71. showImgList(img){
  72. var arr=[]
  73. arr.push(img)
  74. uni.previewImage({
  75. urls: arr,
  76. longPressActions: {
  77. itemList: ['发送给朋友', '保存图片'],
  78. success: function(data) {
  79. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  80. },
  81. fail: function(err) {
  82. console.log(err.errMsg);
  83. }
  84. }
  85. });
  86. }
  87. },
  88. }
  89. </script>
  90. <style scoped>
  91. .swiper-itemImg{
  92. width: 742rpx;
  93. height: 742rpx;
  94. border-radius: 10rpx;
  95. border: 2rpx solid #eaeaea;
  96. }
  97. .swiper-item{
  98. text-align: center;
  99. }
  100. .uni-margin-wrap{
  101. height: 750rpx;
  102. }
  103. .swiper{
  104. height: 750rpx;
  105. }
  106. .datailTitle{
  107. font-weight: 500;
  108. color: #1A1A1A;
  109. line-height: 40rpx;
  110. padding: 32rpx 24rpx;
  111. font-size: 28rpx;
  112. }
  113. .name{
  114. font-weight: 500;
  115. color: #222;
  116. line-height: 40rpx;
  117. font-size: 32rpx;
  118. padding: 30rpx 24rpx;
  119. padding-bottom: 10rpx;
  120. }
  121. .detail img{
  122. width: 750rpx;
  123. }
  124. .detail image{
  125. width: 750rpx;
  126. }
  127. /deep/ video{
  128. width: 750rpx;
  129. }
  130. .goodsMs{
  131. font-size: 26rpx;
  132. color: #3C3C3C;
  133. line-height: 33rpx;
  134. padding: 8rpx 24rpx;
  135. display: flex;
  136. }
  137. .msBox{
  138. background: #F8F8F8;
  139. padding-bottom: 10rpx;
  140. }
  141. .dian{
  142. display: inline-block;
  143. width: 10rpx;
  144. height: 10rpx;
  145. background: #A3A3A3;
  146. border-radius: 6rpx;
  147. margin-top: 14rpx;
  148. margin-right: 6rpx;
  149. }
  150. .factoryNumber{
  151. padding: 0 10rpx;
  152. border-radius: 8rpx;
  153. /* border:1px solid #E60006; */
  154. margin-left: 10rpx;
  155. display: inline-block;
  156. background: #E60006;
  157. font-size: 26rpx;
  158. color: #FFF;
  159. }
  160. .carmodelremark{
  161. width: 680rpx;line-height: 44rpx;
  162. }
  163. </style>