feat: 任务和社区页面

This commit is contained in:
Blizzard
2026-02-06 17:27:35 +08:00
parent d42471e1d5
commit b800ea03b5
30 changed files with 1777 additions and 551 deletions
+24 -2
View File
@@ -1,7 +1,29 @@
// app.js
import request from './utils/request';
App({
onLaunch() {
console.log('App Launch');
// Login
wx.login({
success: res => {
// Send res.code to backend to swap for openId, sessionKey, unionId
if (res.code) {
request.get('/auth/miniLogin', { code: res.code }).then(data => {
// Assuming the token is in data.token or data itself
const token = data.token || data;
if (token && typeof token === 'string') {
wx.setStorageSync('token', token);
console.log('Login successful, token stored');
} else {
console.warn('Login response did not contain a valid token string', data);
}
}).catch(err => {
console.error('Login failed', err);
});
} else {
console.error('wx.login failed: ' + res.errMsg);
}
}
});
},
globalData: {
userInfo: null