Browse Source

Merge branch 'test' of git.echepei.com:sailun/sailun-tbr-web into test

caojunjie 4 years ago
parent
commit
c5dc70d6d2
4 changed files with 68 additions and 75 deletions
  1. 8 18
      common/locales/en.js
  2. 8 18
      common/locales/zh.js
  3. 1 1
      manifest.json
  4. 51 38
      pages/login/index.vue

+ 8 - 18
common/locales/en.js

@@ -1,21 +1,11 @@
 export default {
-	// 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分
-	components: {
-		desc: 'Numerous components cover the various requirements of the development process, and the components are rich in functions and compatible with multiple terminals. Let you integrate quickly, out of the box'
-	},
-	js: {
-		desc: 'Numerous intimate gadgets are a weapon that you can call upon during the development process, allowing you to dart in your hand and pierce the Yang with a hundred steps'
-	},
-	template: {
-		desc: 'Collection of many commonly used pages and layouts, reducing the repetitive work of developers, allowing you to focus on logic and get twice the result with half the effort'
-	},
-	nav: {
-		components: 'Components',
-		js: 'JS',
-		template: 'Template'
-	},
-	common: {
-		intro: 'UI framework for rapid development of multiple platforms',
-		title: 'uView UI',
+	login:{
+		code:"Click for authentication code",
+		login:"Login",
+		sign:"Sign up now",
+		no:"No account?",
+		Lan:"Switch language—English",
+		mobile:"Enter mobile number",
+		code:"Enter verification code",
 	},
 }

+ 8 - 18
common/locales/zh.js

@@ -1,22 +1,12 @@
 export default {
-	// 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分
-	components: {
-		desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用'
-	},
-	js: {
-		desc: '众多的贴心小工具,是你开发过程中召之即来的利器,让你飞镖在手,百步穿杨'
-	},
-	template: {
-		desc: '收集众多的常用页面和布局,减少开发者的重复工作,让你专注逻辑,事半功倍'
-	},
-	nav: {
-		components: '组件',
-		js: '工具',
-		template: '模板'
-	},
-	common: {
-		intro: '多平台快速开发的UI框架',
-		title: 'uView UI',
+	login:{
+		code:"获取验证码",
+		login:"登录",
+		sign:"立即注册",
+		no:"还没有账号?",
+		Lan:"切换语言—中文",
+		mobile:"请输入手机号",
+		code:"请输入验证码"
 	},
 	//扫码页面
 	scanenter:{

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "耀灵全钢店管家",
     "appid" : "__UNI__0C3473D",
     "description" : "测试",
-    "versionName" : "0.0.2",
+    "versionName" : "0.0.1",
     "versionCode" : "100",
     "transformPx" : false,
     "app-plus" : {

+ 51 - 38
pages/login/index.vue

@@ -9,28 +9,32 @@
 			 border-radius="20" margin="50rpx">
 				<view slot="body">
 					<view style="margin-top: 20rpx;">
-						<u-field v-model="tel" placeholder="请填写手机号" label-width="50">
+						<u-field v-model="tel" :placeholder="$t('login.mobile')" label-width="50">
 							<u-icon slot="icon" name="account" size="36" color="#666666"></u-icon>
 						</u-field>
 					</view>
 					<view style="margin-top: 30rpx;">
-						<u-field v-model="code" placeholder="请填写验证码" label-width="50">
+						<u-field v-model="code" :placeholder="$t('login.code')" label-width="50">
 							<u-icon slot="icon" name="lock" size="36" color="#666666"></u-icon>
-							<u-button size="mini" slot="right" type="primary" @click="getCode" shape="circle" :loading="codeLoading">{{codeText}}</u-button>
+							<u-button v-if="send!='zh'" size="mini" slot="right" type="primary" @click="getCode" shape="circle" :loading="codeLoading">{{codeText}}</u-button>
+							<u-button v-else size="mini" slot="right" type="primary" @click="getCode" shape="circle" :loading="codeLoading">{{codeText}}</u-button>
 						</u-field>
 					</view>
-					<u-verification-code ref="uCode" @change="codeChange"></u-verification-code>
+					<view class="" v-if="send!='zh'">
+						<u-verification-code  ref="uCode" @change="codeChange"></u-verification-code>
+					</view>
+					<u-verification-code v-else ref="uCode" @change="codeChange" start-text="Send" change-text="Reacquire in X S" end-text="Reacquire"></u-verification-code>
 					<view style="margin-top: 80rpx;">
 						<u-button type="primary" :ripple="true" ripple-bg-color="#99d4ff" shape="circle" @tap="$u.debounce(submit, 2000,immediate = true)"
-						 :loading="loading">登录</u-button>
+						 :loading="loading">{{$t("login.login")}}</u-button>
 					</view>
 					<view style="margin-top: 80rpx;display: flex;justify-content: center;">
 						<view class="u-flex" @click="inregister">
 							<view style="color: rgba(0,160,234,0.5)">
-								还没有账号?
+								{{$t("login.no")}}
 							</view>
 							<view style="color: #00A0EA">
-								立即注册
+								{{$t("login.sign")}}
 							</view>
 						</view>
 					</view>
@@ -39,7 +43,7 @@
 		</view>
 		<view class="foot">
 			<view class="u-flex u-row-center u-col-center">
-				<u-divider color="#0095FF" border-color="#0095FF" bg-color="#F4F4F4" fontSize="30">赛轮店管家</u-divider>
+				<u-divider color="#0095FF" border-color="#0095FF" bg-color="#F4F4F4" fontSize="30" @click="switchLang">{{$t("login.Lan")}}</u-divider>
 			</view>
 		</view>
 	</view>
@@ -60,13 +64,14 @@
 			return {
 				tel: '',
 				code: '',
-				codeText: '',
+				codeText:"",
 				pact: false,
 				loading: false,
 				codeLoading: false,
 				SystemInfo: '',
 				networkType: '',
-				version:''
+				version: '',
+				send:'',
 			}
 		},
 		computed: {
@@ -85,27 +90,31 @@
 			});
 			// #ifdef APP-PLUS
 			uni.getLocation({
-			    success:res=>{
-			    },
-				fail:err=>{
-					if(this.SystemInfo.platform=="ios"){
+				success: res => {},
+				fail: err => {
+					if (this.SystemInfo.platform == "ios") {
 						this.judgeIosPermission()
-					}else{
+					} else {
 						this.requestAndroidPermission()
-					}	
+					}
 				}
 			});
 			// #endif
 			// #ifdef APP-PLUS
 			plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
-				this.version=wgtinfo.version
+				this.version = wgtinfo.version
 			})
 			// #endif
-			uni.$on('loginphone',data=>{
-				this.tel=data
+			uni.$on('loginphone', data => {
+				this.tel = data
 			})
 		},
 		methods: {
+			switchLang() {
+				this.$i18n.locale = this.$i18n.locale == 'en' ? 'zh' : 'en';
+				this.send= this.$i18n.locale == 'en' ? 'zh' : 'en';
+				console.log(this.send)
+			},
 			...mapMutations(['login']),
 			judgeIosPermission() {
 				let result = permision.judgeIosPermission('location')
@@ -158,6 +167,7 @@
 						}
 					}).then(res => {
 						if (res.data.code == 0) {
+							console.log(res.data.data)
 							this.toUser(res.data.data)
 							uni.$emit('login', {
 								msg: '登录成功'
@@ -187,24 +197,24 @@
 					if (this.$refs.uCode.canGetCode) {
 						this.codeLoading = true
 						request({
-								url: '/sailun/appStoreBasicInfo/sendCode',
-								method: 'post',
-								data: {
-									"phoneNumber": this.tel,
-									"opreaType": "1"
-								},
-							}).then(res => {
-								if (res.data.code == 0) {
-									this.$refs.uCode.start();
-								}
-								if (res.data.code == 500) {
-									this.$u.toast(res.data.msg);
-								}
-							}).catch(err => {
-								console.log(err)
-							}).finally(() => {
-								this.codeLoading = false
-							})
+							url: '/sailun/appStoreBasicInfo/sendCode',
+							method: 'post',
+							data: {
+								"phoneNumber": this.tel,
+								"opreaType": "1"
+							},
+						}).then(res => {
+							if (res.data.code == 0) {
+								this.$refs.uCode.start();
+							}
+							if (res.data.code == 500) {
+								this.$u.toast(res.data.msg);
+							}
+						}).catch(err => {
+							console.log(err)
+						}).finally(() => {
+							this.codeLoading = false
+						})
 					} else {
 						this.$u.toast('倒计时结束后再发送');
 					}
@@ -226,12 +236,15 @@
 
 	.content {
 		position: relative;
-		top: -350rpx;
+		top: -400rpx;
 	}
 
 	.foot {
 		position: fixed;
 		bottom: 10rpx;
 		width: 100%;
+		padding-bottom: 0;  
+		padding-bottom: constant(safe-area-inset-bottom);
+		padding-bottom: env(safe-area-inset-bottom);
 	}
 </style>