Commit ca3ee43a authored by Xuguangxing's avatar Xuguangxing

fix

parent a5c99714
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<div <div
v-for="num in maxCount - 1 - avatorList.length" v-for="num in maxCount - avatorList.length"
:key="`placeholder${num}`" :key="`placeholder${num}`"
class="item placeholder" class="item placeholder"
/> />
...@@ -117,6 +117,11 @@ export default { ...@@ -117,6 +117,11 @@ export default {
this.maxCount = openGroupCnt >= 6 ? 6 : openGroupCnt; this.maxCount = openGroupCnt >= 6 ? 6 : openGroupCnt;
this.openGroupCnt = openGroupCnt; this.openGroupCnt = openGroupCnt;
this.avatorList = peoplePhotoList.slice(0, openGroupCnt); this.avatorList = peoplePhotoList.slice(0, openGroupCnt);
this.$nextTick(() => {
if (this.avatorList.length === 0) {
this.maxCount -= 1;
}
});
}, },
async createAndUploadPic(sharePicData) { async createAndUploadPic(sharePicData) {
this.sharePicData = sharePicData; this.sharePicData = sharePicData;
......
...@@ -418,67 +418,71 @@ export default { ...@@ -418,67 +418,71 @@ export default {
}, },
async init(detailParam) { async init(detailParam) {
const [res] = await goods.detailInfo(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 { try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl); if (res.groupBuyInfo?.groupId) {
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g'); localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
// this.detailImgList = (detailImages || '').match(imgReg); this.groupId = +res.groupBuyInfo.groupId || 0;
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; if (res.groupBuyInfo?.joinGroup) {
} catch (error) { const query = { ...this.$route.query };
console.error(error); return this.$router.replace({ name: 'groupBuySkuInfoSmallPic', query });
} }
this.imgList = res.imageUrl || [];
this.selectedGoods.skuId = this.detailInfo.skuNo; this.detailInfo = res;
if (res.activitySkuTotalCount === 0) { this.setStartStatus(res);
this.detailInfo.limitCount = 1; this.showPage = true;
this.detailInfo.activityLimitCount = 0; try {
this.$dialog({ const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
message: '哎呀,活动太火爆,该商品已经卖光,换一个商品试试吧!', // const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
title: '', // this.detailImgList = (detailImages || '').match(imgReg);
showCancelButton: false, let imgReg = /<img.*?(?:>|\/>)/gi;
confirmButtonText: '查看其他商品', // eslint-disable-next-line no-useless-escape
onConfirm: () => { let srcReg = /src=[\'"]?([^\'"]*)[\'"]?/i;
this.$router.push({ name: 'groupBuyList' }); 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() { async getAddr() {
if (!this.hasLogin) { 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