xiaohaizhao 1 год назад
Родитель
Сommit
6089460996

+ 6 - 1
pages/login/modules/account.js

@@ -3,7 +3,12 @@ const loginMsg = require("./login"),
     _Http = getApp().globalData.http;
 
 Component({
-    properties: {},
+    properties: {
+        language: {
+            type: Object,
+            value: {}
+        }
+    },
     options: {
         addGlobalClass: true
     },

+ 6 - 6
pages/login/modules/account.wxml

@@ -1,18 +1,18 @@
 <van-cell>
     <text slot='icon' class="iconfont icon-a-biaoqianlanwodexuanzhong" />
-    <input class="input" type="text" value='{{accountno}}' bindinput="inputChange" data-name="accountno" placeholder="请输入账户名" />
+    <input class="input" type="text" value='{{accountno}}' bindinput="inputChange" data-name="accountno" placeholder="{{(language['请输入']||'请输入') + (language['账户']?(' '+language['账户']):'账户名')}}" />
 </van-cell>
 <van-cell>
     <text slot='icon' class="iconfont icon-a-wodemima" />
-    <input class="input" wx:if="{{inputType=='text'}}" focus='{{focus}}' bindinput="inputChange" data-name="password" value="{{password}}" placeholder="请输入密码" />
-    <input class="input" wx:else type="password" focus='{{focus}}' bindinput="inputChange" data-name="password" value="{{password}}" placeholder="请输入密码" />
-    <view slot='right-icon' style="width: 90rpx;height: 22.4px; display: flex; justify-content: flex-end;" catchtap="changePasswordType">
+    <input class="input" wx:if="{{inputType=='text'}}" focus='{{focus}}' bindinput="inputChange" data-name="password" value="{{password}}" placeholder="{{(language['请输入']||'请输入') + (language['密码']?(' '+language['密码']):'密码')}}" />
+    <input class="input" wx:else type="password" focus='{{focus}}' bindinput="inputChange" data-name="password" value="{{password}}" placeholder="{{(language['请输入']||'请输入') + (language['密码']?(' '+language['密码']):'密码')}}" />
+    <view slot='right-icon' style=" width: 90rpx;height: 22.4px; display: flex; justify-content: flex-end;" catchtap="changePasswordType">
         <image class="image" src="{{inputType=='password'?'/static/image/dp-none.svg':'/static/image/dp-show.svg'}}" />
     </view>
 </van-cell>
 <view class="box">
     <van-checkbox custom-class='checkbox' label-class='label' icon-size="28rpx" value="{{ memory }}" shape="square" bind:change="isMemory">
-        记住密码
+        {{language['记住密码']||'记住密码'}}
     </van-checkbox>
-    <navigator url="./retrievePassword" class="view">忘记密码?</navigator>
+    <navigator url="./retrievePassword" class="view">{{language['忘记密码']||'忘记密码'}}?</navigator>
 </view>

+ 4 - 8
pages/login/modules/agreement.js

@@ -1,20 +1,16 @@
-// pages/login/modules/agreement.js
 Component({
-    /**
-     * 组件的属性列表
-     */
     properties: {
         isAgree: {
             type: Boolean
         },
         callBack: {
             type: Function
+        },
+        language: {
+            type: Object,
+            value: {}
         }
     },
-
-    /**
-     * 组件的方法列表
-     */
     methods: {
         /* 修改授权 */
         isAgreeChange() {

+ 1 - 1
pages/login/modules/agreement.wxml

@@ -1,3 +1,3 @@
 <view class="agreement">
-    <van-checkbox icon-size="28rpx" label-class='con' value="{{ isAgree }}" bind:change="isAgreeChange">已阅读并同意<text catchtap="checkTheAgreement">《隐私协议》</text></van-checkbox>
+    <van-checkbox icon-size="28rpx" label-class='con' value="{{ isAgree }}" bind:change="isAgreeChange">{{language['已阅读并且同意']||'已阅读并同意'}}<text catchtap="checkTheAgreement">《{{language['隐私协议']||'隐私协议'}}》</text></van-checkbox>
 </view>

+ 38 - 7
pages/login/phone.js

@@ -1,20 +1,52 @@
 import Toast from '@vant/weapp/toast/toast';
-Page({
 
-    /**
-     * 页面的初始数据
-     */
+Page({
     data: {
         isAgree: false,
         disabled: true, //是否禁用
         loading: false, //登陆中
+        languages: [],
+
     },
-    onLoad(options) {
+    async onLoad(options) {
         if (wx.getStorageSync('isAgree')) this.setData({
             isAgree: wx.getStorageSync('isAgree')
         })
         this.setData({
-            devCount: 0
+            devCount: 0,
+        })
+        getApp().globalData.http.base({
+            id: "10026401",
+            content: {}
+        }).then(res => {
+            console.log("支持的语言", res)
+            if (res.msg == '成功') {
+                let item = res.data.find(v => v.languagecode == (wx.getStorageSync('languagecode') || 'ZH'))
+                this.setData({
+                    languages: res.data,
+                    languagename: item.languagename || '简体中文',
+                    rowIndex: item.rowindex - 1
+                })
+                this.changeTitle();
+            }
+        })
+        getApp().globalData.Language.getLanguagePackage(this);
+
+    },
+    changeLanguages(e) {
+        let item = this.data.languages[e.detail.value];
+        getApp().globalData.Language.getLanguages(item.languagecode).then(res => {
+            this.setData({
+                language: res,
+                languagename: item.languagename || '简体中文',
+                rowIndex: item.rowindex - 1
+            })
+            this.changeTitle();
+        })
+    },
+    changeTitle() {
+        wx.setNavigationBarTitle({
+            title: getApp().globalData.Language.getMapText('账户登录')
         })
     },
     /* 微信登录 */
@@ -65,7 +97,6 @@ Page({
             isAgree: detail
         })
     },
-    /*  */
     todev() {
         if (this.data.devCount == 5) {
             wx.navigateTo({

+ 9 - 5
pages/login/phone.wxml

@@ -5,21 +5,25 @@
 <!-- 手机号登录  -->
 <!-- <phone id='login' /> -->
 <!-- 账号登录 -->
-<account id='login' />
+<account id='login' language='{{language}}' />
 <view style="width: 100vw; text-align: center;margin-top: 60rpx;margin-bottom: 40rpx;">
-	<van-button disabled='{{disabled}}' custom-class='login' bindtap="userLogin" loading='{{loading}}' loading-text="登陆中..." color='linear-gradient(90deg, #3874F6 0%, #095DE0 100%);'>登录</van-button>
+	<van-button disabled='{{disabled}}' custom-class='login' bindtap="userLogin" loading='{{loading}}' loading-text="{{language['登录中']||'登录中'}}..." color='linear-gradient(90deg, #3874F6 0%, #095DE0 100%);'>{{language['登录']||'登录'}}</van-button>
 </view>
 
 <!-- 隐私协议 -->
-<Agreement isAgree='{{isAgree}}' bindcallBack='agreementChange' />
+<Agreement isAgree='{{isAgree}}' language='{{language}}' bindcallBack='agreementChange' />
 
 <!-- 快捷登录 -->
 <block>
 	<view style="height: 100rpx;" />
-	<van-divider contentPosition="center">其他登录方式</van-divider>
+	<van-divider contentPosition="center">{{language['其他登录方式']||'其他登录方式'}}</van-divider>
 	<view style="width: 100%; text-align: center;">
 		<text class="iconfont icon-a-wodebangdingweixin" style="font-size: 100rpx; color:#07C160;" bindtap="wechatLogin" />
 	</view>
 </block>
 
-<van-toast id="van-toast" />
+<van-toast id="van-toast" />
+
+<picker mode="selector" range="{{languages}}" range-key='languagename' value="{{rowIndex}}" bindchange='changeLanguages'>
+	{{languagename}}
+</picker>