12345678910111213141516171819202122232425262728293031323334353637 |
- import { doLogin, checkNeedLogin, getUserInfo } from './login'
- export function handleAppLaunch(options) {
-
- if (options && options.query && options.query.invite_code) {
-
- wx.setStorageSync('invite_code', options.query.invite_code)
- }
-
- initUserInfo()
- }
- async function initUserInfo() {
- try {
-
- if (checkNeedLogin()) {
- await doLogin()
- } else {
-
- const bindStatus = wx.getStorageSync('bindStatus')
- if (bindStatus === 1) {
- await getUserInfo()
- }
- }
- } catch (error) {
- console.error('初始化用户信息失败:', error)
- }
- }
|