|
@@ -285,7 +285,12 @@ const useStores = defineStore("useStores", {
|
|
|
// 退出系统
|
|
|
LogOut() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- logout({openId:localStorage.getItem("wxOpenId") ? localStorage.getItem("wxOpenId") : ""})
|
|
|
+ const openId = null;
|
|
|
+ // #ifdef H5
|
|
|
+ openId = localStorage.getItem("wxOpenId") ? localStorage.getItem("wxOpenId") : ""
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ logout({ openId: openId })
|
|
|
.then(() => {
|
|
|
setting.setBadge(0); // 设置角标值
|
|
|
|
|
@@ -294,7 +299,6 @@ const useStores = defineStore("useStores", {
|
|
|
this.SET_PERMISSIONS([]);
|
|
|
removeToken();
|
|
|
storage.clean();
|
|
|
- localStorage.removeItem("App-Token");
|
|
|
resolve();
|
|
|
})
|
|
|
.catch((error) => {
|
|
@@ -310,10 +314,10 @@ const useStores = defineStore("useStores", {
|
|
|
GetWxOpenId(type, options) {
|
|
|
let url = "https://manager.usky.cn/mobile/#/"
|
|
|
if (type == 1 && common.isWechatMp()) {
|
|
|
- if(localStorage.getItem("wxOpenId")){
|
|
|
- if(localStorage.getItem("App-Token")){
|
|
|
+ if (localStorage.getItem("wxOpenId")) {
|
|
|
+ if (localStorage.getItem("App-Token")) {
|
|
|
window.location.href = `${url}pages/index`;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
getPageAuthorization({ openId: localStorage.getItem("wxOpenId") }).then((res) => {
|
|
|
if (res?.data?.openid && res?.data?.accessToken) {
|
|
|
localStorage.setItem("App-Token", res.data.accessToken)
|
|
@@ -322,7 +326,7 @@ const useStores = defineStore("useStores", {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (window.location.href.indexOf("openId=") == -1) {
|
|
|
window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
|
|
|
} else {
|
|
@@ -331,8 +335,8 @@ const useStores = defineStore("useStores", {
|
|
|
}
|
|
|
}
|
|
|
} else if (type == 2 && common.isWechatMp()) {
|
|
|
- if(localStorage.getItem("wxOpenId")){
|
|
|
- if(!localStorage.getItem("App-Token")){
|
|
|
+ if (localStorage.getItem("wxOpenId")) {
|
|
|
+ if (!localStorage.getItem("App-Token")) {
|
|
|
getPageAuthorization({ openId: localStorage.getItem("wxOpenId") }).then((res) => {
|
|
|
if (res?.data?.openid && res?.data?.accessToken) {
|
|
|
localStorage.setItem("App-Token", res.data.accessToken)
|
|
@@ -343,10 +347,10 @@ const useStores = defineStore("useStores", {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.GetInfo()
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
|
|
|
}
|
|
|
}
|