<template>
|
<div class="login_page">
|
<!-- <headers :mess="loginWay" /> -->
|
<!-- <div class="logins_content">
|
<div class="login_title animated slideInDown">
|
<span>{{ $t('hj8') }}</span>
|
</div>
|
<div class="login_forms">
|
<div class="top_forms">
|
|
<el-input :placeholder="$t('hj9')" :size="medium" maxlength="11" v-model="userName" clearable>
|
</el-input>
|
<el-input style="margin-top: 0.46rem;" show-password :placeholder="$t('hj10')" :size="medium"
|
v-model="userPassword" @input="handleInput()">
|
</el-input>
|
</div>
|
<div class="bottom_btns" :class="btnClass ? 'on' : 'off'">
|
<div class="top_btn " @click="loginIN" :class="dengl ? 'animated pulse' : ''">
|
<span>{{ $t('hj11') }}</span>
|
</div>
|
<div class="mes" @click="getApp()">
|
<span>{{ $t('hj12') }}</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="login_bom" v-if="hideshow">
|
<div class="line">
|
<div class="left_line"></div>
|
<div class="center_line">
|
<span>{{ $t('hj13') }}</span>
|
</div>
|
<div class="right_line"></div>
|
</div>
|
<div class="imgDemo">
|
<div class="appImg" @click="getApp()"><img src="@/assets/img/apple.png" /></div>
|
<div class="appImg" @click="getApp()"><img src="@/assets/img/google.png" /></div>
|
<div class="appImg" @click="getApp()"><img src="@/assets/img/facebook.png" /></div>
|
</div>
|
<div class="myzh"><span class="mes">{{ $t('hj14') }}?</span><span @click="$router.push('/register')" class="mes"
|
style="color: rgb(54,124,248);">{{ $t('hj15') }}</span> </div>
|
</div>
|
<el-alert v-show="alertShow" :closable="closable" :title="texts" :type="eltype" center></el-alert> -->
|
<div class="login_content">
|
<!-- Logo区域 -->
|
<div class="logo_container">
|
<img :src="Logo" alt="logo" class="logo_icon" />
|
</div>
|
|
<!-- 输入框区域 -->
|
<div class="input_container">
|
<div class="input_group">
|
<label class="input_label">{{ $t('login_phoneNumber') }}</label>
|
<div class="input_wrapper">
|
<input
|
class="input_field"
|
type="tel"
|
:placeholder="$t('jy311')"
|
v-model="userName"
|
maxlength="11"
|
/>
|
<span v-if="userName" class="clear_icon" @click="userName = ''">×</span>
|
</div>
|
</div>
|
<div class="input_group">
|
<label class="input_label">{{ $t('login_loginPassword') }}</label>
|
<div class="input_wrapper">
|
<input
|
class="input_field password_input"
|
:type="showPassword ? 'text' : 'password'"
|
:placeholder="$t('hj30')"
|
v-model="userPassword"
|
@input="handleInput()"
|
/>
|
<span
|
class="password_toggle"
|
@click="togglePassword"
|
:class="showPassword ? 'icon_eye_open' : 'icon_eye_close'"
|
></span>
|
<span v-if="userPassword" class="clear_icon" @click="userPassword = ''">×</span>
|
</div>
|
</div>
|
</div>
|
|
<!-- 用户协议复选框 -->
|
<div class="agreement_container">
|
<input
|
type="checkbox"
|
id="agreement"
|
v-model="agreedToTerms"
|
class="agreement_checkbox"
|
/>
|
<label for="agreement" class="agreement_label">
|
{{ $t('login_agreeToTerms') }}<span class="agreement_link" @click.stop="viewAgreement">《{{ $t('login_userAgreement') }}》</span>
|
</label>
|
</div>
|
|
<!-- 按钮区域 -->
|
<div class="button_container">
|
<div @click="loginIN" v-loading="loginBtn" class="login_btn">{{ $t('hj24') }}</div>
|
<div @click="$router.push('/register')" class="register_btn">{{ $t('login_openAccountRegister') }}</div>
|
</div>
|
</div>
|
|
<el-alert v-show="alertShow" :closable="closable" :title="texts" :type="eltype" center></el-alert>
|
</div>
|
</template>
|
<script>
|
import { Toast } from 'mint-ui'
|
import headers from "./components/header.vue";
|
import Logo from "@/assets/imgRed/logo.png";
|
import * as api from '@/axios/api';
|
|
export default {
|
name: "newLogin",
|
data() {
|
return {
|
loginWay: this.$t('hj8'),
|
currentLoginMode: "email",
|
placeholder: this.$t('hj16'),
|
Logo,
|
userPassword: "",
|
userName: "",
|
btnClass: false,
|
medium: "medium",
|
alertShow: false,
|
closable: false,
|
eltype: 'warning',
|
texts: "",
|
dengl: false,
|
loginBtn: false,
|
docmHeight: document.documentElement.clientHeight, //默认屏幕高度
|
showHeight: document.documentElement.clientHeight, //实时屏幕高度
|
hideshow: true, //显示或者隐藏footer
|
showPassword: false, // 密码显示/隐藏
|
agreedToTerms: false, // 是否同意用户协议
|
};
|
},
|
components: {
|
headers
|
},
|
mounted() {
|
window.onresize = () => {
|
return (() => {
|
this.showHeight = document.body.clientHeight;
|
})()
|
}
|
let phone = window.localStorage.getItem("phone")
|
if (phone) {
|
this.$store.state.userInfo.phone = phone
|
this.$store.state.userInfo.token = window.localStorage.getItem("USERTOKEN")
|
this.$router.push('/home')
|
}
|
},
|
watch: {
|
showHeight: function () {
|
if (this.docmHeight > this.showHeight) {
|
this.hideshow = false
|
} else {
|
this.hideshow = true
|
}
|
}
|
},
|
methods: {
|
getApp() {
|
Toast(this.$t('hj17'))
|
//Toast 弹窗大小
|
// this.texts = this.$t('hj17')
|
// this.alertShow = true
|
// setTimeout(() => {
|
// this.alertShow = false
|
// }, 2000)
|
},
|
handleInput() {
|
console.log(this.userPassword !== "" && this.userName !== '');
|
if (this.userPassword !== "" && this.userName !== '') {
|
this.btnClass = true;
|
} else {
|
this.btnClass = false;
|
}
|
},
|
togglePassword() {
|
this.showPassword = !this.showPassword;
|
},
|
viewAgreement() {
|
// 跳转到用户协议页面
|
this.$router.push('/about?e=2');
|
},
|
async loginIN() {
|
if (!this.agreedToTerms) {
|
Toast(this.$t('login_pleaseAgreeToTerms'));
|
return;
|
}
|
this.dengl = true
|
setTimeout(() => {
|
this.dengl = false
|
}, 1000)
|
if (this.loginBtn) {
|
return;
|
}
|
this.loginBtn = true;
|
let opts = {
|
phone: this.userName,
|
userPwd: this.userPassword
|
}
|
let data = await api.login(opts)
|
if (data.status === 0) {
|
this.$store.state.userInfo.phone = this.userName
|
this.$store.state.userInfo.token = data.data.token
|
// this.texts = this.$t('hj36')
|
// this.eltype = 'success'
|
// this.alertShow = true
|
Toast(this.$t('hj36'))
|
setTimeout(() => {
|
// this.alertShow = false
|
// this.eltype = 'warning'
|
this.$router.push('/home')
|
}, 1000)
|
this.loginBtn = false;
|
// window.localStorage.clear()
|
window.localStorage.setItem("phone", this.userName);
|
window.localStorage.setItem("USERTOKEN", data.data.token);
|
} else {
|
// this.texts = data.msg
|
// this.alertShow = true
|
this.loginBtn = false;
|
// setTimeout(() => {
|
// this.alertShow = false
|
// }, 2000)
|
Toast(data.msg)
|
}
|
if (navigator.vibrate) {
|
// 支持
|
navigator.vibrate([55]);
|
}
|
},
|
},
|
beforeDestroy() { },
|
created() { }
|
};
|
</script>
|
|
<style scoped lang="less">
|
.login_page {
|
position: relative;
|
background: url('~@/assets/imgRed/14.png') no-repeat center center;
|
background-size: cover;
|
width: 100%;
|
min-height: 100vh;
|
display: flex;
|
// align-items: center;
|
justify-content: center;
|
// padding: 1rem;
|
overflow-y: auto;
|
}
|
|
.login_content {
|
margin-top: 50px;
|
width: 100%;
|
max-width: 8.5rem;
|
max-height: 61vh;
|
border-radius: 0.4rem;
|
padding: .375rem;
|
background-color: rgba(255, 255, 255, .5);
|
box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.1);
|
}
|
|
// Logo区域
|
.logo_container {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.logo_icon {
|
height: 3rem;
|
object-fit: contain;
|
display: block;
|
}
|
|
.logo_text {
|
display: flex;
|
flex-direction: column;
|
}
|
|
.logo_title {
|
font-size: 0.7rem;
|
font-weight: 600;
|
color: #000;
|
line-height: 1.2;
|
}
|
|
.logo_subtitle {
|
font-size: 0.28rem;
|
color: #666;
|
letter-spacing: 0.05rem;
|
margin-top: 0.1rem;
|
}
|
|
// 输入框区域
|
.input_container {
|
width: 100%;
|
margin-bottom: 0.8rem;
|
}
|
|
.input_group {
|
margin-bottom: 0.6rem;
|
}
|
|
.input_label {
|
display: block;
|
font-size: 0.32rem;
|
color: #000;
|
margin-bottom: 0.25rem;
|
font-weight: 500;
|
}
|
|
.input_wrapper {
|
position: relative;
|
width: 100%;
|
}
|
|
.input_field {
|
width: 100%;
|
height: 1rem;
|
background: #fff;
|
border: 1px solid #e0e0e0;
|
border-radius: 0.15rem;
|
padding: 0 0.3rem;
|
padding-right: 0.7rem;
|
font-size: 0.32rem;
|
color: #000;
|
box-sizing: border-box;
|
|
&::placeholder {
|
color: #999;
|
font-size: 0.32rem;
|
}
|
|
&:focus {
|
outline: none;
|
border-color: #2567ff;
|
}
|
}
|
|
.password_input {
|
padding-right: 1.4rem;
|
}
|
|
.clear_icon {
|
position: absolute;
|
right: 0.3rem;
|
top: 50%;
|
transform: translateY(-50%);
|
width: 0.35rem;
|
height: 0.35rem;
|
line-height: 0.35rem;
|
text-align: center;
|
color: #999;
|
font-size: 0.4rem;
|
cursor: pointer;
|
background: #f5f5f5;
|
border-radius: 50%;
|
|
&:hover {
|
background: #e0e0e0;
|
}
|
}
|
|
.password_toggle {
|
position: absolute;
|
right: 0.3rem;
|
top: 50%;
|
transform: translateY(-50%);
|
width: 0.4rem;
|
height: 0.4rem;
|
cursor: pointer;
|
background-size: contain;
|
background-repeat: no-repeat;
|
background-position: center;
|
z-index: 1;
|
}
|
|
.password_wrapper .clear_icon {
|
right: 0.75rem;
|
}
|
|
.icon_eye_close {
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'%3E%3C/path%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3C/svg%3E");
|
}
|
|
.icon_eye_open {
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3C/svg%3E");
|
}
|
|
// 用户协议区域
|
.agreement_container {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
margin-bottom: 1rem;
|
}
|
|
.agreement_checkbox {
|
width: 0.32rem;
|
height: 0.32rem;
|
margin-right: 0.25rem;
|
cursor: pointer;
|
appearance: none;
|
border: 2px solid #2567ff;
|
border-radius: 50%;
|
position: relative;
|
|
&:checked {
|
background-color: #2567ff;
|
border-color: #2567ff;
|
|
&::after {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 50%;
|
transform: translate(-50%, -50%);
|
width: 0.12rem;
|
height: 0.12rem;
|
background: #fff;
|
border-radius: 50%;
|
}
|
}
|
}
|
|
.agreement_label {
|
font-size: 0.28rem;
|
color: #000;
|
cursor: pointer;
|
user-select: none;
|
}
|
|
.agreement_link {
|
color: #2567ff;
|
cursor: pointer;
|
}
|
|
// 按钮区域
|
.button_container {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
gap: 0.5rem;
|
margin-top: 1rem;
|
}
|
|
.login_btn {
|
width: 100%;
|
height: 1rem;
|
background: #e03936;
|
border-radius: 0.15rem;
|
color: #fff;
|
font-size: 0.36rem;
|
font-weight: 600;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
cursor: pointer;
|
transition: background 0.3s;
|
border: none;
|
|
&:active {
|
background: #c62828;
|
}
|
}
|
|
.register_btn {
|
width: 100%;
|
height: 1rem;
|
background: #2567ff;
|
border-radius: 0.15rem;
|
color: #fff;
|
font-size: 0.36rem;
|
font-weight: 600;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
cursor: pointer;
|
transition: background 0.3s;
|
border: none;
|
|
&:active {
|
background: #1a56d9;
|
}
|
}
|
|
.logins_content {
|
|
width: 100%;
|
height: 9.7436rem;
|
margin-top: 0.4359rem;
|
padding: 0 0.4564rem;
|
|
.login_title {
|
width: 100%;
|
height: 2.0513rem;
|
display: flex;
|
|
align-items: center;
|
font-size: 0.7023rem;
|
color: #000;
|
font-weight: 600 !important;
|
|
>span {
|
font-weight: 600 !important;
|
}
|
}
|
|
.login_forms {
|
width: 100%;
|
height: auto;
|
margin-top: 0.35rem;
|
|
.top_forms {
|
width: 100%;
|
height: auto;
|
display: flex;
|
align-items: center;
|
flex-wrap: wrap;
|
|
.user_name,
|
.password {
|
width: 100%;
|
height: 35%;
|
background: rgb(246, 246, 247);
|
// background: #1e1e1e;
|
border-radius: 0.3564rem;
|
|
>input {
|
width: 100%;
|
height: 100%;
|
padding-left: 0.3564rem;
|
font-size: 0.4615rem;
|
}
|
}
|
}
|
|
/deep/.el-input__inner {
|
width: 100%;
|
height: 1.45rem !important;
|
background-color: rgb(246, 246, 247) !important;
|
// background: #1e1e1e;
|
border-radius: 0.3564rem;
|
font-size: 0.45rem !important;
|
}
|
|
.bottom_btns {
|
width: 100%;
|
height: 3.3333rem;
|
margin-top: 0.8528rem;
|
|
.top_btn {
|
width: 100%;
|
height: 1.25rem;
|
border-radius: 0.3564rem;
|
background: rgb(154, 197, 250);
|
color: #fff;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 0.5128rem;
|
margin-top: 0.75rem;
|
|
>span {
|
font-weight: 530 !important;
|
}
|
}
|
|
|
|
.mes {
|
width: 100%;
|
height: 20%;
|
margin-top: 0.4rem;
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
font-size: 0.3846rem;
|
}
|
}
|
}
|
}
|
|
.login_bom {
|
position: absolute;
|
bottom: 2.6rem;
|
width: 100%;
|
height: 4rem;
|
padding: 0 2rem;
|
}
|
|
.line {
|
//分割线
|
width: 100%;
|
height: 0.3846rem;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-top: 0.3846rem;
|
|
.left_line {
|
width: 20%;
|
height: 0.01rem;
|
background: #e5e5e5;
|
}
|
|
.center_line {
|
width: 50%;
|
height: 0.01rem;
|
background: #fff;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
|
>span {
|
font-size: 0.3046rem;
|
color: #000;
|
background-color: #fff;
|
|
}
|
}
|
|
.right_line {
|
width: 20%;
|
height: 0.01rem;
|
background: #e5e5e5;
|
}
|
|
}
|
|
.myzh {
|
width: calc(100% - 4rem);
|
position: absolute;
|
bottom: 0.01rem;
|
text-align: center;
|
|
.mes {
|
width: 100%;
|
height: 40%;
|
|
font-size: 0.3846rem;
|
}
|
}
|
|
.imgDemo {
|
display: flex;
|
justify-content: space-between;
|
position: relative;
|
transform: translateY(50%);
|
}
|
|
.appImg {
|
width: 1.4rem;
|
height: 1.4rem;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
background-color: rgb(246, 246, 247);
|
border-radius: 100%;
|
}
|
|
.appImg img {
|
width: 0.8rem;
|
height: 0.8rem;
|
}
|
|
.img_mess {
|
width: 100%;
|
height: 4.0513rem;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
|
.logo_content {
|
width: 3rem;
|
height: 3.5769rem;
|
|
>img {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
|
/deep/.el-input__suffix {
|
width: 1rem !important;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
/deep/.el-input__suffix-inner {
|
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
|
}
|
|
/deep/.el-input__icon {
|
width: 1rem !important;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
.on .top_btn {
|
background: #2d8cf0 !important;
|
}
|
|
/deep/.el-icon-circle-close::before {
|
font-size: 0.5rem !important;
|
|
}
|
|
/deep/.el-input__clear {
|
font-size: 0.5rem !important;
|
}
|
</style>
|