|
@@ -1,15 +1,22 @@
|
|
<template>
|
|
<template>
|
|
<view class="container">
|
|
<view class="container">
|
|
<view class="carousel">
|
|
<view class="carousel">
|
|
- <swiper indicator-dots :circular="true" duration="400">
|
|
|
|
- <swiper-item class="swiper-item" v-for="(item, index) in imgList" :key="index">
|
|
|
|
- <view class="image-wrapper">
|
|
|
|
- <image :src="item" class="loaded" mode="scaleToFill"></image>
|
|
|
|
- </view>
|
|
|
|
- </swiper-item>
|
|
|
|
- </swiper>
|
|
|
|
|
|
+
|
|
</view>
|
|
</view>
|
|
-
|
|
|
|
|
|
+ <swiper
|
|
|
|
+ :current="currIndex"
|
|
|
|
+ @change="changeSwiper"
|
|
|
|
+ style="width: 750rpx;"
|
|
|
|
+ :style="{ height: swiperHeight + 'rpx' }"
|
|
|
|
+ indicator-dots
|
|
|
|
+ autoplay
|
|
|
|
+ circular
|
|
|
|
+ :duration="1000"
|
|
|
|
+ >
|
|
|
|
+ <swiper-item v-for="(item, i) in imgList" :key="i" >
|
|
|
|
+ <image :id="'wrap' + i" style="width: 750rpx;" :src="item" mode="widthFix" />
|
|
|
|
+ </swiper-item>
|
|
|
|
+ </swiper>
|
|
<view class="introduce-section seckill-box-title" v-if="goodsType == 1">
|
|
<view class="introduce-section seckill-box-title" v-if="goodsType == 1">
|
|
<view class="title flex">
|
|
<view class="title flex">
|
|
<view class="title-box">
|
|
<view class="title-box">
|
|
@@ -161,6 +168,8 @@
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ currIndex: 0,
|
|
|
|
+ swiperHeight: 0,
|
|
isfg: 0,
|
|
isfg: 0,
|
|
details: '',
|
|
details: '',
|
|
reply: '', //评论
|
|
reply: '', //评论
|
|
@@ -217,6 +226,7 @@
|
|
};
|
|
};
|
|
},
|
|
},
|
|
async onLoad(options) {
|
|
async onLoad(options) {
|
|
|
|
+
|
|
let obj = this;
|
|
let obj = this;
|
|
if (options.isfg) {
|
|
if (options.isfg) {
|
|
this.isfg = options.isfg
|
|
this.isfg = options.isfg
|
|
@@ -275,6 +285,32 @@
|
|
...mapState('user', ['userInfo', 'hasLogin'])
|
|
...mapState('user', ['userInfo', 'hasLogin'])
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ /* 切换 swiper 滑块 */
|
|
|
|
+ changeSwiper(e) {
|
|
|
|
+ this.currIndex = e.detail.current;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.setSwiperHeight(); // 动态设置 swiper 的高度
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /* 动态设置 swiper 的高度 */
|
|
|
|
+ setSwiperHeight() {
|
|
|
|
+ // const element = "#wrap" + this.currIndex;
|
|
|
|
+ // const query = uni.createSelectorQuery().in(this);
|
|
|
|
+ // query.select(element).boundingClientRect();
|
|
|
|
+ // query.exec(res => {
|
|
|
|
+ // if (res && res[0]) this.swiperHeight = res[0].height;
|
|
|
|
+ // });
|
|
|
|
+ // console.log(this.swiperHeight,'this.swiperHeight');
|
|
|
|
+ let that = this
|
|
|
|
+ uni.getImageInfo({
|
|
|
|
+ src:that.imgList[that.currIndex],
|
|
|
|
+ success(e) {
|
|
|
|
+ console.log(e,'dddd');
|
|
|
|
+ that.swiperHeight = e.height * 750 / e.width
|
|
|
|
+ console.log(that.swiperHeight,'that.swiperHeight');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
navTo(url) {
|
|
navTo(url) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url
|
|
url
|
|
@@ -308,6 +344,10 @@
|
|
// console.log()
|
|
// console.log()
|
|
obj.reply = data.reply; //保存评论列表
|
|
obj.reply = data.reply; //保存评论列表
|
|
obj.imgList = goods.slider_image; //保存轮播图
|
|
obj.imgList = goods.slider_image; //保存轮播图
|
|
|
|
+ obj.$nextTick(() => {
|
|
|
|
+ obj.setSwiperHeight(); // 动态设置 swiper 的高度
|
|
|
|
+ });
|
|
|
|
+
|
|
obj.specList = data.productAttr; //保存分类列表
|
|
obj.specList = data.productAttr; //保存分类列表
|
|
console.log(data.productAttr);
|
|
console.log(data.productAttr);
|
|
obj.productValue = data.productValue; //保存分类查询数据
|
|
obj.productValue = data.productValue; //保存分类查询数据
|
|
@@ -332,9 +372,14 @@
|
|
//保存默认选中的对象字符串名称
|
|
//保存默认选中的对象字符串名称
|
|
let str = obj.specSelected.join(',');
|
|
let str = obj.specSelected.join(',');
|
|
// 设置默认值
|
|
// 设置默认值
|
|
- obj.actionImage = obj.productValue[str].image;
|
|
|
|
- obj.uniqueId = obj.productValue[str].unique;
|
|
|
|
- obj.goodIntegral = obj.productValue[str].integral
|
|
|
|
|
|
+ try{
|
|
|
|
+ obj.actionImage = obj.productValue[str].image;
|
|
|
|
+ obj.uniqueId = obj.productValue[str].unique;
|
|
|
|
+ obj.goodIntegral = obj.productValue[str].integral
|
|
|
|
+ }catch(e){
|
|
|
|
+ //TODO handle the exception
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
// #ifdef H5
|
|
// #ifdef H5
|
|
obj.shareDate();
|
|
obj.shareDate();
|
|
@@ -538,31 +583,6 @@
|
|
/* #ifdef APP-PLUS */
|
|
/* #ifdef APP-PLUS */
|
|
padding-top: var(--status-bar-height);
|
|
padding-top: var(--status-bar-height);
|
|
/* #endif */
|
|
/* #endif */
|
|
- height: 722rpx;
|
|
|
|
- position: relative;
|
|
|
|
-
|
|
|
|
- swiper {
|
|
|
|
- height: 100%;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .image-wrapper {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 100%;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .swiper-item {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: center;
|
|
|
|
- align-content: center;
|
|
|
|
- // height: 750rpx;
|
|
|
|
- height: 710rpx;
|
|
|
|
- overflow: hidden;
|
|
|
|
-
|
|
|
|
- image {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 100%;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// 秒杀
|
|
// 秒杀
|