<template>
|
<view class="container">
|
<view class="logo">
|
<image src="https://sk.hubeishuiyi.cn/business/xcxImg/wxlogo.png" lazy-load show-menu-by-longpress
|
style="width: 100rpx;height: 100rpx;"></image>
|
<view class="title">荆楚水库</view>
|
</view>
|
<view class="content">
|
<view class="top">
|
<u--form labelPosition="top" labelWidth="60" :model="form" :rules="rules" ref="form">
|
<view class="cell">
|
<u-form-item label="手机号:" prop="phone" borderBottom ref="phone">
|
<u-input v-model="form.phone" border="none" placeholder="请输入手机号">
|
<template slot="suffix">
|
<u-code ref="uCode" @change="codeChange" seconds="60" changeText="x秒后重新获取"></u-code>
|
<u-button @tap="getCodeBtn" :text="tips" type="success" size="mini"></u-button>
|
</template>
|
</u-input>
|
</u-form-item>
|
</view>
|
<view class="cell">
|
<u-form-item label="验证码:" prop="password" borderBottom ref="password">
|
<u--input v-model="form.password" border="none" placeholder="请输入验证码">
|
</u--input>
|
</u-form-item>
|
</view>
|
</u--form>
|
<view class="privacy-policy">
|
<u-radio-group size="15" v-model="radioGroupValue" placement="column" @change="groupChange">
|
<u-radio name="check" @change="radioChange">
|
查看并同意<navigator url="../user/privacyPolicy" hover-class="navigator-hover">
|
《隐私政策》
|
</navigator>
|
</u-radio>
|
</u-radio-group>
|
<view class="statement">
|
仅限湖北省水库管理人员使用
|
</view>
|
</view>
|
<button class="submit" @click="submit" :disabled="disabled">登录</button>
|
<view class="page-change">
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import md5 from '@/utils/md5.js'
|
import {
|
getCode,
|
codeLogin
|
} from "@/api/login"
|
import loginMixin from './mixin/loginMixin'
|
export default {
|
onLoad(option) {
|
const {
|
redirect
|
} = option
|
if (redirect) this.redirect = redirect
|
},
|
mixins: [loginMixin],
|
data() {
|
return {
|
tenantId: '000000',
|
form: {
|
phone: "",
|
password: ""
|
},
|
rules: {
|
'phone': [{
|
type: 'string',
|
required: true,
|
message: '请填写手机号',
|
trigger: ['blur', 'change']
|
},
|
{
|
validator: (rule, value, callback) => {
|
return uni.$u.test.mobile(value);
|
},
|
message: '手机号码不正确',
|
trigger: ['change', 'blur'],
|
}
|
],
|
'password': {
|
type: 'string',
|
required: true,
|
message: '请输入验证码',
|
trigger: ['blur', 'change']
|
}
|
},
|
disabled: false,
|
redirect: '',
|
tips: "",
|
}
|
},
|
methods: {
|
codeChange(e) {
|
this.tips = e
|
},
|
async getCodeBtn() {
|
const that = this
|
const flag = uni.$u.test.mobile(this.form.phone.trim())
|
if (!flag) return uni.$u.toast("手机号格式不正确")
|
if (this.$refs.uCode.canGetCode) {
|
// 模拟向后端请求验证码
|
uni.showLoading({
|
title: '正在获取验证码'
|
})
|
const obj = {
|
userNumber: that.form.phone
|
}
|
const res = await getCode(obj)
|
if (res.code != 200) {
|
uni.hideLoading();
|
return uni.$u.toast(res.msg);
|
}
|
uni.hideLoading();
|
uni.$u.toast('验证码已发送');
|
this.$refs.uCode.start();
|
} else {
|
uni.$u.toast('倒计时结束后再发送');
|
}
|
},
|
submit() {
|
const that = this
|
this.$refs.form.validate().then(async res => {
|
|
if (!this.isPrivacyCheck()) {
|
return
|
}
|
|
const val = await codeLogin(this.tenantId, this.form.phone, this.form.password, "account")
|
this.$u.func.login(val)
|
}).catch(err => {
|
this.$u.func.showToast({
|
title: err.data.error_description
|
})
|
})
|
},
|
handleInputCheck() {
|
this.disabled = false
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.privacy-policy {
|
width: 100%;
|
padding: 40rpx 40rpx 0 80rpx;
|
font-size: 28rpx;
|
}
|
|
|
.container {
|
min-height: 100vh;
|
overflow: hidden;
|
background: url("https://sk.hubeishuiyi.cn/business/xcxImg/reservoirImg/default.jpg") no-repeat;
|
background-size: 100% 100%;
|
|
.set-icon {
|
vertical-align: middle;
|
width: 41rpx;
|
height: auto;
|
margin-right: 35rpx;
|
}
|
}
|
|
.logo {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
padding: 200rpx 0;
|
|
image {
|
box-shadow: 4rpx 4rpx 20rpx #fafafa;
|
}
|
|
.title {
|
margin-top: 40rpx;
|
font-weight: 700;
|
font-size: 32rpx;
|
}
|
}
|
|
.content {
|
display: flex;
|
flex-direction: column;
|
justify-content: space-around;
|
align-items: center;
|
|
// height: 90vh;
|
width: 100%;
|
|
.top {
|
width: 100%;
|
background: #fff;
|
padding: 20px 0;
|
position: fixed;
|
bottom: 0px;
|
|
}
|
|
.logo {
|
display: block;
|
width: 281rpx;
|
height: auto;
|
margin: 0 auto 120rpx;
|
}
|
|
.cell {
|
width: 100%;
|
padding: 0 85rpx;
|
box-sizing: border-box;
|
margin-top: 36rpx;
|
|
.name {
|
font-size: 22rpx;
|
font-family: Source Han Sans CN;
|
font-weight: 400;
|
color: #3e4a59;
|
line-height: 30rpx;
|
opacity: 0.72;
|
}
|
|
.input-box {
|
padding: 30rpx 0;
|
border-bottom: 2rpx solid #f6f6f6;
|
display: flex;
|
align-items: center;
|
|
.code {
|
font-size: 22rpx;
|
font-family: Source Han Sans CN;
|
font-weight: 400;
|
color: #0d0d0d;
|
line-height: 30rpx;
|
|
text {
|
color: #5f88ff;
|
}
|
}
|
|
.ipt {
|
flex: 1;
|
font-size: 24rpx;
|
}
|
|
.hold {
|
font-size: 26rpx;
|
font-family: Source Han Sans CN;
|
font-weight: 400;
|
color: #3e4a59;
|
line-height: 30px;
|
opacity: 0.45;
|
}
|
}
|
}
|
|
.agree {
|
margin: 27rpx 95rpx 0;
|
font-size: 22rpx;
|
font-family: Adobe Heiti Std;
|
font-weight: normal;
|
color: #cacaca;
|
line-height: 34rpx;
|
|
.a {
|
color: #000000;
|
}
|
}
|
|
.submit {
|
margin: 60rpx 90rpx 0;
|
border: none;
|
width: 572rpx;
|
height: 86rpx;
|
line-height: 86rpx;
|
box-sizing: border-box;
|
border-radius: 15rpx;
|
background-color: #5f88ff;
|
color: #ffffff;
|
|
&::after {
|
content: none;
|
}
|
|
&::before {
|
content: none;
|
}
|
|
&[disabled='true'] {
|
background: #e4e4e4;
|
font-size: 36rpx;
|
font-family: Source Han Sans CN;
|
font-weight: 500;
|
color: #ffffff;
|
}
|
}
|
|
.tip {
|
margin-top: 30rpx;
|
text-align: center;
|
font-size: 22rpx;
|
font-family: Adobe Heiti Std;
|
font-weight: normal;
|
color: #cacaca;
|
line-height: 34rpx;
|
}
|
|
.change {
|
margin-top: 20rpx;
|
text-align: center;
|
font-size: 22rpx;
|
font-family: Adobe Heiti Std;
|
font-weight: normal;
|
color: #5f88ff;
|
line-height: 34rpx;
|
}
|
|
.tag {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
font-size: 22rpx;
|
font-family: Adobe Heiti Std;
|
font-weight: normal;
|
color: #9f9f9f;
|
line-height: 34rpx;
|
|
&::before {
|
content: '';
|
display: block;
|
width: 160rpx;
|
height: 1px;
|
background: #d8d8d8;
|
opacity: 0.86;
|
}
|
|
&::after {
|
content: '';
|
display: block;
|
width: 160rpx;
|
height: 1px;
|
background: #d8d8d8;
|
opacity: 0.86;
|
}
|
}
|
|
.chat-arr {
|
margin-top: 50rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
|
.icon {
|
width: 73rpx;
|
height: 73rpx;
|
}
|
}
|
|
.page-change {
|
display: flex;
|
justify-content: space-evenly;
|
}
|
}
|
</style>
|