This commit is contained in:
王鹏
2025-08-14 14:52:01 +08:00
commit 0c2edb6036
1551 changed files with 41152 additions and 0 deletions

81
app.js Normal file
View File

@@ -0,0 +1,81 @@
import authApi from "./api/authApi"
import devApi from "./api/configApi"
import memberApi from "./api/memberApi"
import clientConfig from "./config/index"
import tool from "./utils/tool"
import CustomHook from 'spa-custom-hooks';
let globalData = {
token: '',
userInfo: null,
userMemberInfo: null,
clientConfig: null
}
CustomHook.install({
'Login':{
name:'Login',
watchKey: 'token',
onUpdate(val){
return !!val;
}
},
'User':{
name:'User',
watchKey: 'userInfo',
onUpdate(val){
return !!val;
}
},
'UserMember':{
name:'UserMember',
watchKey: 'userMemberInfo',
onUpdate(val){
return !!val;
}
},
'Config':{
name:'Config',
watchKey: 'clientConfig',
onUpdate(val){
return !!val;
}
}
}, globalData || 'globalData')
App({
onLaunch() {
// wx.login({
// success: (res) => {
// const code = res.code
// authApi.login({code}).then(res=>{
// this.globalData.token = res.data
// tool.data.set("TOKEN",res.data)
// authApi.getLoginUser().then(res => {
// this.globalData.userInfo = res.data
// tool.data.set("USER_INFO",res.data)
// memberApi.getUserMemberInfo().then(res=>{
// this.globalData.userMemberInfo = res.data
// tool.data.set('USER_MEMBER_INFO', res.data)
// devApi.clientBaseList().then(res => {
// res.data.forEach(item => {
// clientConfig[item.configKey] = item.configValue
// });
// tool.data.set('CLIENT_CONFIG',clientConfig)
// this.globalData.clientConfig = clientConfig
// })
// })
// })
// })
// },
// })
},
globalData
})