You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
5.7 KiB
Vue

11 months ago
<!-- 蓝色登录页面2 -->
<template>
<view>
11 months ago
<u-loading-page bgColor="rgba(0,0,0,0.5)" :loading="loading" loading-text="..." style="z-index: 999"></u-loading-page>
11 months ago
<view class="img-a">
<view class="t-b">
管理系统账号登录
</view>
</view>
<view class="login-view" style="">
<view class="t-login">
<form class="cl">
<view class="t-a">
<text class="txt">手机号</text>
<input type="number" name="phone" placeholder="请输入您的手机号" maxlength="11" v-model="phone" />
</view>
<view v-if="loginStatus" class="t-a">
<text class="txt">密码</text>
<input type="password" name="code" maxlength="18" placeholder="请输入您的密码" v-model="pwd" />
</view>
<view style="position: relative" v-if="!loginStatus" class="t-a">
<text class="txt">验证码</text>
11 months ago
<input name="code" maxlength="18" placeholder="请输入您的验证码" v-model="code" />
11 months ago
<view v-if="showText" class="sendCode" @click="send1" >发送</view>
<view v-else class="sendCode" >{{second}}</view>
11 months ago
</view>
<view class="reg" @tap="switchLogin()">{{loginStatus?'':''}}</view>
11 months ago
<button @tap="login1()"> </button>
11 months ago
</form>
</view>
</view>
</view>
</template>
<script>
11 months ago
import {login, send} from "../../http/mine";
11 months ago
export default {
11 months ago
11 months ago
data() {
return {
11 months ago
showText:true,
second:60,
11 months ago
loading:false,
11 months ago
loginStatus:true,
phone: '', //手机号码
11 months ago
pwd: '' ,//密码
code:''
11 months ago
};
},
onLoad() {},
methods: {
11 months ago
async send1(){
11 months ago
if (!this.phone) {
uni.showToast({ title: '请输入您的手机号', icon: 'none' });
return;
}
11 months ago
const data={
telNum:this.phone
}
const res= await send(data)
11 months ago
if (res.code===0){
11 months ago
let interval = setInterval(() => {
this.showText = false;
11 months ago
this.second = this.second - 1;
// this.second = times;
11 months ago
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
uni.showToast({ title:'发送成功', icon: 'none' });
}else {
uni.showToast({ title:res.err, icon: 'none' });
}
11 months ago
},
11 months ago
//当前登录按钮操作
11 months ago
async login1() {
11 months ago
if (!this.phone) {
uni.showToast({ title: '请输入您的手机号', icon: 'none' });
return;
}
11 months ago
if (this.loginStatus&&!this.pwd) {
11 months ago
uni.showToast({ title: '请输入您的密码', icon: 'none' });
return;
}
11 months ago
if (!this.loginStatus&&!this.code) {
uni.showToast({ title: '请输入您的验证码', icon: 'none' });
return;
}
this.loading=true
11 months ago
const data={
11 months ago
code:this.loginStatus?'':this.code,
11 months ago
telNum:this.phone,
11 months ago
password:this.loginStatus?this.pwd:''
11 months ago
}
const res=await login(data)
11 months ago
if (res.code===0){
this.loading=false
11 months ago
uni.showToast({ title: '登录成功!', icon: 'none' });
11 months ago
uni.setStorageSync('token',res.data.token)
uni.setStorageSync('userInfo',res.data.accountInfo)
uni.navigateTo({url: '/pages/borrow/index'})
}else {
this.loading=false
uni.showToast({ title: res.err, icon: 'none' });
}
11 months ago
},
//注册按钮点击
switchLogin() {
this.loginStatus=!this.loginStatus
},
//等三方微信登录
wxLogin() {
uni.showToast({ title: '微信登录', icon: 'none' });
},
//第三方支付宝登录
zfbLogin() {
uni.showToast({ title: '支付宝登录', icon: 'none' });
}
}
};
</script>
11 months ago
<style scoped>
11 months ago
.sendCode{
height: 100rpx;width: 150rpx;background-color: rgba(66, 151, 245);position: absolute;bottom: 0;right: 0;
display: flex;justify-content: center;align-items: center;color: #fff;
}
.txt {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.img-a {
width: 100%;
height: 450rpx;
background-image: url(../../static/image/login/ju554@3x.png);
background-size: 100%;
}
.reg {
font-size: 28rpx;
color: rgba(174, 174, 174);
11 months ago
11 months ago
font-weight: bold;
11 months ago
margin-bottom: 40rpx;
11 months ago
text-align: center;
11 months ago
margin-top: 40rpx;
11 months ago
}
.login-view {
11 months ago
11 months ago
width: 100%;
position: relative;
margin-top: -120rpx;
background-color: #ffffff;
border-radius: 8% 8% 0% 0;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
padding-top: 80rpx;
}
.t-login button {
font-size: 28rpx;
background: #2796f2;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
font-weight: bold;
}
.t-login input {
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
border-bottom: 1px solid #e9e9e9;
font-size: 28rpx;
}
.t-login .t-a {
position: relative;
}
.t-b {
text-align: left;
font-size: 42rpx;
color: #ffffff;
padding: 130rpx 0 0 70rpx;
font-weight: bold;
line-height: 70rpx;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .t-f {
text-align: center;
margin: 150rpx 0 0 0;
color: #666;
}
.t-login .t-f text {
margin-left: 20rpx;
color: #aaaaaa;
font-size: 27rpx;
}
.t-login .uni-input-placeholder {
color: #aeaeae;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>