<template>
|
<view class="page_bg">
|
<uv-navbar title=" " :placeholder="true" leftIcon="" bgColor="rgba(0,0,0,0)"
|
titleStyle="color:#fff"></uv-navbar>
|
|
<view class="login_logo">
|
<image class="ph" src="/static/img/logo.png" mode="widthFix"></image>
|
<view class="name">
|
欢迎,请登录
|
</view>
|
</view>
|
|
<view class="register">
|
<view class="item">
|
<uv-input placeholder="请输入手机号/邮箱" border="none" v-model="userName"></uv-input>
|
</view>
|
<view class="item">
|
<uv-input placeholder="请输入密码" :password="isEye" border="none" v-model="password"></uv-input>
|
<view class="eye" @click="isEye = !isEye">
|
<uv-icon v-if="isEye" name="eye-off" color="#666" size="40rpx"></uv-icon>
|
<uv-icon v-else name="eye" color="#666" size="40rpx"></uv-icon>
|
</view>
|
</view>
|
<view class="item_login">
|
<navigator class="link" url="/pages/register/register" hover-class="none">
|
还没有账号?去注册
|
</navigator>
|
</view>
|
<view class="item_agree">
|
<uv-checkbox-group v-model="agree" size="28rpx" labelSize="28rpx">
|
<uv-checkbox activeColor="#268DFF" name="agree" label="我已阅读并同意" labelColor="#666"></uv-checkbox>
|
<navigator class="link" url="/pages/policy/policy?id=1" hover-class="none">《用户协议》</navigator>
|
和
|
<navigator class="link" url="/pages/policy/policy?id=2" hover-class="none">《隐私政策》</navigator>
|
</uv-checkbox-group>
|
</view>
|
<view class="item_btn">
|
<uv-button text="登录" color="linear-gradient( 142deg, #6FD2FF 0%, #268DFF 100%)" shape="circle" size="large" @click="clickLogin()"></uv-button>
|
</view>
|
</view>
|
|
<!-- 协议同意弹出框 -->
|
<uv-popup ref="popupAgree" round="15" :safeAreaInsetBottom="false">
|
<view class="popup_agree">
|
<view class="title">
|
请阅读并同意以下条款
|
</view>
|
<view class="text">
|
我已阅读并同意
|
<navigator class="link" url="/myPages/agreement/agreement" hover-class="none">《服务协议》</navigator>和
|
<navigator class="link" url="/myPages/privacy/privacy" hover-class="none">《隐私政策》</navigator>
|
</view>
|
<view class="btn">
|
<view class="btn_item">
|
<uv-button type="primary" shape="circle" text="取消" :plain="true" :custom-style="customStyle" @click="clickAgreeClose"></uv-button>
|
</view>
|
<view class="btn_item">
|
<uv-button type="primary" shape="circle" text="同意" color="#268DFF" @click="clickAgreeOk"></uv-button>
|
</view>
|
</view>
|
</view>
|
</uv-popup>
|
|
|
</view>
|
</template>
|
|
<script>
|
import { login,userInfo } from '@/api/api.js'
|
export default {
|
data() {
|
return {
|
userName: '18646195977',
|
password: '123456',
|
agree: [],
|
isEye: true
|
}
|
},
|
onLoad() {
|
|
},
|
methods: {
|
clickAgreeClose(){
|
this.$refs.popupAgree.close();
|
},
|
clickAgreeOk(){
|
this.agree = ['agree']
|
this.$refs.popupAgree.close();
|
},
|
clickLogin(){
|
if(!this.userName){
|
uni.showToast({
|
title: '请输入账号',
|
duration: 2000,
|
icon: 'none'
|
});
|
return
|
}
|
if(!this.password){
|
uni.showToast({
|
title: '请输入密码',
|
duration: 2000,
|
icon: 'none'
|
});
|
return
|
}
|
if(this.agree.length == 0){
|
this.$refs.popupAgree.open();
|
return
|
}
|
uni.showLoading({
|
title: '登陆中'
|
});
|
login({
|
username: this.userName,
|
password: this.password
|
}).then(res=>{
|
console.log('登陆----',res)
|
if(res.code == 200){
|
uni.setStorageSync('token', res.token)
|
userInfo().then(res=>{
|
uni.setStorageSync('userId', res.user.userId)
|
uni.hideLoading();
|
uni.reLaunch({
|
url: '/pages/index/index'
|
});
|
})
|
}
|
else{
|
uni.hideLoading();
|
uni.showToast({
|
title: res.msg,
|
duration: 2000,
|
icon: 'none'
|
});
|
}
|
})
|
},
|
changeAgree(e){
|
//console.log(e.detail.value.length)
|
this.agree = e.detail.value.length
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.popup_agree{
|
width: 650rpx;
|
box-sizing: border-box;
|
padding:50rpx 40rpx;
|
.title{
|
text-align: center;
|
font-size: 34rpx;
|
color:#000;
|
font-weight: bold;
|
line-height: 50rpx;
|
}
|
.text{
|
color: #333;
|
font-size: 28rpx;
|
line-height: 40rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding:30rpx 0 50rpx;
|
.link{
|
color: #3086F3;
|
font-size: 28rpx;
|
line-height: 40rpx;
|
}
|
}
|
.btn{
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
.btn_item{
|
width: 47%;
|
}
|
}
|
}
|
.register{
|
padding:0 60rpx;
|
.item_agree{
|
display: flex;
|
align-items: center;
|
font-size: 27rpx;
|
color: rgba(0,0,0,0.85);
|
line-height: 30rpx;
|
margin-top: 80rpx;
|
.link{
|
font-size: 27rpx;
|
color: #3086F3;
|
}
|
.item_agree_info{
|
display: flex;
|
align-items: center;
|
}
|
}
|
.item_btn{
|
margin-top: 40rpx;
|
}
|
.item{
|
margin-top: 46rpx;
|
height: 100rpx;
|
background: #ECEFF6;
|
border-radius: 23rpx 23rpx 23rpx 23rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
box-sizing: border-box;
|
padding:0 20rpx;
|
}
|
.item_login{
|
padding:20rpx 0;
|
.link{
|
font-size: 27rpx;
|
color: #3086F3;
|
line-height: 40rpx;
|
}
|
}
|
}
|
.login_logo{
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
flex-direction: column;
|
padding-top: 100rpx;
|
.ph{
|
width: 200rpx;
|
height: 200rpx;
|
flex-shrink: 0;
|
}
|
.name{
|
font-weight: 600;
|
font-size: 38rpx;
|
color: rgba(0,0,0,0.65);
|
line-height: 50rpx;
|
margin-top: 30rpx;
|
}
|
}
|
.page_bg {
|
width: 100%;
|
min-height: calc(100vh - var(--window-bottom));
|
background: url('/static/img/bg_2.jpg') no-repeat center top;
|
background-size: 100% auto;
|
}
|
</style>
|