Commit 82b53bc3 by 侯体倬

store 数据丢失后获取缓存

parent 3b8fcf1e
...@@ -50,6 +50,7 @@ export default { ...@@ -50,6 +50,7 @@ export default {
this.extConfig = shopItem[process.env.NODE_ENV]; this.extConfig = shopItem[process.env.NODE_ENV];
} }
wx.setStorageSync("extConfig", JSON.stringify(this.extConfig)); wx.setStorageSync("extConfig", JSON.stringify(this.extConfig));
wx.setStorageSync("mixid", this.extConfig.mixid);
// 行为收集初始化 // 行为收集初始化
this.$mpBehavior.init("mayi-moblie-shop-mp", this.extConfig.shopid, { this.$mpBehavior.init("mayi-moblie-shop-mp", this.extConfig.shopid, {
......
...@@ -2,9 +2,11 @@ import store from '../store/index' ...@@ -2,9 +2,11 @@ import store from '../store/index'
// 获取请求头 // 获取请求头
const getRequestHeader = (extraHeader = {}) => { const getRequestHeader = (extraHeader = {}) => {
const mixid = store.state.mixid || wx.getStorageSync('mixid');
// 共用请求头 // 共用请求头
const BASE_HEADER = { const BASE_HEADER = {
"Shop-Mixid": store.state.mixid, "Shop-Mixid": mixid,
"Authorization": wx.getStorageSync('sessionid') || "", "Authorization": wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "", "Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '', "Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
...@@ -12,7 +14,7 @@ const getRequestHeader = (extraHeader = {}) => { ...@@ -12,7 +14,7 @@ const getRequestHeader = (extraHeader = {}) => {
} }
// 判断是否存在导购员 id // 判断是否存在导购员 id
const setGuideEmployeeId = wx.getStorageSync(store.state.mixid + 'setGuideEmployeeId'); const setGuideEmployeeId = wx.getStorageSync(mixid + 'setGuideEmployeeId');
if (setGuideEmployeeId) { if (setGuideEmployeeId) {
BASE_HEADER['Guide-Employee-Id'] = setGuideEmployeeId; BASE_HEADER['Guide-Employee-Id'] = setGuideEmployeeId;
} }
......
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