feat(app): 添加公众号 AppId配置并优化登录逻辑
- 在 appConfig 中添加 appIdPublic 字段用于存储公众号 AppId - 修改 codeLogin 和 passwordLogin 页面,支持获取和使用公众号 AppId - 更新 order/detail 页面,从 store 中获取公众号 AppId
This commit is contained in:
parent
6f156df9a8
commit
54740328e8
|
@ -120,7 +120,7 @@
|
||||||
tenantEnabled:true,
|
tenantEnabled:true,
|
||||||
query:{},
|
query:{},
|
||||||
isTenant: true,
|
isTenant: true,
|
||||||
appid:'',
|
appIdMini:'',
|
||||||
smsLoading:false,
|
smsLoading:false,
|
||||||
loading:false,
|
loading:false,
|
||||||
icpLicense:'',
|
icpLicense:'',
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
const accountInfo = uni.getAccountInfoSync();
|
const accountInfo = uni.getAccountInfoSync();
|
||||||
this.appid = accountInfo.miniProgram.appId;
|
this.appIdMini = accountInfo.miniProgram.appId;
|
||||||
// #endif
|
// #endif
|
||||||
if(e){
|
if(e){
|
||||||
this.query = e;
|
this.query = e;
|
||||||
|
@ -206,6 +206,7 @@
|
||||||
let logo = '';
|
let logo = '';
|
||||||
let title = '';
|
let title = '';
|
||||||
let icpLicense = '';
|
let icpLicense = '';
|
||||||
|
let appIdPublic = '';
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if(this.query.tenantId){
|
if(this.query.tenantId){
|
||||||
this.form.tenantId = this.query.tenantId;
|
this.form.tenantId = this.query.tenantId;
|
||||||
|
@ -214,6 +215,7 @@
|
||||||
logo = item.logo;
|
logo = item.logo;
|
||||||
title = item.companyName;
|
title = item.companyName;
|
||||||
icpLicense = item.icpLicense || '';
|
icpLicense = item.icpLicense || '';
|
||||||
|
appIdPublic = item.appIdPublic || '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.isTenant = false;
|
this.isTenant = false;
|
||||||
|
@ -222,6 +224,7 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
this.isTenant = false;
|
this.isTenant = false;
|
||||||
} else if (data.voList != null && data.voList.length !== 0) {
|
} else if (data.voList != null && data.voList.length !== 0) {
|
||||||
this.form.tenantId = data.voList[0].tenantId;
|
this.form.tenantId = data.voList[0].tenantId;
|
||||||
|
@ -229,17 +232,19 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
if(this.appid){
|
if(this.appIdMini){
|
||||||
let isAppid = true;
|
let isAppid = true;
|
||||||
data.voList.forEach((item) => {
|
data.voList.forEach((item) => {
|
||||||
if (item.appId === this.appid) {
|
if (item.appId === this.appIdMini) {
|
||||||
this.form.tenantId = item.tenantId;
|
this.form.tenantId = item.tenantId;
|
||||||
logo = item.logo;
|
logo = item.logo;
|
||||||
title = item.companyName;
|
title = item.companyName;
|
||||||
icpLicense = item.icpLicense || '';
|
icpLicense = item.icpLicense || '';
|
||||||
|
appIdPublic = item.appIdPublic || '';
|
||||||
isAppid = false;
|
isAppid = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -247,6 +252,7 @@
|
||||||
this.form.tenantId = data.voList[0].tenantId;
|
this.form.tenantId = data.voList[0].tenantId;
|
||||||
this.activeTenantObj = data.voList[0];
|
this.activeTenantObj = data.voList[0];
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
}else{
|
}else{
|
||||||
|
@ -258,14 +264,17 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
if(title){
|
if(title){
|
||||||
this.appConfig.logo = logo;
|
this.appConfig.logo = logo;
|
||||||
this.appConfig.name = title;
|
this.appConfig.name = title;
|
||||||
|
this.appConfig.appIdPublic = appIdPublic;
|
||||||
}else{
|
}else{
|
||||||
this.appConfig.logo = '';
|
this.appConfig.logo = '';
|
||||||
this.appConfig.name = this.$store.state.app.appConfig;
|
this.appConfig.name = this.$store.state.app.appConfig;
|
||||||
|
this.appConfig.appIdPublic = appIdPublic;
|
||||||
}
|
}
|
||||||
if(icpLicense){
|
if(icpLicense){
|
||||||
this.icpLicense = icpLicense;
|
this.icpLicense = icpLicense;
|
||||||
|
@ -283,6 +292,7 @@
|
||||||
this.form.tenantId = item.tenantId;
|
this.form.tenantId = item.tenantId;
|
||||||
this.appConfig.logo = item.logo;
|
this.appConfig.logo = item.logo;
|
||||||
this.appConfig.name = item.companyName;
|
this.appConfig.name = item.companyName;
|
||||||
|
this.appConfig.appIdPublic = item.appIdPublic;
|
||||||
this.icpLicense = item.icpLicense || '';
|
this.icpLicense = item.icpLicense || '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
tenantEnabled:true,
|
tenantEnabled:true,
|
||||||
query:{},
|
query:{},
|
||||||
isTenant: true,
|
isTenant: true,
|
||||||
appid:'',
|
appIdMini:'',
|
||||||
icpLicense:'',
|
icpLicense:'',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
const accountInfo = uni.getAccountInfoSync();
|
const accountInfo = uni.getAccountInfoSync();
|
||||||
this.appid = accountInfo.miniProgram.appId;
|
this.appIdMini = accountInfo.miniProgram.appId;
|
||||||
// #endif
|
// #endif
|
||||||
if(e){
|
if(e){
|
||||||
this.query = e;
|
this.query = e;
|
||||||
|
@ -217,6 +217,7 @@
|
||||||
let logo = '';
|
let logo = '';
|
||||||
let title = '';
|
let title = '';
|
||||||
let icpLicense = '';
|
let icpLicense = '';
|
||||||
|
let appIdPublic = '';
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if(this.query.tenantId){
|
if(this.query.tenantId){
|
||||||
this.form.tenantId = this.query.tenantId;
|
this.form.tenantId = this.query.tenantId;
|
||||||
|
@ -225,6 +226,7 @@
|
||||||
logo = item.logo;
|
logo = item.logo;
|
||||||
title = item.companyName;
|
title = item.companyName;
|
||||||
icpLicense = item.icpLicense || '';
|
icpLicense = item.icpLicense || '';
|
||||||
|
appIdPublic = item.appIdPublic || '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.isTenant = false;
|
this.isTenant = false;
|
||||||
|
@ -233,6 +235,7 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
this.isTenant = false;
|
this.isTenant = false;
|
||||||
} else if (data.voList != null && data.voList.length !== 0) {
|
} else if (data.voList != null && data.voList.length !== 0) {
|
||||||
this.form.tenantId = data.voList[0].tenantId;
|
this.form.tenantId = data.voList[0].tenantId;
|
||||||
|
@ -240,18 +243,20 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
if(this.appid){
|
if(this.appIdMini){
|
||||||
let isAppid = true;
|
let isAppid = true;
|
||||||
data.voList.forEach((item) => {
|
data.voList.forEach((item) => {
|
||||||
if (item.appId === this.appid) {
|
if (item.appId === this.appIdMini) {
|
||||||
console.log("appId",item)
|
console.log("appId",item)
|
||||||
this.form.tenantId = item.tenantId;
|
this.form.tenantId = item.tenantId;
|
||||||
logo = item.logo;
|
logo = item.logo;
|
||||||
title = item.companyName;
|
title = item.companyName;
|
||||||
icpLicense = item.icpLicense || '';
|
icpLicense = item.icpLicense || '';
|
||||||
|
appIdPublic = item.appIdPublic || '';
|
||||||
isAppid = false;
|
isAppid = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -261,24 +266,29 @@
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
}else{
|
}else{
|
||||||
this.isTenant = false;
|
this.isTenant = false;
|
||||||
}
|
}
|
||||||
}else if (data.voList != null && data.voList.length !== 0) {
|
}else if (data.voList != null && data.voList.length !== 0) {
|
||||||
this.form.tenantId = data.voList[0].tenantId;
|
this.form.tenantId = data.voList[0].tenantId;
|
||||||
this.activeTenantObj = data.voList[0] ;
|
this.activeTenantObj = data.voList[0] ;
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
logo = data.voList[0].logo;
|
logo = data.voList[0].logo;
|
||||||
title = data.voList[0].companyName;
|
title = data.voList[0].companyName;
|
||||||
icpLicense = data.voList[0].icpLicense || '';
|
icpLicense = data.voList[0].icpLicense || '';
|
||||||
|
appIdPublic = data.voList[0].appIdPublic || '';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
console.log("title",title,logo)
|
console.log("title",title,logo)
|
||||||
if(title){
|
if(title){
|
||||||
this.appConfig.logo = logo;
|
this.appConfig.logo = logo;
|
||||||
this.appConfig.name = title;
|
this.appConfig.name = title;
|
||||||
|
this.appConfig.appIdPublic = appIdPublic;
|
||||||
}else{
|
}else{
|
||||||
this.appConfig.logo = '';
|
this.appConfig.logo = '';
|
||||||
this.appConfig.name = this.$store.state.app.appConfig;
|
this.appConfig.name = this.$store.state.app.appConfig;
|
||||||
|
this.appConfig.appIdPublic = appIdPublic;
|
||||||
}
|
}
|
||||||
if(icpLicense){
|
if(icpLicense){
|
||||||
this.icpLicense = icpLicense;
|
this.icpLicense = icpLicense;
|
||||||
|
@ -296,6 +306,7 @@
|
||||||
this.form.tenantId = item.tenantId;
|
this.form.tenantId = item.tenantId;
|
||||||
this.appConfig.logo = item.logo;
|
this.appConfig.logo = item.logo;
|
||||||
this.appConfig.name = item.companyName;
|
this.appConfig.name = item.companyName;
|
||||||
|
this.appConfig.appIdPublic = item.appIdPublic;
|
||||||
this.icpLicense = item.icpLicense || '';
|
this.icpLicense = item.icpLicense || '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
||||||
mall_pay_type:[],
|
mall_pay_type:[],
|
||||||
buttonLoading:false,
|
buttonLoading:false,
|
||||||
officialAccount:{
|
officialAccount:{
|
||||||
appid:'wx80a304ffbfb30995',
|
appid:'',
|
||||||
appsecret:'ca307cfb6c94e8ac015e26cfd717a91c',
|
appsecret:'ca307cfb6c94e8ac015e26cfd717a91c',
|
||||||
},
|
},
|
||||||
code:'',
|
code:'',
|
||||||
|
@ -136,7 +136,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
this.officialAccount.appid = this.$store.state.app.appConfig.appIdPublic;
|
||||||
this.getDictDataList('mall_order_status');
|
this.getDictDataList('mall_order_status');
|
||||||
this.getDictDataList('mall_source_type');
|
this.getDictDataList('mall_source_type');
|
||||||
this.getDictDataList('mall_pay_type');
|
this.getDictDataList('mall_pay_type');
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
const auth = {
|
const auth = {
|
||||||
state: {
|
state: {
|
||||||
appConfig:{},
|
appConfig:{
|
||||||
|
name:'',
|
||||||
|
logo:'',
|
||||||
|
appIdPublic:'',
|
||||||
|
openId:'',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
updataConfig(state, data) {
|
updataConfig(state, data) {
|
||||||
|
|
Loading…
Reference in New Issue