Commit 9f1a5668 authored by youjie's avatar youjie

优化token 过期

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