Commit 9f1a5668 authored by youjie's avatar youjie

优化token 过期

parent 9b9ecde8
......@@ -278,10 +278,12 @@
>
<CheckDate :msg="searchObj" @chosenDateResult="chosenDateResult"></CheckDate>
</u-popup>
<auth v-if="showAuth&&is_show_auth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view>
</template>
<script>
import auth from "@/components/auth/index.vue";
import roomGood from "./components/room-good.vue";
import nearGood from "./components/near-good.vue";
import recommedHotel from "./components/recommed-hotel.vue";
......@@ -293,6 +295,7 @@ import hotelFacilities from "./components/hotelFacilities.vue";
import CheckDate from "./components/time/date.vue";
export default {
components: {
auth,
roomGood,
nearGood,
recommedHotel,
......@@ -305,6 +308,7 @@ export default {
},
data() {
return {
showAuth:false,
imgsList: [],
id: 0,
typeList: [
......@@ -405,7 +409,10 @@ export default {
qMsg: {
RoomTypeName: "", //房型筛选
MTypeName: "", //早餐筛选
}
},
U:{},
b2bUser:{},
is_show_auth: 0,
};
},
computed: {
......@@ -465,6 +472,8 @@ export default {
: 0;
},
onLoad(options) {
this.U = uni.getStorageSync("mall_UserInfo");
this.b2bUser = uni.getStorageSync("b2b_user");
this.id = options.id;
this.roomMsg.hotelid = options.id;
let that = this;
......@@ -527,7 +536,39 @@ export default {
this.getHotelPrices()
this.getdidaMealType()
},
onShow(){
let basedata = uni.getStorageSync("basedata");
//判断后台是否开启自动授权
if (basedata && basedata.mall && basedata.mall.setting && basedata.mall.setting && basedata.mall.setting.is_show_auth ==
1) {
this.is_show_auth = 1;
}
if (!this.U) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
} else if (!this.b2bUser && this.is_show_auth == 1) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
}
},
methods: {
reloadUserinfo() {
const pages = getCurrentPages()
const curPage = pages[pages.length-1]
curPage.onLoad(curPage.options)
curPage.onShow()
curPage.onReady()
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
},
open(index) {
this.$refs.uDropdown.highlight();
},
......
......@@ -356,7 +356,9 @@
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
this.init();
setTimeout(() => {
uni.removeStorageSync("LoginState")
}, 10000);
},
gbAuth() {
this.showAuth = false;
......
......@@ -704,6 +704,9 @@
if(option && option.pName){
this.msg.pName = option.pName
}
this.getLineQuery();
},
onShow() {
let basedata = uni.getStorageSync("basedata");
//判断后台是否开启自动授权
if (basedata && basedata.mall && basedata.mall.setting && basedata.mall.setting.is_show_auth ==
......@@ -725,7 +728,7 @@
};
this.showAuth = true;
}
this.getLineQuery();
},
methods: {
reloadUserinfo() {
......
......@@ -1368,19 +1368,7 @@
this.is_show_auth = 1;
}
if (!this.U) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
} else if (!this.b2bUser && this.is_show_auth == 1) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
}
let that = this;
uni.getSystemInfo({
success(res) {
......@@ -1395,6 +1383,21 @@
this.mainColor = this.$uiConfig.mainColor;
this.getSale()
},
onShow(){
if (!this.U) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
} else if (!this.b2bUser && this.is_show_auth == 1) {
this.U = {
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
}
},
methods: {
calcPzCouponHandler(){
this.couponList.forEach((x)=>{
......
......@@ -427,6 +427,21 @@
}
this.getSale()
this.getDetails();
let that = this;
uni.getSystemInfo({
success(res) {
that.titleStyle = {
height: "45px",
paddingTop: `${res.statusBarHeight}px`,
opacity: 0,
};
that.topheight = 55 + res.statusBarHeight
},
});
this.mainColor = this.$uiConfig.mainColor;
},
onShow(){
this.U = uni.getStorageSync("mall_UserInfo");
this.b2bUser = uni.getStorageSync("b2b_user");
let basedata = uni.getStorageSync("basedata");
......@@ -449,18 +464,6 @@
};
this.showAuth = true;
}
let that = this;
uni.getSystemInfo({
success(res) {
that.titleStyle = {
height: "45px",
paddingTop: `${res.statusBarHeight}px`,
opacity: 0,
};
that.topheight = 55 + res.statusBarHeight
},
});
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
downloadTripPlanHandler(item) {
......
......@@ -163,6 +163,9 @@ export default {
}
},
onLoad(option) {
},
onShow() {
let basedata = uni.getStorageSync("basedata");
//判断后台是否开启自动授权
if (basedata && basedata.mall && basedata.mall.setting && basedata.mall.setting && basedata.mall.setting.is_show_auth ==
......@@ -186,7 +189,7 @@ export default {
}
},
created() {
this.b2bUser = uni.getStorageSync("b2b_user");
},
mounted() {
this.getEnumeration()
......
......@@ -121,12 +121,19 @@ export default {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
uni.removeStorageSync('b2b_user')
uni.removeStorageSync('mall_UserInfo')
const pages = getCurrentPages()
const curPage = pages[pages.length-1]
if(cmd=='b2b_post_CheckMiniAppToken'){
// curPage.onLoad(curPage.options)
curPage.onShow()
// curPage.onReady()
}else{
if(uni.getStorageSync("LoginState")) return
uni.setStorageSync("LoginState",true)
uni.redirectTo({
url: '/pages/index/index'
})
// uni.redirectTo({
// url: '/pages/index/index'
// })
}
} else if (res.data.resultCode != 1) {
if (!failed) {
if (res.data.message != '') {
......
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