Files
c/miniprogram/app.js
刘正航 b5237f9038 1
2026-04-21 22:45:19 +08:00

23 lines
571 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
App({
globalData: {
// 真机调试时请改为电脑局域网 IP例如 http://192.168.1.10:5000/api
baseURL: 'http://127.0.0.1:5000/api',
token: wx.getStorageSync('token') || '',
user: wx.getStorageSync('user') || null
},
setAuth(token, user) {
this.globalData.token = token
this.globalData.user = user
wx.setStorageSync('token', token)
wx.setStorageSync('user', user)
},
clearAuth() {
this.globalData.token = ''
this.globalData.user = null
wx.removeStorageSync('token')
wx.removeStorageSync('user')
}
})