goodsDetail.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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="true" :interval="3000"
  6. :duration="duration">
  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="name">{{info.name}} | {{info.specificationModel}} | {{info.partsCode}}</view>
  15. <view style="height: 30rpx;background: #F4F5F7;"></view>
  16. <view class="detail">
  17. <view class="datailTitle">商品详情</view>
  18. <rich-text :nodes="html"></rich-text>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import homenav from "../../components/homenav/nav.vue"
  24. export default {
  25. components: {
  26. homenav
  27. },
  28. data() {
  29. return {
  30. id:'',
  31. info:'',
  32. iStatusBarHeight:'',
  33. html:'',
  34. }
  35. },
  36. onLoad(opt) {
  37. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  38. this.id=opt.id;
  39. this.queryPartDetail()
  40. },
  41. methods: {
  42. queryPartDetail(){
  43. uni.showLoading({ title: '加载中'});
  44. this.$http('partsByOpen/queryPartDetail', {
  45. id:this.id,
  46. },'POST').then(res => {
  47. uni.hideLoading();
  48. this.info=res.data;
  49. this.html = this.info.ozContent
  50. this.html = this.html.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
  51. })
  52. },
  53. showImgList(img){
  54. var arr=[]
  55. arr.push(img)
  56. uni.previewImage({
  57. urls: arr,
  58. longPressActions: {
  59. itemList: ['发送给朋友', '保存图片'],
  60. success: function(data) {
  61. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  62. },
  63. fail: function(err) {
  64. console.log(err.errMsg);
  65. }
  66. }
  67. });
  68. }
  69. },
  70. }
  71. </script>
  72. <style scoped>
  73. .swiper-itemImg{
  74. width: 750rpx;
  75. height: 750rpx;
  76. }
  77. .uni-margin-wrap{
  78. height: 750rpx;
  79. }
  80. .swiper{
  81. height: 750rpx;
  82. }
  83. .datailTitle{
  84. font-weight: 500;
  85. color: #1A1A1A;
  86. line-height: 40rpx;
  87. padding: 32rpx 24rpx;
  88. font-size: 28rpx;
  89. }
  90. .name{
  91. font-weight: 500;
  92. color: #1A1A1A;
  93. line-height: 40rpx;
  94. font-size: 28rpx;
  95. padding: 30rpx 24rpx;
  96. }
  97. .detail img{
  98. width: 750rpx;
  99. }
  100. .detail image{
  101. width: 750rpx;
  102. }
  103. </style>