Browse Source

先获取语言包再登录

xiaohaizhao 4 months ago
parent
commit
3d1148ef61
1 changed files with 25 additions and 22 deletions
  1. 25 22
      pages/login/selectSite.js

+ 25 - 22
pages/login/selectSite.js

@@ -9,31 +9,34 @@ Page({
             if (key.length > 30 && key.includes("_")) {
                 let value = key.split("_")
                 wx.setNavigationBarTitle({
-                    title: getApp().globalData.Language.getMapText('加载中...'),
+                    title: 'loading...',
                 })
                 _Http.appName = value[1];
-                _Http.base({
-                    "id": 2024092514364201,
-                    accesstoken: value[0]
-                }).then(res => {
-                    console.log('通过token获取登录数据', res);
-                    if (res.code != 1) {
-                        wx.showToast({
-                            title: res.msg,
-                            icon: "none",
-                            mask: true
-                        })
-                        setTimeout(() => {
-                            wx.redirectTo({
-                                url: '/pages/login/phone',
+                const languages = value[2] ? value[2].toUpperCase() : 'ZH';
+                getApp().globalData.Language.getLanguages(languages).then(s => {
+                    _Http.base({
+                        "id": 2024092514364201,
+                        accesstoken: value[0]
+                    }).then(res => {
+                        console.log('通过token获取登录数据', res);
+                        if (res.code != 1) {
+                            wx.showToast({
+                                title: res.msg,
+                                icon: "none",
+                                mask: true
                             })
-                        }, 500);
-                        return
-                    }
-                    wx.setStorageSync('userMsg', res.data);
-                    wx.setStorageSync('account_list', [res.data])
-                    wx.setStorageSync('userrole', res.data.usertype == 1 ? '业务员' : '经销商');
-                    require('./modules/login').init();
+                            setTimeout(() => {
+                                wx.redirectTo({
+                                    url: '/pages/login/phone',
+                                })
+                            }, 500);
+                            return
+                        }
+                        wx.setStorageSync('userMsg', res.data);
+                        wx.setStorageSync('account_list', [res.data])
+                        wx.setStorageSync('userrole', res.data.usertype == 1 ? '业务员' : '经销商');
+                        require('./modules/login').init();
+                    })
                 })
             }
         }