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

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

View File

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