Commit ca3ee43a authored by Xuguangxing's avatar Xuguangxing

fix

parent a5c99714
......@@ -44,7 +44,7 @@
</div>
</div>
<div
v-for="num in maxCount - 1 - avatorList.length"
v-for="num in maxCount - avatorList.length"
:key="`placeholder${num}`"
class="item placeholder"
/>
......@@ -117,6 +117,11 @@ export default {
this.maxCount = openGroupCnt >= 6 ? 6 : openGroupCnt;
this.openGroupCnt = openGroupCnt;
this.avatorList = peoplePhotoList.slice(0, openGroupCnt);
this.$nextTick(() => {
if (this.avatorList.length === 0) {
this.maxCount -= 1;
}
});
},
async createAndUploadPic(sharePicData) {
this.sharePicData = sharePicData;
......
......@@ -418,67 +418,71 @@ export default {
},
async init(detailParam) {
const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = +res.groupBuyInfo.groupId || 0;
}
if (res.groupBuyInfo?.joinGroup) {
const query = { ...this.$route.query };
return this.$router.replace({ name: 'groupBuySkuInfoSmallPic', query });
}
this.imgList = res.imageUrl || [];
this.detailInfo = res;
this.setStartStatus(res);
this.showPage = true;
try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
// this.detailImgList = (detailImages || '').match(imgReg);
let imgReg = /<img.*?(?:>|\/>)/gi;
// eslint-disable-next-line no-useless-escape
let srcReg = /src=[\'"]?([^\'"]*)[\'"]?/i;
let arr = (detailImages || '').match(imgReg);
let srcArr = [];
for (let i = 0; i < arr.length; i++) {
let src = arr[i].match(srcReg)[1].replace('http://', 'https://');
srcArr.push(src);
if (res.groupBuyInfo?.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = +res.groupBuyInfo.groupId || 0;
}
this.detailImgList = srcArr;
} catch (error) {
console.error(error);
}
this.selectedGoods.skuId = this.detailInfo.skuNo;
if (res.activitySkuTotalCount === 0) {
this.detailInfo.limitCount = 1;
this.detailInfo.activityLimitCount = 0;
this.$dialog({
message: '哎呀,活动太火爆,该商品已经卖光,换一个商品试试吧!',
title: '',
showCancelButton: false,
confirmButtonText: '查看其他商品',
onConfirm: () => {
this.$router.push({ name: 'groupBuyList' });
if (res.groupBuyInfo?.joinGroup) {
const query = { ...this.$route.query };
return this.$router.replace({ name: 'groupBuySkuInfoSmallPic', query });
}
this.imgList = res.imageUrl || [];
this.detailInfo = res;
this.setStartStatus(res);
this.showPage = true;
try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
// this.detailImgList = (detailImages || '').match(imgReg);
let imgReg = /<img.*?(?:>|\/>)/gi;
// eslint-disable-next-line no-useless-escape
let srcReg = /src=[\'"]?([^\'"]*)[\'"]?/i;
let arr = (detailImages || '').match(imgReg);
let srcArr = [];
for (let i = 0; i < arr.length; i++) {
let src = arr[i].match(srcReg)[1].replace('http://', 'https://');
srcArr.push(src);
}
this.detailImgList = srcArr;
} catch (error) {
console.error(error);
}
this.selectedGoods.skuId = this.detailInfo.skuNo;
if (res.activitySkuTotalCount === 0) {
this.detailInfo.limitCount = 1;
this.detailInfo.activityLimitCount = 0;
this.$dialog({
message: '哎呀,活动太火爆,该商品已经卖光,换一个商品试试吧!',
title: '',
showCancelButton: false,
confirmButtonText: '查看其他商品',
onConfirm: () => {
this.$router.push({ name: 'groupBuyList' });
}
});
}
this.selectedAddress = res.receiverInfo || {};
this.specList = res.skuAtts || [];
let li = [];
this.specList.forEach(item => {
item.attsValues.forEach(i => {
i.attsCode = item.attsCode;
if (i.isSelected) {
this.specSelected.push(i);
}
});
li = li.concat(item.attsValues);
});
this.specChildList = li;
// // 收货地址
// this.getAddr();
//选择的商品规格
this.getSelectedSkuNo(this.specSelected);
} catch (e) {
this.$toast('获取商品详情失败');
}
this.selectedAddress = res.receiverInfo || {};
this.specList = res.skuAtts || [];
let li = [];
this.specList.forEach(item => {
item.attsValues.forEach(i => {
i.attsCode = item.attsCode;
if (i.isSelected) {
this.specSelected.push(i);
}
});
li = li.concat(item.attsValues);
});
this.specChildList = li;
// // 收货地址
// this.getAddr();
//选择的商品规格
this.getSelectedSkuNo(this.specSelected);
},
async getAddr() {
if (!this.hasLogin) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment