更新C 端,返回切换

This commit is contained in:
red-deng-deng 2022-01-22 15:50:40 +08:00
parent 9eb242a53d
commit ea8b62aa10
2 changed files with 14 additions and 14 deletions

View File

@ -175,7 +175,13 @@
}, },
methods: { methods: {
backgoodsFn() { backgoodsFn() {
window.history.back(); let goodsCount=sessionStorage.getItem('goodsCount');
if(goodsCount>1){
window.location.replace(document.referrer);
}else{
window.history.go(-2);
}
// window.location.replace(document.referrer);
}, },
closeTip() { closeTip() {
this.suspension = false; this.suspension = false;
@ -288,19 +294,13 @@
this.popboxshow = true; this.popboxshow = true;
this.tiptext = res.message; this.tiptext = res.message;
if (res.code == -1) { if (res.code == -1) {
let haskey = sessionStorage.getItem('haskey'); let goodsCount=sessionStorage.getItem('goodsCount');
if (haskey) { if(goodsCount>1){
setTimeout(() => { setTimeout(() => {
// window.location.href = "./index.html?id=" + sessionStorage.getItem('linkId')+'&'; window.location.replace(document.referrer);
window.history.back();
// sessionStorage.clear();
}, 3000);
} else {
let showType = sessionStorage.getItem('showType');
setTimeout(() => {
window.history.back();
// sessionStorage.clear();
}, 3000); }, 3000);
}else{
window.history.go(-2);
} }
} }
} }

View File

@ -329,7 +329,7 @@
self.swiperDataList = goodsArr; self.swiperDataList = goodsArr;
self.goodsShow = goodsArr.length > 1; self.goodsShow = goodsArr.length > 1;
sessionStorage.setItem('goodsNum', 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);
@ -364,9 +364,9 @@
req.axiosPostproducts('/key/products', data).then(res => { req.axiosPostproducts('/key/products', data).then(res => {
if (res.code == 200) { if (res.code == 200) {
self.swiperDataList = res.data; self.swiperDataList = res.data;
sessionStorage.setItem('goodsCount',res.data.length);
self.goodsShow = res.data.length > 1; self.goodsShow = res.data.length > 1;
if (res.data && res.data.length == 1&&res.data[0].available==1) { if (res.data && res.data.length == 1&&res.data[0].available==1) {
console.log(123,res.data);
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";
return false; return false;