219 lines
5.0 KiB
Vue
219 lines
5.0 KiB
Vue
<template>
|
|
<view class="content">
|
|
<img class="loginBack" src="@/static/imgs/login_back.png">
|
|
<img class="loginBottom" src="@/static/imgs/login_bottom.png">
|
|
<view class="title">
|
|
<view class="title-name">
|
|
用户登录
|
|
</view>
|
|
<view class="title-tips">
|
|
密码登录仅适用于已注册用户
|
|
</view>
|
|
</view>
|
|
<view class="info">
|
|
<view class="info-cont">
|
|
<!-- 输入手机号相关 -->
|
|
<view class="inputs">
|
|
<input type="number" placeholder="请输入手机号" maxlength="11" v-model="phone" />
|
|
</view>
|
|
<!-- 输入密码 -->
|
|
<view class="inputs">
|
|
<input type="text" :password="passwordState" placeholder="请输入密码" v-model="password" />
|
|
<image class="inputs-see" @click="seeClick" :src="seeState ? '../../static/icon/see_active.png' : '../../static/icon/see.png'" mode="aspectFill"></image>
|
|
</view>
|
|
<button class="btn" type="default" @click="LoginSms" :disabled="phone == '' || password == ''">立即登录</button>
|
|
<view class="forget">
|
|
<view class="forget-label" @click="$Router.push({name: 'Register'})">我要注册</view>
|
|
<view class="forget-label forget-after" @click="$Router.push({name: 'Forget'})">忘记密码?</view>
|
|
</view>
|
|
|
|
</view>
|
|
<!-- 用户登录注册协议 -->
|
|
<view class="agreement">
|
|
<checkbox-group @change="radioChange">
|
|
<checkbox color="#da2b56" :checked="checked" style="transform: scale(.55)" class="radioGroup" />
|
|
</checkbox-group>
|
|
<view class="agreement-text">
|
|
我已阅读并同意抖火法律<view @click="$Router.push({name: 'Agreement', params: {name : 'secret'}})">《隐私协议》</view>和<view @click="$Router.push({name: 'Agreement', params: {name : 'protocol'}})">《服务协议》</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { Login } from '@/apis/interfaces/auth'
|
|
export default {
|
|
data() {
|
|
return {
|
|
phone : '', // 手机号码
|
|
password: '', // 登录密码
|
|
checked : false, // 勾选协议
|
|
seeState : false, //小眼睛
|
|
passwordState: true,
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
// 用户登录
|
|
LoginSms() {
|
|
if(this.checked) {
|
|
Login({
|
|
username : this.phone,
|
|
password : this.password
|
|
}).then(res => {
|
|
// 存储用户token
|
|
this.$store.commit('setToken', res.token_type + ' ' + res.access_token)
|
|
|
|
// 回到首页
|
|
this.$Router.replaceAll({name: 'Index'})
|
|
// this.$Router.back()
|
|
}).catch(err => {
|
|
uni.showToast({
|
|
title: err.message,
|
|
icon: "none"
|
|
})
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: '请勾选用户隐私和服务协议',
|
|
icon: "none"
|
|
})
|
|
}
|
|
},
|
|
|
|
// 勾选协议
|
|
radioChange() {
|
|
this.checked = !this.checked
|
|
},
|
|
|
|
// 查看密码
|
|
seeClick() {
|
|
this.seeState = !this.seeState
|
|
this.passwordState = !this.passwordState
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.loginBack {
|
|
width: 35%;
|
|
position: fixed;
|
|
top: 0;
|
|
right: 0;
|
|
}
|
|
.loginBottom {
|
|
width: 60%;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
}
|
|
|
|
.agreement {
|
|
padding: $padding 0 $padding - 20 $padding - 10;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
font-size: $title-size-sm;
|
|
width: 100%;
|
|
line-height: 60rpx;
|
|
color: #979797;
|
|
.radioGroup {
|
|
font-size: $title-size-sm;
|
|
}
|
|
.agreement-text {
|
|
display: flex;
|
|
width: 100%;
|
|
view {
|
|
color: $mian-color;
|
|
padding: 0 5rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.title {
|
|
padding: $padding*4 $padding * 3 $padding*2;
|
|
box-sizing: border-box;
|
|
.title-name {
|
|
font-size: $title-size + 10;
|
|
margin-bottom: $margin - 10;
|
|
}
|
|
.title-tips {
|
|
color: #8e8e8e;
|
|
font-size: $title-size-m;
|
|
}
|
|
}
|
|
|
|
.info {
|
|
padding: $padding * 3 0;
|
|
box-sizing: border-box;
|
|
position: absolute;
|
|
z-index: 6;
|
|
width: 100%;
|
|
.info-cont {
|
|
padding: 0 $padding * 3;
|
|
box-sizing: border-box;
|
|
}
|
|
.inputs {
|
|
background-color: #f7f8fa;
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
margin-bottom: $margin + 20;
|
|
box-sizing: border-box;
|
|
color: #868686;
|
|
font-size: $title-size-m;
|
|
padding: 0 $padding + 10;
|
|
border-radius: $radius-m;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
.inputs-see {
|
|
position: absolute;
|
|
right: $padding;
|
|
top: $padding;
|
|
width: 38rpx;
|
|
height: 38rpx;
|
|
}
|
|
input {
|
|
font-weight: normal;
|
|
height: 100%;
|
|
}
|
|
}
|
|
.btn {
|
|
background-image: linear-gradient(to right, #da2b56, #FBAF3B);
|
|
color: #ffffff;
|
|
border-radius: $radius-m;
|
|
font-size: $title-size;
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
padding: 0;
|
|
margin: $margin * 3 0 0;
|
|
&[disabled] {
|
|
background-image: linear-gradient(to right, #ff8da9, #ffd0a2);
|
|
}
|
|
}
|
|
.forget {
|
|
display: flex;
|
|
line-height: 120rpx;
|
|
font-size: $title-size-m;
|
|
.forget-label {
|
|
flex: 2;
|
|
text-align: center;
|
|
color: #7f8391;
|
|
}
|
|
.forget-after {
|
|
position: relative;
|
|
&::after {
|
|
position: absolute;
|
|
content: '';
|
|
left: 0;
|
|
bottom: calc(50% - 15rpx);
|
|
width: 2rpx;
|
|
height: 30rpx;
|
|
background-color: #f6f6f6;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|