Commit 2e6ba997 by 李嘉林

feat: 强制登录优化

parent 1edb028a
......@@ -6,6 +6,7 @@ import spokesman from "@/api/spokesman";
import { themeColor, checkShowConditionIds, getStoreInfo, setStoreInfo } from "@/utils/mayi";
import { query_isEntry } from "@/utils/mayi_fenxiao";
import { serialize } from "@/utils/index";
export default {
data() {
......@@ -57,7 +58,8 @@ export default {
mode: process.env.NODE_ENV,
gid: this.extConfig.groupId,
mixid: this.extConfig.mixid,
host: process.env.MANALYTICS_HOST+'?',
host: process.env.MANALYTICS_HOST + '?',
os: this.getOsJSON(),
})
console.log("1444444444", this.extConfig);
......@@ -311,7 +313,9 @@ export default {
console.log(this.mpApp, "mmmmm74", themeColor);
// 强制登录
if(res.data.data.whetherToForceLogin == 1 && !wx.getStorageSync('sessionid')) {
let backUrl = `/pages/home/main`;
console.log('强制登录->', this.$mp.appOptions);
let backQuery = serialize(this.$mp.appOptions.query);
let backUrl = `/${this.$mp.appOptions.path}` + `${backQuery ? `?${backQuery}` : ''}`;
const url = `/pages/login/main?back=${encodeURIComponent(
backUrl
)}&hideBack=1`;
......@@ -332,12 +336,12 @@ export default {
}
})
},
async getThemePage({ mixid, shopid }) {
async getThemePage({ mixid, shopid, offlineShopCode}) {
console.log("getThemePage--App.vue")
let {offlineShopCode} = getStoreInfo();
let osCode = offlineShopCode ? offlineShopCode : getStoreInfo().offlineShopCode;
await shop
.themePagesInfo({
shopMixId: offlineShopCode?offlineShopCode:mixid,
shopMixId: osCode ? osCode : mixid,
homePageFlag: false
})
.then((response) => {
......@@ -365,7 +369,16 @@ export default {
})
.catch((err) => {});
},
// ---
getOsJSON() {
let obj = {
osName: '', // ios或安卓
osVersion: '', // 操作系统版本号
wxVersion: '', // 微信版本号
wxSDKVersion: '', // 微信小程序SDK版本
mpCodeVersion: '', // 小程序环境时, 我们内部小程序的版本信息
};
return Obj;
}
},
onError(data) {
console.log(data, "js异常捕获");
......
......@@ -157,12 +157,12 @@ mpApp.themeColor = {}
mpApp.log = log
mpApp.tool = tool
function getThemePage({ mixid, shopid }) {
function getThemePage({ mixid, shopid, offlineShopCode }) {
console.log("getThemePage--main.js")
let {offlineShopCode} = getStoreInfo();
let osCode = offlineShopCode ? offlineShopCode : getStoreInfo().offlineShopCode;
shop
.themePagesInfo({
shopMixId: offlineShopCode?offlineShopCode:mixid,
shopMixId: osCode ? osCode : mixid,
homePageFlag: false,
})
.then((response) => {
......@@ -206,9 +206,11 @@ wx.onAppRoute(res => {
const url = `/pages/login/main?back=${encodeURIComponent(
backUrl
)}&hideBack=1`;
wx.navigateTo({
url: url
});
// TODO 暂时注释
// console.log('强制登录->', 2)
// wx.navigateTo({
// url: url
// });
}
new Promise((resolve) => {
if (!spokesmanId) {
......
......@@ -367,6 +367,7 @@ export default {
offlineShopCode:paramsObj.offlineShopCode,
offlineShopName:paramsObj.offlineShopName,
});
this.getThemePage();
}
// 判断是否为导购分享进入
if (paramsObj.setGuideEmployeeId) {
......@@ -529,7 +530,7 @@ export default {
init() {
console.log('index-init', this.mpApp.globalData.pageList);
if (!this.mpApp.globalData.pageList) {
app.getThemePage(this.$store.state.extConfig);
this.getThemePage();
}
// 获取小程序开启的订阅消息配置
shop.getWxMiniSubscribeMessageConfig().then(res => {
......@@ -549,6 +550,12 @@ export default {
}
});
},
// 每次更新缓存门店需要重新调用主题数据
getThemePage() {
let { offlineShopCode } = getStoreInfo();
console.log('index-init-offlineShopCode->', offlineShopCode);
app.getThemePage({...this.$store.state.extConfig, offlineShopCode});
},
checkLogin() {
let getOpenid = wx.getStorageSync("openid");
let getSessionid = wx.getStorageSync("sessionid");
......
......@@ -678,7 +678,8 @@ export default {
let parseLink=decodeURIComponent(this.backPath);
log.info(this.backPath,parseLink,'---------------------------325')
console.log(this.backPath,parseLink,this.ossLink, '---------------------------595')
console.log(this.backPath, parseLink, this.ossLink, '---------------------------595')
console.log('login-pushPageType->parseLink', parseLink);
if(parseLink.includes('/pages/') && !parseLink.startsWith("http")){
wx.reLaunch({
url: parseLink
......
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