From c25e12565ad5c737692f9af61ffd1f965f4491bd Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Thu, 24 Dec 2020 16:09:48 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app into master --- hive-app/pages/login/index.vue | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 104 insertions(+), 12 deletions(-) diff --git a/hive-app/pages/login/index.vue b/hive-app/pages/login/index.vue index 92cafb0..83a4788 100644 --- a/hive-app/pages/login/index.vue +++ b/hive-app/pages/login/index.vue @@ -1,32 +1,120 @@ <template> <!-- 登录 --> <view> - <view class="login-box"> - <input placeholder="输入账号" class="login-input"/> - <input placeholder="输入密码" class="login-input mt-20"/> - <button class="blue-btn mt-20">登录</button> + <!-- #ifndef H5 --> + <view class="status_bar"></view> + <!-- #endif --> + <view class="login-header flex flex-v align-center"> + <view class="login-img"></view> + <text class="font-20 white mt-10">蜂巢美业</text> + </view> + <view class="login-box center"> + <text class="font-20 blue font-bold">登录</text> + <input v-model="username" placeholder="请输入账号" placeholder-class="placeholder" class="input-group-row left mt-20" maxlength="60"/> + <view class="input-group-row"> + <input v-model="password" placeholder="请输入密码" placeholder-class="placeholder" class="input-left" maxlength="60"/> + <text class="iconfont iconyanjing font-14 gray"></text> + </view> + <view class="right mt-5"> + <text class="font-14 blue">忘记密码?</text> + </view> + + <button :disabled="isDisabled" class="blue-btn mt-20" @click="login">登录</button> </view> </view> </template> <script> - + export default { + data(){ + return { + username: '', + password: '', + isDisabled: false + } + }, + methods:{ + valid(){ + if(!this.username.trim()){ + this.$toast.info('请输入账号'); + return false; + } + if(!this.password.trim()){ + this.$toast.info('输入密码'); + return false; + } + }, + login(){ + if(this.valid() === false){ + return; + } + this.isDisabled = true; + this.$httpUtils.request('/api/common/login', { + username: this.username.trim(), + password: this.password.trim() + }, 'POST').then((res) => { + if(res.status == 200){ + const {mapInfo} = res; + uni.setStorage({ + key: 'userInfo', + data: JSON.stringify({ + token: mapInfo.token, + roleInfo: mapInfo.user + }), + success: () => { + uni.switchTab({ + url: '../workbench/index' + }) + } + }); + } + this.$toast.info(res.info); + this.isDisabled = false; + }).catch((err) => { + this.isDisabled = false; + }) + } + } + } </script> <style> - .login-box{ - padding: 30px; - box-sizing: border-box; - width: 100%; - position: absolute; - bottom: 40px; + .status_bar{ + background: #518EFF; } - .login-input{ + .login-header{ + background: #518EFF; + border-bottom-left-radius: 20px; + border-bottom-right-radius: 20px; + padding: 60px 0 80px; + } + .login-img{ + width: 72px; + height: 72px; + background: #FFFFFF; + border-radius: 8px; + } + .login-box{ + background: #FFFFFF; + padding:20px; + box-sizing: border-box; + position: absolute; + left: 10px; + right: 10px; + bottom: 150px; + border: 1px solid #EDEAF4; + border-radius: 4px; + box-shadow:0 6px 6px rgba(237,234,244,0.5); + } + /* .login-input{ border: 1px solid #ABB1CC; border-radius: 20px; text-align: center; padding: 10px 0; font-size: 14px; + } */ + .input-left{ + text-align: left; } .blue-btn{ background: #2483ff; @@ -34,4 +122,8 @@ color: #FFFFFF; font-size: 16px; } + uni-button[disabled]:not([type]), uni-button[disabled][type=default]{ + color: #FFFFFF; + background-color: rgba(36, 131, 255, 0.6); + } </style> -- Gitblit v1.9.1