|
|
|
|
<template>
|
|
|
|
|
<view class="page">
|
|
|
|
|
<view class="login_form_warp">
|
|
|
|
|
<view class="login_form_item">
|
|
|
|
|
<uni-icons type="person" size="30" color="#979797"></uni-icons>
|
|
|
|
|
<input class="login_form_input" v-model="form.username" placeholder="请输入账号" maxlength="20" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="login_form_item">
|
|
|
|
|
<uni-icons type="locked" size="30" color="#979797"></uni-icons>
|
|
|
|
|
<input class="login_form_input" v-model="form.password" type="password" placeholder="请输入密码" maxlength="20" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="login_form_item">
|
|
|
|
|
<text class="vercode_label">验证码:</text>
|
|
|
|
|
<input class="login_form_input" v-model="form.verCode" placeholder="请输入图形验证码" maxlength="20" />
|
|
|
|
|
<image :src="codeImg" @click="getVerCode" style="width: 244rpx; height:59rupx;"></image>
|
|
|
|
|
</view>
|
|
|
|
|
<button type="primary" class="page-body-button" @click="doLogin">登录</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
form: {
|
|
|
|
|
username: '',
|
|
|
|
|
password: '',
|
|
|
|
|
verCode: '',
|
|
|
|
|
vercodeType: 5
|
|
|
|
|
}, //登录form
|
|
|
|
|
codeImg: '', //图形验证码
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
// this.getVerCode();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//获取图形验证码
|
|
|
|
|
getVerCode() {
|
|
|
|
|
this.$request1(getApp().globalData.baseUrl + '/api/common/captchaBase64?type=5&_t=' + Date.parse(new Date()), {}, 'GET').then(res => {
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
this.codeImg = res.data.img;
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
console.log('vercode err')
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//登录
|
|
|
|
|
doLogin() {
|
|
|
|
|
if(this.form.username == '' || this.form.password == '') {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '用户名密码不能为空',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
} else if(this.form.verCode == '') {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '验证码不能为空',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '登录中...',
|
|
|
|
|
mask: true
|
|
|
|
|
})
|
|
|
|
|
this.$request1(getApp().globalData.baseUrl + '/api/login/auth', this.form, 'POST').then(res => {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
uni.setStorageSync('satoken', res.data.satoken);
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.page{
|
|
|
|
|
position: relative;
|
|
|
|
|
height: vh;
|
|
|
|
|
background: #2D8CF0;
|
|
|
|
|
}
|
|
|
|
|
.login_form_warp{
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
right:0;
|
|
|
|
|
bottom:0;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
box-shadow: 0rpx -25rpx 46rpx 1rpx rgba(0,0,0,0.13);
|
|
|
|
|
border-radius: 40rpx 40rpx 0rpx 0rpx;
|
|
|
|
|
padding: 50rpx;
|
|
|
|
|
.login_title{
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 59rpx;
|
|
|
|
|
font-size: 42rpx;
|
|
|
|
|
font-family: PingFang SC-Bold, PingFang SC;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
.sub_title{
|
|
|
|
|
color: #666;
|
|
|
|
|
line-height: 33rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
font-family: PingFang SC-Regular, PingFang SC;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
margin: 10rpx 0 60rpx;
|
|
|
|
|
}
|
|
|
|
|
.login_form_item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background: #F6F6F6;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
padding: 16rpx 20rpx 15rpx;
|
|
|
|
|
margin-bottom: 50rpx;
|
|
|
|
|
.vercode_label{
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 59rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
font-family: PingFang SC-Regular, PingFang SC;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
}
|
|
|
|
|
.login_form_input {
|
|
|
|
|
padding: 0 10rpx;
|
|
|
|
|
line-height: 59rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
button {
|
|
|
|
|
background-color: #007aff;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
margin: 48rpx 50rpx 10rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|