From a9f73bdaecae75f8058c7d8a05c40cbf590c6465 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 26 二月 2026 17:48:18 +0800
Subject: [PATCH] 经销商管理
---
mini-program/pages/login/login.vue | 66 ++++++++++++++++++++++-----------
1 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/mini-program/pages/login/login.vue b/mini-program/pages/login/login.vue
index 3ca97f4..9c12544 100644
--- a/mini-program/pages/login/login.vue
+++ b/mini-program/pages/login/login.vue
@@ -48,11 +48,14 @@
radio:false
};
},
- onShow() {
+ async onLoad() {
+ },
+ async onShow() {
+ await this.$onLaunched;
this.focus=false
this.focus1=false
this.form.openid=this.openid
- this.checkShopLogin()
+ this.checkShopLogin()
},
methods:{
jumpService(flag) {
@@ -61,27 +64,46 @@
})
},
async checkShopLogin(){
+ uni.showLoading( )
var that =this
- console.log("shopInfo",this.shopInfo)
- console.log("shopToken",this.shopToken)
-
- console.log("openid",this.openid)
- if( this.shopInfo !=null && this.shopInfo.id!=null && (this.shopToken!=null &&this.shopToken!='')){
- //楠岃瘉token鏄惁鏈夋晥
- let res = await that.$u.api.getShopInfo({tokenType:1 })
- if (res.code === 200) {
- await that.$store.commit('setShopInfo', res.data)
- that.jumpShopIndex()
- }
- }else if( this.openid !=null && this.openid !=''){
- //浼樺厛闈欓粯鐧婚檰
- let res = await that.$u.api.shopOpenidLogin(this.form)
- if (res.code === 200 && res.shop!=null && res.token!=null) {
- await that.$store.commit('setShopInfo', res.data.shop)
- await that.$store.commit('setShopToken', res.data.token)
- that.jumpShopIndex()
- }
+ try{
+ if( this.shopInfo !=null && this.shopInfo.id!=null && (this.shopToken!=null &&this.shopToken!='')){
+ //楠岃瘉token鏄惁鏈夋晥
+ try{
+ let res = await that.$u.api.getShopInfo({tokenType:1 })
+ if (res.code === 200) {
+ await that.$store.commit('setShopInfo', res.data)
+ that.jumpShopIndex()
+ return
+ }
+ }catch(e){
+ if( this.openid !=null && this.openid !=''){
+ let res = await that.$u.api.shopOpenidLogin(this.form)
+ if (res.code === 200 && res.data.shop!=null && res.data.token!=null) {
+ await that.$store.commit('setShopInfo', res.data.shop)
+ await that.$store.commit('setShopToken', res.data.token)
+ that.jumpShopIndex()
+ }
+ }
+ }
+
+ }else if( this.openid !=null && this.openid !=''){
+ let res = await that.$u.api.shopOpenidLogin(this.form)
+ if (res.code === 200 && res.data.shop!=null && res.data.token!=null) {
+ await that.$store.commit('setShopInfo', res.data.shop)
+ await that.$store.commit('setShopToken', res.data.token)
+ that.jumpShopIndex()
+ }
+ }
+ setTimeout(function () {
+ uni.hideLoading();
+ }, 1000);
+ }catch(e){
+ setTimeout(function () {
+ uni.hideLoading();
+ }, 1000);
}
+
},
changeRadio(){
this.radio = !this.radio
@@ -121,7 +143,7 @@
})
},
jumpShopIndex() {
- uni.navigateTo({
+ uni.redirectTo({
url: '/pages/distributor/distributor'
})
}
--
Gitblit v1.9.3