From b83ba3cc4687f21d744e9866e10e30e91229e8a4 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Thu, 28 Jan 2021 16:23:30 +0800
Subject: [PATCH] gx

---
 hive-app/pages/login/index.vue |  121 ++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 19 deletions(-)

diff --git a/hive-app/pages/login/index.vue b/hive-app/pages/login/index.vue
index 5fd2660..ee882ce 100644
--- a/hive-app/pages/login/index.vue
+++ b/hive-app/pages/login/index.vue
@@ -1,10 +1,37 @@
 <template>
 	<!-- 登录 -->
 	<view>
+		<!-- #ifndef H5 -->
+		<view class="status_bar"></view>
+		<!-- #endif -->
+		<view class="login-header">
+			<!-- <view class="logo-wrap"> -->
+				<image src="../../static/images/logo.png" mode="widthFix" class="logo"></image>
+			<!-- </view> -->
+			
+			<text>讯聪美业</text>
+		</view>
 		<view class="login-box">
-			<input v-model="username" placeholder="输入账号" class="login-input" maxlength="60"/>
-			<input v-model="password" placeholder="输入密码" class="login-input mt-20" maxlength="60"/>
-			<button :disabled="isDisabled" class="blue-btn mt-20" @click="login">登录</button>
+			<!-- <text class="title">登录</text> -->
+			<view class="input-group-row">
+				<input v-model="username" type="text" maxlength="60" :disabled="isDisabled"  placeholder="请输入账号" placeholder-class='placeholder'/>
+			</view>
+			<template v-if="isHidePwd">
+				<view class="input-group-row mt-10">
+					<input v-model="password" type="password" :disabled="isDisabled" maxlength="60" placeholder="请输入密码" placeholder-class="placeholder" />
+					<text @click="isHidePwd=false" class="iconfont iconyanjing font-18 gray"></text>
+				</view>
+			</template>
+			<template v-else>
+				<view class="input-group-row mt-10">
+					<input v-model="password" type="text" :disabled="isDisabled" maxlength="60" placeholder="请输入密码" placeholder-class="placeholder" />
+					<text @click="isHidePwd=true" class="iconfont iconyanjing1 gray"></text>
+				</view>
+			</template>
+			<navigator class="forget-pwd" url="./forgetPassword" hover-class="none">
+				<text>忘记密码?</text>
+			</navigator>
+			<button :disabled="isDisabled" class="blue-btn" @click="login">登录</button>
 		</view>
 	</view>
 </template>
@@ -15,10 +42,33 @@
 			return {
 				username: '',
 				password: '',
-				isDisabled: false
+				isDisabled: false,
+				isHidePwd: true
+			}
+		},
+		onLoad(options) {
+			if(!options || options.isNotLogin != 1){
+				this.isLogin();
+			}
+		},
+		onBackPress(options){
+			if (this.lastBackPressed && this.lastBackPressed + 2000 >= Date.now()) {
+				plus.runtime.quit();
+			}else{
+				this.lastBackPressed = Date.now();
+				this.Toast.info('再按一次退出应用');
+				return true;
 			}
 		},
 		methods:{
+			isLogin(){
+				let token = this.$httpUtils.getToken();
+				if(token){
+					uni.switchTab({
+						url: '../workbench/index'
+					})
+				}
+			},
 			valid(){
 				if(!this.username.trim()){
 					this.$toast.info('请输入账号');
@@ -44,7 +94,8 @@
 						    key: 'userInfo',
 						    data: JSON.stringify({
 								token: mapInfo.token,
-								roleInfo: mapInfo.user
+								roleInfo: mapInfo.user,
+								userFunction: mapInfo.userFunction
 							}),
 						    success: () => {
 						        uni.switchTab({
@@ -64,25 +115,57 @@
 </script>
 
 <style>
-	.login-box{
-		padding: 30px;
-		box-sizing: border-box;
-		width: 100%;
-		position: absolute;
-		bottom: 40px;
+	.status_bar{
+		background: #518EFF;
 	}
-	.login-input{
-		border: 1px solid #ABB1CC;
-		border-radius: 20px;
+	.login-header{
+		background: #518EFF;
+		padding: 60px 0 110px;
+		border-radius: 0 0 20px 20px;
 		text-align: center;
-		padding: 10px 0;
+		font-size: 20px;
+		color: #FFFFFF;
+	}
+	.logo-wrap{
+		display: block;
+		width: 72px;
+		height: 72px;
+		background: #FFFFFF;
+		border-radius: 8px;
+		margin: 0 auto 10px;
+	}
+	.logo{
+		width: 92px;
+		display: block;
+		margin: 0 auto 10px;
+		/* height: 72px; */
+	}
+	.login-box{
+		margin: -50px 10px 0;
+		padding: 30px 20px;
+		background: #FFFFFF;
+		border: 1px solid #EDEAF4;
+		border-radius: 4px;
+		box-shadow:0 6px 6px rgba(237,234,244,0.5);
+	}
+	.login-box .title{
+		display: block;
+		font-size: 20px;
+		font-weight: bold;
+		color: #518EFF;
+		text-align: center;
+	}
+	.input-group-row input{
+		text-align: left;
+	}
+	.forget-pwd{
+		text-align: right;
+		margin-top: 5px;
 		font-size: 14px;
+		color: #518EFF;
 	}
 	.blue-btn{
-		background: #2483ff;
-		border-radius: 20px;
-		color: #FFFFFF;
-		font-size: 16px;
+		margin-top: 30px;
 	}
 	uni-button[disabled]:not([type]), uni-button[disabled][type=default]{
 		color: #FFFFFF;

--
Gitblit v1.9.1