fix:更改数据存储方式
This commit is contained in:
parent
b03a59eaa6
commit
7456a7ccd5
|
@ -286,9 +286,9 @@
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
this.getGoods();
|
this.getGoods();
|
||||||
let productConfig = JSON.parse(sessionStorage.getItem('product_list'));
|
let productConfig = JSON.parse(localStorage.getItem('product_list'));
|
||||||
document.title = sessionStorage.getItem('title');
|
document.title = localStorage.getItem('title');
|
||||||
this.isKey = sessionStorage.getItem('haskey');
|
this.isKey = localStorage.getItem('haskey');
|
||||||
this.describe = productConfig.describe;
|
this.describe = productConfig.describe;
|
||||||
this.viewConfig = productConfig
|
this.viewConfig = productConfig
|
||||||
|
|
||||||
|
@ -331,13 +331,13 @@
|
||||||
//根据token获取商品信息
|
//根据token获取商品信息
|
||||||
async getGoods () {
|
async getGoods () {
|
||||||
let self = this;
|
let self = this;
|
||||||
let showType = sessionStorage.getItem('showType');
|
let showType = localStorage.getItem('showType');
|
||||||
this.showType = showType;
|
this.showType = showType;
|
||||||
let data = {
|
let data = {
|
||||||
"last_product_id": sessionStorage.getItem('lastid') | 0,
|
"last_product_id": localStorage.getItem('lastid') | 0,
|
||||||
}
|
}
|
||||||
if (showType == 1) { //白名单
|
if (showType == 1) { //白名单
|
||||||
let tokenList = JSON.parse(sessionStorage.getItem('getTokenList'));
|
let tokenList = JSON.parse(localStorage.getItem('getTokenList'));
|
||||||
let goodsList = [];
|
let goodsList = [];
|
||||||
for (item of tokenList) {
|
for (item of tokenList) {
|
||||||
let goodsItem = [];
|
let goodsItem = [];
|
||||||
|
@ -355,7 +355,7 @@
|
||||||
this.popShow = true
|
this.popShow = true
|
||||||
if (res.code == -1) {
|
if (res.code == -1) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = sessionStorage.getItem('white_link');
|
window.location.href = localStorage.getItem('white_link');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,14 +400,14 @@
|
||||||
}
|
}
|
||||||
goodsArr.sort(objectArraySort('weight'))
|
goodsArr.sort(objectArraySort('weight'))
|
||||||
self.swiperDataList = goodsArr;
|
self.swiperDataList = goodsArr;
|
||||||
sessionStorage.setItem('goodsCollection', JSON.stringify(goodsArr));
|
localStorage.setItem('goodsCollection', JSON.stringify(goodsArr));
|
||||||
self.goodsShow = goodsArr.length > 1;
|
self.goodsShow = goodsArr.length > 1;
|
||||||
sessionStorage.setItem('goodsCount', goodsArr.length);
|
localStorage.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]));
|
localStorage.setItem('goodsInfo', JSON.stringify(goodsArr[0]));
|
||||||
sessionStorage.setItem('key', goodsArr[0].key);
|
localStorage.setItem('key', goodsArr[0].key);
|
||||||
sessionStorage.setItem('token', goodsArr[0].token);
|
localStorage.setItem('token', goodsArr[0].token);
|
||||||
window.location.replace(goodsArr[0].type == 1 ? "./exchange.html" : "./index.html?id=" + sessionStorage.getItem('linkId'));
|
window.location.replace(goodsArr[0].type == 1 ? "./exchange.html" : "./index.html?id=" + localStorage.getItem('linkId'));
|
||||||
return false;
|
return false;
|
||||||
} else if (goodsArr && goodsArr.length >= 1) {
|
} else if (goodsArr && goodsArr.length >= 1) {
|
||||||
self.goodsNum = true;
|
self.goodsNum = true;
|
||||||
|
@ -433,15 +433,15 @@
|
||||||
self.goodsNum = false;
|
self.goodsNum = false;
|
||||||
}
|
}
|
||||||
} else { //兑换码
|
} else { //兑换码
|
||||||
data.token = sessionStorage.getItem('token')
|
data.token = localStorage.getItem('token')
|
||||||
req.axiosPost('/key/products', data).then(res => {
|
req.axiosPost('/key/products', data).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
self.swiperDataList = res.data;
|
self.swiperDataList = res.data;
|
||||||
sessionStorage.setItem('goodsCollection', JSON.stringify(res.data));
|
localStorage.setItem('goodsCollection', JSON.stringify(res.data));
|
||||||
sessionStorage.setItem('goodsCount', res.data.length);
|
localStorage.setItem('goodsCount', res.data.length);
|
||||||
self.goodsShow = res.data.length > 1;
|
self.goodsShow = res.data.length > 1;
|
||||||
if (res.data && res.data.length == 1) {//单个商品直接进入详情页面
|
if (res.data && res.data.length == 1) {//单个商品直接进入详情页面
|
||||||
sessionStorage.setItem('goodsInfo', JSON.stringify(res.data[0]));
|
localStorage.setItem('goodsInfo', JSON.stringify(res.data[0]));
|
||||||
window.location.replace(res.data[0].type == 1 ? "./exchange.html" : "./reduce.html");
|
window.location.replace(res.data[0].type == 1 ? "./exchange.html" : "./reduce.html");
|
||||||
return false;
|
return false;
|
||||||
} else if (res.data && res.data.length >= 1) {
|
} else if (res.data && res.data.length >= 1) {
|
||||||
|
@ -471,14 +471,14 @@
|
||||||
this.popStatus = 3
|
this.popStatus = 3
|
||||||
this.popShow = true
|
this.popShow = true
|
||||||
if (res.code == -1) {
|
if (res.code == -1) {
|
||||||
let haskey = sessionStorage.getItem('haskey');
|
let haskey = localStorage.getItem('haskey');
|
||||||
if (haskey) {
|
if (haskey) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = "./index.html?id=" + sessionStorage.getItem('linkId');
|
window.location.href = "./index.html?id=" + localStorage.getItem('linkId');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,10 +496,10 @@
|
||||||
if (gstatus == 1) {
|
if (gstatus == 1) {
|
||||||
// 跳转商品详情页面
|
// 跳转商品详情页面
|
||||||
if (this.showType == 1) { //白名单
|
if (this.showType == 1) { //白名单
|
||||||
sessionStorage.setItem('token', row.token);
|
localStorage.setItem('token', row.token);
|
||||||
sessionStorage.setItem('key', row.key);
|
localStorage.setItem('key', row.key);
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('goodsInfo', JSON.stringify(row));
|
localStorage.setItem('goodsInfo', JSON.stringify(row));
|
||||||
//type :1 兑换码 2:立减金
|
//type :1 兑换码 2:立减金
|
||||||
window.location.replace("./exchange.html");
|
window.location.replace("./exchange.html");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -217,14 +217,14 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
document.title = sessionStorage.getItem('title');
|
document.title = localStorage.getItem('title');
|
||||||
let detailsConfig = JSON.parse(sessionStorage.getItem('product_detail'));
|
let detailsConfig = JSON.parse(localStorage.getItem('product_detail'));
|
||||||
goodsCount = sessionStorage.getItem('goodsCount');
|
goodsCount = localStorage.getItem('goodsCount');
|
||||||
this.backAble = goodsCount > 1;//多个商品才有返回
|
this.backAble = goodsCount > 1;//多个商品才有返回
|
||||||
this.bgcolor = detailsConfig.button_color;
|
this.bgcolor = detailsConfig.button_color;
|
||||||
this.ftColor = detailsConfig.font_color;
|
this.ftColor = detailsConfig.font_color;
|
||||||
this.describe = detailsConfig.describe;
|
this.describe = detailsConfig.describe;
|
||||||
goodsDetail = JSON.parse(sessionStorage.getItem('goodsInfo'));//商品详情
|
goodsDetail = JSON.parse(localStorage.getItem('goodsInfo'));//商品详情
|
||||||
this.goodsDetail = goodsDetail;//商品详情
|
this.goodsDetail = goodsDetail;//商品详情
|
||||||
let goodsInform = goodsDetail.entity; //商品信息
|
let goodsInform = goodsDetail.entity; //商品信息
|
||||||
this.goodInfo = goodsInform;
|
this.goodInfo = goodsInform;
|
||||||
|
@ -344,8 +344,8 @@
|
||||||
createdOrder (payType) {
|
createdOrder (payType) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let data = {
|
let data = {
|
||||||
"token": sessionStorage.getItem('token'),
|
"token": localStorage.getItem('token'),
|
||||||
"key": sessionStorage.getItem('key'),
|
"key": localStorage.getItem('key'),
|
||||||
"code_batch_id": this.goodInfo.code_batch_id,
|
"code_batch_id": this.goodInfo.code_batch_id,
|
||||||
"goods_id": this.goodInfo.goods_id,
|
"goods_id": this.goodInfo.goods_id,
|
||||||
"account": this.account,
|
"account": this.account,
|
||||||
|
@ -365,7 +365,7 @@
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
/*跳转起始页面*/
|
/*跳转起始页面*/
|
||||||
let entryLink = sessionStorage.getItem('entryLink');
|
let entryLink = localStorage.getItem('entryLink');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.replace(entryLink);
|
window.location.replace(entryLink);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
|
@ -129,11 +129,11 @@
|
||||||
document.title = res.data.title;
|
document.title = res.data.title;
|
||||||
self.plan_id = res.data.plan_id
|
self.plan_id = res.data.plan_id
|
||||||
this.pageType = res.data.page;
|
this.pageType = res.data.page;
|
||||||
sessionStorage.setItem('title', res.data.title);
|
localStorage.setItem('title', res.data.title);
|
||||||
sessionStorage.setItem('product_list', JSON.stringify(res.data[this.typeList[res.data.page]].product_list));
|
localStorage.setItem('product_list', JSON.stringify(res.data[this.typeList[res.data.page]].product_list));
|
||||||
sessionStorage.setItem('product_detail', JSON.stringify(res.data[this.typeList[res.data.page]].product_detail));
|
localStorage.setItem('product_detail', JSON.stringify(res.data[this.typeList[res.data.page]].product_detail));
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
sessionStorage.setItem('linkId', linkId);
|
localStorage.setItem('linkId', linkId);
|
||||||
//是否携带token
|
//是否携带token
|
||||||
if (keyCode) {
|
if (keyCode) {
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -141,11 +141,11 @@
|
||||||
}
|
}
|
||||||
req.axiosPost('/key/loginFromLink', data).then(res => {
|
req.axiosPost('/key/loginFromLink', data).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
sessionStorage.setItem('key', keyCode);
|
localStorage.setItem('key', keyCode);
|
||||||
sessionStorage.setItem('token', res.data.token);
|
localStorage.setItem('token', res.data.token);
|
||||||
sessionStorage.setItem('haskey', keyCode);
|
sessionStorage.setItem('haskey', keyCode);
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
sessionStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.pageType === 4) {
|
if (this.pageType === 4) {
|
||||||
window.location.href = './couponCollection.html';
|
window.location.href = './couponCollection.html';
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
let data = {
|
let data = {
|
||||||
"key": this.key,
|
"key": this.key,
|
||||||
"code": this.code,
|
"code": this.code,
|
||||||
"code_unique_str": sessionStorage.getItem('unique_str')
|
"code_unique_str": localStorage.getItem('unique_str')
|
||||||
}
|
}
|
||||||
req.axiosPost('/key/login', data).then(res => {
|
req.axiosPost('/key/login', data).then(res => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -231,10 +231,10 @@
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
sessionStorage.setItem('key', self.key);
|
localStorage.setItem('key', self.key);
|
||||||
sessionStorage.setItem('token', res.data.token);
|
localStorage.setItem('token', res.data.token);
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
sessionStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.pageType === 4) {
|
if (this.pageType === 4) {
|
||||||
window.location.href = './couponCollection.html';
|
window.location.href = './couponCollection.html';
|
||||||
|
@ -258,10 +258,10 @@
|
||||||
self.disabledBtn = false;
|
self.disabledBtn = false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
sessionStorage.setItem('key', self.key);
|
localStorage.setItem('key', self.key);
|
||||||
sessionStorage.setItem('token', res.data.data);
|
localStorage.setItem('token', res.data.data);
|
||||||
sessionStorage.setItem('showType', 1);
|
localStorage.setItem('showType', 1);
|
||||||
sessionStorage.setItem('white_link', window.location.href);
|
localStorage.setItem('white_link', window.location.href);
|
||||||
let tokenArr = res.data.data;
|
let tokenArr = res.data.data;
|
||||||
let istoGoods = false;
|
let istoGoods = false;
|
||||||
for (item of tokenArr) {
|
for (item of tokenArr) {
|
||||||
|
@ -285,9 +285,9 @@
|
||||||
}).catch(err => { });
|
}).catch(err => { });
|
||||||
};
|
};
|
||||||
if (istoGoods) {
|
if (istoGoods) {
|
||||||
sessionStorage.setItem('getTokenList', JSON.stringify(getTokenList));
|
localStorage.setItem('getTokenList', JSON.stringify(getTokenList));
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
sessionStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '../homepage.html';
|
window.location.href = '../homepage.html';
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
|
|
||||||
/* 请求数据 */
|
/* 请求数据 */
|
||||||
getCouponList () {
|
getCouponList () {
|
||||||
const key = sessionStorage.getItem('key')
|
const key = localStorage.getItem('key')
|
||||||
req.axiosGet('/key/coupon/list', {
|
req.axiosGet('/key/coupon/list', {
|
||||||
key,
|
key,
|
||||||
status: this.tabActive
|
status: this.tabActive
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
this.popShow = true
|
this.popShow = true
|
||||||
if (!this.popShow) {
|
if (!this.popShow) {
|
||||||
/*跳转起始页面*/
|
/*跳转起始页面*/
|
||||||
let entryLink = sessionStorage.getItem('entryLink');
|
let entryLink = localStorage.getItem('entryLink');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.replace(entryLink);
|
window.location.replace(entryLink);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
this.getOrderList()
|
this.getOrderList()
|
||||||
this.goodsCount = sessionStorage.getItem('goodsCount');
|
this.goodsCount = localStorage.getItem('goodsCount');
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
|
|
||||||
/* 请求订单数据 */
|
/* 请求订单数据 */
|
||||||
getOrderList () {
|
getOrderList () {
|
||||||
const key = sessionStorage.getItem('key')
|
const key = localStorage.getItem('key')
|
||||||
req.axiosGet(`/key/order/${key}`, { page: this.page, limit: this.limit }).then(({ data, code, message }) => {
|
req.axiosGet(`/key/order/${key}`, { page: this.page, limit: this.limit }).then(({ data, code, message }) => {
|
||||||
if (code === -1) {
|
if (code === -1) {
|
||||||
this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true })
|
this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true })
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
|
|
||||||
/*跳转起始页面*/
|
/*跳转起始页面*/
|
||||||
toPage () {
|
toPage () {
|
||||||
let entryLink = sessionStorage.getItem('entryLink');
|
let entryLink = localStorage.getItem('entryLink');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.replace(entryLink);
|
window.location.replace(entryLink);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
goodsCollection=JSON.parse(sessionStorage.getItem('goodsCollection'));
|
goodsCollection=JSON.parse(localStorage.getItem('goodsCollection'));
|
||||||
this.searchResult=goodsCollection;
|
this.searchResult=goodsCollection;
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
@ -58,10 +58,10 @@
|
||||||
if (gstatus == 1) {
|
if (gstatus == 1) {
|
||||||
// 跳转商品详情页面
|
// 跳转商品详情页面
|
||||||
if (this.showType == 1) { //白名单
|
if (this.showType == 1) { //白名单
|
||||||
sessionStorage.setItem('token', row.token);
|
localStorage.setItem('token', row.token);
|
||||||
sessionStorage.setItem('key', row.key);
|
localStorage.setItem('key', row.key);
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('goodsInfo', JSON.stringify(row));
|
localStorage.setItem('goodsInfo', JSON.stringify(row));
|
||||||
//type :1 兑换码 2:立减金
|
//type :1 兑换码 2:立减金
|
||||||
window.location.replace("./exchange.html");
|
window.location.replace("./exchange.html");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue