|
|
@@ -79,10 +79,22 @@
|
|
|
:offset-top="barHeight"
|
|
|
>
|
|
|
<van-tab title="图文详情">
|
|
|
- <div class="detail-content">
|
|
|
+ <div class="detail-content first">
|
|
|
+ <van-button
|
|
|
+ class="imgList-btn"
|
|
|
+ size="small"
|
|
|
+ :color="$colors.warn"
|
|
|
+ round
|
|
|
+ icon="photo"
|
|
|
+ plain
|
|
|
+ v-if="showBtn && detailImgList.length > 0"
|
|
|
+ @click="showImgs"
|
|
|
+ ></van-button>
|
|
|
<div class="tips" v-html="introduction"></div>
|
|
|
<!-- <rich-text v-if="detailImg" :nodes="detailImg"></rich-text> -->
|
|
|
- <div v-html="detailImg" v-if="detailImg"></div>
|
|
|
+ <div class="detailhtml">
|
|
|
+ <div v-html="detailImg" v-if="detailImg"></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</van-tab>
|
|
|
<van-tab title="详细参数">
|
|
|
@@ -91,7 +103,9 @@
|
|
|
</div>
|
|
|
</van-tab>
|
|
|
<van-tab title="PDF资料" v-if="pdf.length > 0">
|
|
|
- 正在打开pdf...
|
|
|
+ <div class="detail-content">
|
|
|
+ 正在打开pdf...
|
|
|
+ </div>
|
|
|
</van-tab>
|
|
|
</van-tabs>
|
|
|
</div>
|
|
|
@@ -145,21 +159,31 @@ export default {
|
|
|
vendorInfo: {},
|
|
|
hotActive: 0,
|
|
|
detailTop: 0,
|
|
|
- collectionType: 'PRODUCT'
|
|
|
+ collectionType: 'PRODUCT',
|
|
|
+ detailImgList: [],
|
|
|
+ showBtn: false,
|
|
|
+ screenHeight: 300
|
|
|
};
|
|
|
},
|
|
|
mixins: [collection],
|
|
|
computed: {
|
|
|
...mapState(['intentionList', 'barHeight']),
|
|
|
banners() {
|
|
|
+ let list = [];
|
|
|
if (this.productInfo.img) {
|
|
|
- return this.productInfo.img.split(',').map((item, index) => {
|
|
|
+ list = this.productInfo.img.split(',').map((item, index) => {
|
|
|
return {
|
|
|
img: item
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
- return [];
|
|
|
+
|
|
|
+ if (this.productInfo.video) {
|
|
|
+ list.splice(0, 0, {
|
|
|
+ img: this.productInfo.video
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return list;
|
|
|
},
|
|
|
applicationField() {
|
|
|
let list = this.productInfo.applicationField ? [...this.productInfo.applicationField] : [];
|
|
|
@@ -213,6 +237,7 @@ export default {
|
|
|
.get(`/product/getDto/${options.id}`)
|
|
|
.then(res => {
|
|
|
this.productInfo = res;
|
|
|
+ this.getImgList(res.detailImg);
|
|
|
return this.$http.get('/vendorInfo/getHome/' + res.vendorInfoId);
|
|
|
})
|
|
|
.then(res => {
|
|
|
@@ -224,8 +249,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onPageScroll() {},
|
|
|
+ onPageScroll(e) {
|
|
|
+ if (e.scrollTop > this.detailTop - this.screenHeight + 300) {
|
|
|
+ this.showBtn = true;
|
|
|
+ } else {
|
|
|
+ this.showBtn = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
onReady() {
|
|
|
+ wx.getSystemInfo({
|
|
|
+ success: res => {
|
|
|
+ this.screenHeight = res.screenHeight;
|
|
|
+ }
|
|
|
+ });
|
|
|
setTimeout(() => {
|
|
|
wx.createSelectorQuery()
|
|
|
.select('#main')
|
|
|
@@ -248,24 +284,28 @@ export default {
|
|
|
duration: 300
|
|
|
});
|
|
|
this.hotActive = e.detail.index;
|
|
|
- console.log(this.pdf);
|
|
|
if (e.detail.index === 2) {
|
|
|
wx.showActionSheet({
|
|
|
itemList: [...this.pdf].map((item, index) => {
|
|
|
- console.log(item);
|
|
|
- return '查看pdf文件' + item.name;
|
|
|
+ const name = item.name.indexOf('http') !== -1 ? `文件${index + 1}` : item.name;
|
|
|
+ return name;
|
|
|
}),
|
|
|
success: res => {
|
|
|
- this.hotActive = 0;
|
|
|
+ this.$loading('加载中...');
|
|
|
wx.downloadFile({
|
|
|
url: this.pdf[res.tapIndex].url,
|
|
|
+ fileType: 'pdf',
|
|
|
success: res => {
|
|
|
+ this.hotActive = 0;
|
|
|
+ console.log(res);
|
|
|
const filePath = res.tempFilePath;
|
|
|
-
|
|
|
wx.openDocument({
|
|
|
filePath: filePath,
|
|
|
success: res => {}
|
|
|
});
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ this.$loading.close();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -310,22 +350,49 @@ export default {
|
|
|
wx.openLocation({
|
|
|
latitude: 31.298919,
|
|
|
longitude: 121.629521,
|
|
|
- name: 'imt机床展示区',
|
|
|
+ name: '外高桥智能制造服务产业园',
|
|
|
address: '中国(上海)自由贸易试验区富特东三路526号'
|
|
|
});
|
|
|
+ },
|
|
|
+ getImgList(detailImg) {
|
|
|
+ if (detailImg) {
|
|
|
+ this.detailImgList = detailImg
|
|
|
+ .split('<img ')
|
|
|
+ .map(item => {
|
|
|
+ return item.split('/>')[0];
|
|
|
+ })
|
|
|
+ .map(item => {
|
|
|
+ return item.split('src="').length > 1 ? item.split('src="')[1] : '';
|
|
|
+ })
|
|
|
+ .map(item => {
|
|
|
+ return item.split('"')[0];
|
|
|
+ })
|
|
|
+ .filter(item => {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.detailImgList = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showImgs() {
|
|
|
+ if (this.detailImgList.length > 0) {
|
|
|
+ wx.previewImage({
|
|
|
+ current: this.detailImgList[0], // 当前显示图片的http链接
|
|
|
+ urls: [...this.detailImgList] // 需要预览的图片http链接列表
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
.main {
|
|
|
- background-color: @bgw;
|
|
|
-
|
|
|
.tips {
|
|
|
font-size: 14px;
|
|
|
color: #292c33;
|
|
|
line-height: 24px;
|
|
|
padding: 20px 16px;
|
|
|
+ font-weight: bold;
|
|
|
}
|
|
|
}
|
|
|
.info {
|
|
|
@@ -436,6 +503,19 @@ export default {
|
|
|
min-height: calc(100vh - 105px - 80rpx);
|
|
|
padding: 20px 16px;
|
|
|
box-sizing: border-box;
|
|
|
+
|
|
|
+ &.first {
|
|
|
+ background-color: @bg;
|
|
|
+ padding: 0 0;
|
|
|
+ .tips {
|
|
|
+ background-color: @bgw;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ }
|
|
|
+ .detailhtml {
|
|
|
+ background-color: @bgw;
|
|
|
+ padding: 20px 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.detaiImg {
|
|
|
@@ -505,4 +585,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.imgList-btn {
|
|
|
+ position: fixed;
|
|
|
+ right: 10px;
|
|
|
+ bottom: 15vh;
|
|
|
+ .van-button {
|
|
|
+ background-color: @bgw;
|
|
|
+ z-index: 200;
|
|
|
+ --button-small-min-width: 30px;
|
|
|
+ --button-border-width: 0px;
|
|
|
+ box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.1);
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|