goodsDetail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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" v-if="loading">{{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. loading:false,
  35. }
  36. },
  37. onLoad(opt) {
  38. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  39. this.id=opt.id;
  40. this.queryPartDetail()
  41. },
  42. methods: {
  43. queryPartDetail(){
  44. uni.showLoading({ title: '加载中'});
  45. this.loading=false;
  46. this.$http('partsByOpen/queryPartDetail', {
  47. id:this.id,
  48. },'POST').then(res => {
  49. this.loading=true;
  50. uni.hideLoading();
  51. this.info=res.data;
  52. this.html = this.info.ozContent
  53. this.html = this.html.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
  54. })
  55. },
  56. showImgList(img){
  57. var arr=[]
  58. arr.push(img)
  59. uni.previewImage({
  60. urls: arr,
  61. longPressActions: {
  62. itemList: ['发送给朋友', '保存图片'],
  63. success: function(data) {
  64. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  65. },
  66. fail: function(err) {
  67. console.log(err.errMsg);
  68. }
  69. }
  70. });
  71. }
  72. },
  73. }
  74. </script>
  75. <style scoped>
  76. .swiper-itemImg{
  77. width: 750rpx;
  78. height: 750rpx;
  79. }
  80. .uni-margin-wrap{
  81. height: 750rpx;
  82. }
  83. .swiper{
  84. height: 750rpx;
  85. }
  86. .datailTitle{
  87. font-weight: 500;
  88. color: #1A1A1A;
  89. line-height: 40rpx;
  90. padding: 32rpx 24rpx;
  91. font-size: 28rpx;
  92. }
  93. .name{
  94. font-weight: 500;
  95. color: #1A1A1A;
  96. line-height: 40rpx;
  97. font-size: 28rpx;
  98. padding: 30rpx 24rpx;
  99. }
  100. .detail img{
  101. width: 750rpx;
  102. }
  103. .detail image{
  104. width: 750rpx;
  105. }
  106. </style>