From a6d6189cdc8120757556c340c18905c2f65ecccb Mon Sep 17 00:00:00 2001
From: lancer <1905818361@qq.com>
Date: Fri, 21 Jan 2022 15:49:39 +0800
Subject: [PATCH] init
---
pages.json | 15 ++-
pages/index/guide.vue | 6 +-
pages/login/Verification.vue | 217 ++++++++++++++++++++++++++++-----
pages/login/Verifythelogin.vue | 6 +-
pages/login/index.vue | 105 +++++++++++-----
5 files changed, 273 insertions(+), 76 deletions(-)
diff --git a/pages.json b/pages.json
index edecf20..74896c6 100644
--- a/pages.json
+++ b/pages.json
@@ -49,15 +49,20 @@
"name": "login",
"pages": [
{
- "path": "index"
+ "path": "index",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "navigationBarBackgroundColor": "#2671E2",
+ "navigationBarTextStyle": "white"
+ }
},
{
"path": "Verification",
"style": {
- "navigationBarTitleText": "验证码登录",
- "navigationBarBackgroundColor": "#008EF2",
- "navigationBarTextStyle": "white",
- "navigationStyle": "custom"
+ "navigationBarTitleText": "登陆",
+ "navigationBarBackgroundColor": "#2671E2",
+ "navigationBarTextStyle": "white"
+ // "navigationStyle": "custom"
}
},
{
diff --git a/pages/index/guide.vue b/pages/index/guide.vue
index d49a2f4..9aab4d3 100644
--- a/pages/index/guide.vue
+++ b/pages/index/guide.vue
@@ -5,7 +5,7 @@
-
+
@@ -141,9 +141,9 @@
left: 0rpx;
top: 100rpx;
text-align: center;
- color: #FFFFFF;
+ color: #000000;
font-size: 32rpx;
- font-weight: 500;
+ font-weight: bold;
z-index: 1000;
}
.booximg{
diff --git a/pages/login/Verification.vue b/pages/login/Verification.vue
index 7e87d2d..9bfff10 100644
--- a/pages/login/Verification.vue
+++ b/pages/login/Verification.vue
@@ -1,13 +1,35 @@
-
+
-
-
+
+
+ 您好,
+
+
+ 欢迎登录智控管家~
+
+
+
+
+ placeholder-style='color:#AAAAAA;' />
+
+
+
+
+
+
+ 获取验证码
+
+
+ 重新发送({{ auth_time }})
+
+
+
@@ -15,8 +37,10 @@
+
+ 登录
- 获取验证码
+
@@ -28,11 +52,14 @@
data() {
return {
username: '',
- role: ''
+ role: '',
+ msg: '',
+ sendAuthCode: true,
+ auth_time: 0,
};
},
onLoad: function(options) {
- this.role=options.role;
+ this.role = options.role;
},
methods: {
//账号密码登录
@@ -42,10 +69,85 @@
})
},
//获取验证码
+ getAuthCode() {
+ uni.request({
+ url: config.service.sendCode + "?mobile=" + this.username,
+ method: "GET",
+ header: {
+ 'content-type': 'application/json',
+ 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
+ },
+ success: (data) => {
+ console.log(data)
+ // 成功地响应会话信息
+ if (data.data.code == 10000) {
+ util.showSuccess('发送成功');
+ this.sendAuthCode = false;
+ this.auth_time = 60;
+ var auth_timetimer = setInterval(() => {
+ this.auth_time--;
+ if (this.auth_time <= 0) {
+ this.sendAuthCode = true;
+ clearInterval(auth_timetimer);
+ }
+ }, 1000);
+ } else {
+ util.showNone(data.data.message);
+ return false;
+ }
+ },
+ })
+ },
+ //登录
+ denglu() {
+ if (this.msg == '') {
+ uni.showToast({
+ title: '验证码不能为空',
+ icon: 'none'
+ });
+ return
+ }
+ if (this.msg.length == 4) {
+ let porme = {
+ loginName: this.phonecet,
+ password: this.msg
+ }
+ uni.request({
+ url: config.service.plogin,
+ method: "POST",
+ data: porme,
+ header: {
+ 'content-type': 'application/json',
+ 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
+ },
+ success: (data) => {
+ // 成功地响应会话信息
+ if (data.data.code == 10000) {
+ util.showSuccess('登录成功');
+ var token = {
+ 'token': data.data.data
+ };
+ uni.setStorageSync(WXB_SESSION_LOGIN_DATA, token); //写入缓存
+ this.getMenu()
+ this.getUser()
+ } else {
+ util.showNone(data.data.message);
+ return false;
+ }
+ },
+ })
+ } else {
+ uni.showToast({
+ title: '验证码位数不正确',
+ icon: 'none'
+ });
+ }
+ },
+ //获取验证码
bindWxBLogin: function(e) {
if (!(/^1[34578]\d{9}$/.test(this.username))) {
util.showNone("手机号码错误");
- this.username='';
+ this.username = '';
return false;
} else {
uni.request({
@@ -60,14 +162,16 @@
// 成功地响应会话信息
if (data.data.code == 10000) {
util.showSuccess('发送成功');
- if(this.role==1){
+ if (this.role == 1) {
uni.navigateTo({
- url: '/pages/login/yinzhongmalogin?username=' + this.username +
+ url: '/pages/login/yinzhongmalogin?username=' + this
+ .username +
'&role=' + this.role,
})
- }else{
+ } else {
uni.navigateTo({
- url: '/pages/login/Verifythelogin?username=' + this.username +
+ url: '/pages/login/Verifythelogin?username=' + this
+ .username +
'&role=' + this.role,
})
}
@@ -77,7 +181,7 @@
return false;
}
},
- })
+ })
}
},
}
@@ -106,7 +210,7 @@
}
.cwjs-cells {
- width: 569rpx;
+ width: 510rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
@@ -114,8 +218,9 @@
margin: 0 auto;
height: 88rpx;
overflow: hidden;
- border-bottom: 1rpx solid #BFC7D3;
+ border: 1rpx solid #BFC7D3;
position: relative;
+ border-radius: 12rpx;
}
.center {
@@ -139,10 +244,19 @@
margin-top: 33.5rpx;
}
+ .mod-btn {
+ position: absolute;
+ bottom: -80rpx;
+ left: 50%;
+ margin-left: -80rpx;
+ }
-
-
-
+ .sada {
+ font-size: 30rpx;
+ color: #2B6EFF;
+ width: 200rpx;
+ display: flex;
+ }
/* 头部 */
@@ -151,15 +265,20 @@
width: 750rpx;
height: 500rpx;
position: relative;
- .head-immg{
- width: 118rpx;
- height: 61rpx;
+
+ .head-immg {
+ // width: 118rpx;
+ // height: 61rpx;
+ // position: absolute;
+ // top: 300rpx;
+ // left: 100rpx;
+ width: 750rpx;
+ height: 778rpx;
position: absolute;
- top: 300rpx;
- left: 100rpx;
}
}
+
.logo {
width: 248upx;
height: 248upx;
@@ -170,13 +289,29 @@
}
-
/* 输入框 */
.input {
- width: 100%;
- height: auto;
- padding: 0 105rpx;
+ width: 630rpx;
+ height: 824rpx;
+ padding: 60rpx 60rpx 80rpx 60rpx;
box-sizing: border-box;
+ background: #FFFFFF;
+ box-shadow: 0px 14px 20px -6px rgba(6, 16, 88, 0.1);
+ border-radius: 20px;
+ position: absolute;
+ top: 107rpx;
+ left: 60rpx;
+ }
+
+ .text-1 {
+ font-size: 44rpx;
+ line-height: 62rpx;
+ }
+
+ .text-2 {
+ margin-top: 16rpx;
+ font-size: 36rpx;
+ line-height: 50rpx;
}
.logo_input {
@@ -184,24 +319,40 @@
height: 38rpx;
position: absolute;
top: 25rpx;
- left: 0;
+ left: 30rpx;
}
/* 登录 */
.button {
- width: 630rpx;
+ width: 510rpx;
height: 86rpx;
background: #2671E2;
- box-shadow: 0px 2rpx 20rpx 0px rgba(38, 113, 226, 0.5);
- border-radius: 49rpx;
+ box-shadow: 0px 2px 20px 0px rgba(38, 113, 226, 0.5);
+ border-radius: 12rpx;
text-align: center;
line-height: 89rpx;
color: #fff;
margin: 0 auto;
- margin-top: 239rpx;
+ margin-top: 120rpx;
font-size: 34rpx;
+
}
+ .footer {
+ width: 100%;
+ height: 157rpx;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ }
+
+ .imagesBox {
+ width: 80rpx;
+ height: 88rpx;
+ }
+
+
+
.login {
text-decoration: underline;
text-align: center;
@@ -230,6 +381,6 @@
}
.textbox-2 {
- width: 40%;
+ width: 30%;
}
diff --git a/pages/login/Verifythelogin.vue b/pages/login/Verifythelogin.vue
index 1e46d92..cf284a2 100644
--- a/pages/login/Verifythelogin.vue
+++ b/pages/login/Verifythelogin.vue
@@ -40,11 +40,13 @@
msg: '',
phonecet: '',
role:'',
- phone:''
+ phone:'',
+ phonese:''
};
},
onLoad: function(options) {
var phonese = options.username;
+ this.phonese=phonese
var phonexxz = phonese.substring(0, 3) + '****' + phonese.substring(7);
this.phone = phonexxz,
this.phonecet = options.username,
@@ -90,7 +92,7 @@
}
if (this.msg.length == 4) {
uni.navigateTo({
- url: '/pages/login/Setthepassword?username='+'18655732363',
+ url: '/pages/login/Setthepassword?username='+phonese,
})
} else {
uni.showToast({
diff --git a/pages/login/index.vue b/pages/login/index.vue
index ba45dff..a322469 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -1,26 +1,39 @@
-
+
-
+
+
+ 您好,
+
+
+ 欢迎登录智控管家~
+
+
+
-
+
-
-
+
+
-
-
+
+
@@ -28,8 +41,10 @@
忘记密码
+
+ 立即登录
- 立即登录
+
@@ -67,7 +82,7 @@
},
//密码选择
changeBindPassword: function(e) {
- this.passwordType=!this.passwordType;
+ this.passwordType = !this.passwordType;
},
//登录
bindWxBLogin: function(e) {
@@ -84,7 +99,7 @@
var loginParams = {
loginName: this.username,
password: this.password
- };
+ };
// 请求服务器登录地址,获得会话信息
uni.request({
url: config.service.login,
@@ -108,7 +123,7 @@
} else {
util.showNone("账号名或密码错误,请重试");
return false;
- }
+ }
// 没有正确响应会话信息
} else {
util.showNone(data.message);
@@ -122,10 +137,10 @@
}
});
},
- getUser(){
+ getUser() {
util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
if (data.zkProperties) {
-
+
} else {
data.zkProperties = [{
id: "",
@@ -144,13 +159,13 @@
});
});
},
- getMenu(){
+ getMenu() {
this.$u.get("/user/getMenu").then(data => {
uni.setStorageSync("weapp_session_Menu_data", data)
- })
+ })
}
-
-
+
+
}
};
@@ -177,7 +192,7 @@
}
.cwjs-cells {
- width: 569rpx;
+ width: 510rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
@@ -185,8 +200,9 @@
margin: 0 auto;
height: 88rpx;
overflow: hidden;
- border-bottom: 1rpx solid #BFC7D3;
+ border: 1rpx solid #BFC7D3;
position: relative;
+ border-radius: 12rpx;
}
.center {
@@ -226,12 +242,16 @@
width: 750rpx;
height: 500rpx;
position: relative;
- .head-immg{
- width: 118rpx;
- height: 61rpx;
+
+ .head-immg {
+ // width: 118rpx;
+ // height: 61rpx;
+ // position: absolute;
+ // top: 300rpx;
+ // left: 100rpx;
+ width: 750rpx;
+ height: 778rpx;
position: absolute;
- top: 300rpx;
- left: 100rpx;
}
}
@@ -245,12 +265,30 @@
left: 240.5rpx;
}
+
/* 输入框 */
.input {
- width: 100%;
- height: auto;
- padding: 0 105rpx;
+ width: 630rpx;
+ height: 824rpx;
+ padding: 60rpx 60rpx 80rpx 60rpx;
box-sizing: border-box;
+ background: #FFFFFF;
+ box-shadow: 0px 14px 20px -6px rgba(6, 16, 88, 0.1);
+ border-radius: 20px;
+ position: absolute;
+ top: 107rpx;
+ left: 60rpx;
+ }
+
+ .text-1 {
+ font-size: 44rpx;
+ line-height: 62rpx;
+ }
+
+ .text-2 {
+ margin-top: 16rpx;
+ font-size: 36rpx;
+ line-height: 50rpx;
}
.logo_input {
@@ -258,22 +296,23 @@
height: 38rpx;
position: absolute;
top: 25rpx;
- left: 0;
+ left: 30rpx;
}
/* 登录 */
.button {
- width: 630rpx;
+ width: 510rpx;
height: 86rpx;
background: #2671E2;
- box-shadow: 0px 2rpx 20rpx 0px rgba(38, 113, 226, 0.5);
- border-radius: 49rpx;
+ box-shadow: 0px 2px 20px 0px rgba(38, 113, 226, 0.5);
+ border-radius: 12rpx;
text-align: center;
line-height: 89rpx;
color: #fff;
margin: 0 auto;
- margin-top: 239rpx;
+ margin-top: 120rpx;
font-size: 34rpx;
+
}
.footer {
@@ -319,6 +358,6 @@
}
.textbox-2 {
- width: 40%;
+ width: 30%;
}