This commit is contained in:
lik
2026-06-08 12:01:40 +08:00
parent 010cf160a0
commit 894a9881d7
51 changed files with 2667 additions and 740 deletions

20
app.js
View File

@@ -1,6 +1,7 @@
// app.js
import config from './config';
import createBus from './utils/eventBus';
const API = require('./utils/api.js');
App({
onLaunch() {
@@ -26,6 +27,25 @@ App({
this.connect();
},
onShow(options) {
wx.login({
success: (res) => {
if (res.code) {
API.user.wxSignin({ code: res.code })
.then((data) => {
if (data.code == 0) {
this.globalData.user = data.data.user
this.eventBus.emit('user-login', data.data.user)
} else {
console.log('登录失败!')
}
})
} else {
}
}
})
},
/** 全局事件总线 */
eventBus: createBus(),