禁止商品列表页连续输入返回

This commit is contained in:
red-deng-deng 2022-01-24 15:25:19 +08:00
parent 15f85fca7b
commit 0f8af73b78
2 changed files with 16 additions and 12 deletions

View File

@ -160,7 +160,7 @@
this.backAble=goodsCount>1;
this.bgcolor = detailsConfig.button_color;
this.bgcolor = '#f00'
this.ftcolor = detailsConfig.font_color;
this.describe = detailsConfig.describe;
this.goodInfo = JSON.parse(sessionStorage.getItem('goodsInfo'));
@ -180,7 +180,8 @@
backgoodsFn() {
let goodsCount=sessionStorage.getItem('goodsCount');
if(goodsCount>1){
window.location.replace(document.referrer);
// window.location.replace(document.referrer);
window.location.replace('./homepage.html');
}else{
history.go(-2);
}
@ -300,7 +301,8 @@
let goodsCount=sessionStorage.getItem('goodsCount');
if(goodsCount>1){
setTimeout(() => {
window.location.replace(document.referrer);
// window.location.replace(document.referrer);
window.location.replace('./homepage.html');
}, 3000);
}else{
let backUrl=window.history.length;

View File

@ -62,7 +62,7 @@
<div id="rotation" v-if="layout=='2'">
<!-- 顶部banner -->
<div class="topBanner">
<img class="backpresty" @click="backgoodsFn" v-if="backAble"
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="">
</div>
@ -106,7 +106,7 @@
<!-- 列表 -->
<div id="list" v-if="layout=='1'">
<div class="topBanner">
<img class="backpresty" @click="backgoodsFn" v-if="backAble"
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="">
</div>
@ -131,7 +131,7 @@
<!-- 矩阵 -->
<div id="matrix" v-if="layout=='3'">
<div class="topBanner">
<img class="backpresty" @click="backgoodsFn" v-if="backAble"
<img class="backpresty" @click="backgoodsFn" v-if="goodsShow&&!iskey"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img :src="topImg" alt="">
@ -221,12 +221,12 @@
popboxtype: '兑换',
topImg: '',
goodsShow: true,
backAble:true,
goodsNum: false,
exchangeCommity: {}, //兑换选择的商品
bgcolor: '',
describe: {},
ftcolor: '',
iskey:true,
allgoods: [],
showType:0,
tiptext: '还没开始哟兑换时间为2021-12-05 12:12:12至2021-01-01 12:12:12',
@ -241,6 +241,7 @@
this.topImg = productConfig.top_image;
document.title = sessionStorage.getItem('title');
this.layout = productConfig.list;
this.iskey=sessionStorage.getItem('haskey');
this.describe = productConfig.describe;
},
methods: {
@ -331,13 +332,13 @@
self.swiperDataList = goodsArr;
self.goodsShow = goodsArr.length > 1;
self.backAble=goodsArr.length > 1&&window.history.length>0;
sessionStorage.setItem('goodsCount', goodsArr.length);
if (goodsArr && goodsArr.length == 1&&goodsArr[0].available==1) {
sessionStorage.setItem('goodsInfo', JSON.stringify(goodsArr[0]));
sessionStorage.setItem('key',goodsArr[0].key);
sessionStorage.setItem('token',goodsArr[0].token);
window.location.href = "./exchange.html";
// window.location.href = "./exchange.html";
window.location.replace("./exchange.html");
return false;
}else if(goodsArr && goodsArr.length >= 1) {
self.goodsNum = true;
@ -369,10 +370,10 @@
self.swiperDataList = res.data;
sessionStorage.setItem('goodsCount',res.data.length);
self.goodsShow = res.data.length > 1;
self.backAble=res.data.length > 1&&window.history.length>0;
if (res.data && res.data.length == 1&&res.data[0].available==1) {
sessionStorage.setItem('goodsInfo', JSON.stringify(res.data[0]));
window.location.href = "./exchange.html";
// window.location.href = "./exchange.html";
window.location.replace("./exchange.html");
return false;
}else if(res.data && res.data.length >= 1) {
self.goodsNum = true;
@ -433,7 +434,8 @@
sessionStorage.setItem('key',row.key);
}
sessionStorage.setItem('goodsInfo', JSON.stringify(row));
window.location.href = './exchange.html';
// window.location.href = './exchange.html';
window.location.replace("./exchange.html");
// this.maskshow = true;
// this.proname = row.product_name;