浏览代码

tabbar国际化

xiaohaizhao 1 年之前
父节点
当前提交
94d0606569
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. 2 1
      custom-tab-bar/index.js
  2. 1 1
      custom-tab-bar/index.wxml
  3. 4 1
      pages/tabbar/mine/index.js

+ 2 - 1
custom-tab-bar/index.js

@@ -54,10 +54,11 @@ Component({
       if (!getApp().globalData.socketEstablish) getApp().initSocket();
       if (!getApp().globalData.socketCallback) getApp().globalData.socketCallback = this.unReadMessageCount.bind(this);
       this.setUnReadMessageCount(getApp().globalData.fcount);
+      getApp().globalData.Language.getLanguagePackage(this, obj.text);
     },
     /* 设置未读数量 */
     setUnReadMessageCount(fcount) {
-      let i = this.data.tabbarList.findIndex(v => v.text == '信息');
+      let i = this.data.tabbarList.findIndex(v => v.name == 'message');
       this.setData({
         [`tabbarList[${i}].fcount`]: fcount
       })

+ 1 - 1
custom-tab-bar/index.wxml

@@ -2,7 +2,7 @@
     <van-tabbar-item wx:if="{{per.query(Permission,item.text)}}" info="{{item.fcount}}" name="{{item.name}}" wx:for="{{tabbarList}}" wx:key="index">
         <text slot='icon' class="{{'iconfont '+item.icon}}" style="font-size: 44rpx; color: #999999;" />
         <text slot='icon-active' class="{{'iconfont '+item.acicon}}" style="font-size: 44rpx; color: #3874F6;" />
-        {{item.text}}
+        {{language[item.text]||item.text}}
     </van-tabbar-item>
 </van-tabbar>
 <wxs src='../utils/wxmlQueryPer.wxs' module="per" />

+ 4 - 1
pages/tabbar/mine/index.js

@@ -73,10 +73,13 @@ Page({
                 wx.showToast({
                     title: '退出成功'
                 });
-                let loginMsg = wx.getStorageSync("loginMsg");
+                let loginMsg = wx.getStorageSync("loginMsg"),
+                languagecode = wx.getStorageSync("languagecode");
+
                 wx.clearStorageSync();
                 wx.setStorageSync('loginMsg', loginMsg)
                 wx.setStorageSync('isAgree', true)
+                wx.setStorageSync('languagecode', languagecode)
                 setTimeout(() => {
                     wx.reLaunch({
                         url: '/pages/login/phone',