Ver código fonte

代码优化

xiaohaizhao 1 ano atrás
pai
commit
1d3799329f
2 arquivos alterados com 9 adições e 10 exclusões
  1. 1 1
      pages/login/selectSite.js
  2. 8 9
      pages/tabbar/mine/index.js

+ 1 - 1
pages/login/selectSite.js

@@ -8,9 +8,9 @@ Page({
         require('./modules/login').init();
     },
     onShow() {
+        if (wx.getStorageSync('languagecode') != 'ZH') getApp().globalData.Language.setNavBarTitle('选择站点')
         this.setData({
             account_list: wx.getStorageSync('account_list')
         })
-        if (wx.getStorageSync('languagecode') != 'ZH') getApp().globalData.Language.setNavBarTitle('选择站点')
     }
 })

+ 8 - 9
pages/tabbar/mine/index.js

@@ -1,5 +1,4 @@
-const _Http = getApp().globalData.http,
-    getMapText = getApp().globalData.Language.getMapText;
+const _Http = getApp().globalData.http;
 let downCount = null;
 Page({
 
@@ -68,12 +67,12 @@ Page({
     outLogin() {
         clearTimeout(downCount);
         wx.showLoading({
-            title: (getMapText('加载中') || '正在退出') + '...',
+            title: getApp().globalData.Language.getMapText('加载中') + '...',
         })
         downCount = setTimeout(() => {
             _Http.logout().then(res => {
                 wx.showToast({
-                    title: getMapText('退出成功') || '退出成功'
+                    title: getApp().globalData.Language.getMapText('退出成功')
                 });
                 let loginMsg = wx.getStorageSync("loginMsg"),
                     languagecode = wx.getStorageSync("languagecode");
@@ -108,8 +107,8 @@ Page({
         if (this.data.userMsg.iswechatbinding) {
             let that = this;
             wx.showModal({
-                title: getMapText('提示') || "提示",
-                content: getMapText('是否解除绑定') || "是否解除绑定",
+                title: getApp().globalData.Language.getMapText('提示'),
+                content: getApp().globalData.Language.getMapText('是否解除绑定'),
                 success: (res) => {
                     if (res.confirm) that.handleBDWechat(0);
                 }
@@ -121,7 +120,7 @@ Page({
     handleBDWechat(isbinging) {
         let that = this;
         wx.getUserProfile({
-            desc: getMapText('用于完善用户资料') || '用于完善用户资料',
+            desc: getApp().globalData.Language.getMapText('用于完善用户资料'),
             success: ({
                 userInfo
             }) => {
@@ -144,7 +143,7 @@ Page({
                             });
                             setTimeout(() => {
                                 wx.showToast({
-                                    title: isbinging == 0 ? (getMapText('解绑成功') || '解除成功') : (getMapText('绑定成功') || '绑定成功'),
+                                    title: isbinging == 0 ? getApp().globalData.Language.getMapText('解绑成功') : getApp().globalData.Language.getMapText('绑定成功'),
                                     icon: "none"
                                 })
                             }, 100);
@@ -155,7 +154,7 @@ Page({
             },
             fail: () => {
                 wx.showToast({
-                    title: getMapText('未获取授权') || '操作失败,未获得授权',
+                    title: getApp().globalData.Language.getMapText('未获取授权'),
                     icon: "none"
                 })
             }