Files
jjx-web/pages/auth/login/login.vue
T
2023-11-07 17:11:57 +08:00

612 lines
12 KiB
Vue

<template>
<view>
<div class="outter-wrapper">
<div class="login-page">
<div class="header w-1180 flex-h-ac">
<a href="" class="zg-logo fl nuxt-link-active">
<img src="@/static/images/logo-small.png" alt="买卖钢材,上金久信">
</a>
</div>
<div class="main-container">
<div class="w-1180 flex-h-e">
<div class="login-container">
<h2 style="margin-bottom: 15px;">会员登录</h2>
<div id="from" action="">
<div class="input-grouptabs clear">
<span @click="memberType = 'personal'"
:class="{'tab-active': memberType == 'personal'}" class="normal" data-id="0"
id="normal"><i></i>个人用户</span>
<span @click="memberType = 'business'"
:class="{'tab-active': memberType == 'business'}" class="nopassword" data-id="1"
id="nopw"><i></i>企业用户</span>
</div>
<!-- 账号密码登录 -->
<view class="login-method">
<view @click="loginMethod = 'username'" class="login-method-item">账号密码登录</view>
<view @click="loginMethod = 'mobile'" class="login-method-item">验证码登录</view>
</view>
<div class="tabContent">
<!--企业用户登录-->
<div class="login-con active" id="rc">
<div v-if="loginMethod == 'username'" class="input-group clear">
<div class="input-group-addon">
<i class="icon_user"></i>
</div>
<input type="text" class="form-control" v-model="form1.username"
placeholder="请输入手机号/邮箱/用户名" autocomplete="off">
</div>
<div v-if="loginMethod == 'username'" class="input-group clear">
<div class="input-group-addon">
<i class="icon_password"></i>
</div>
<input type="password" class="form-control" v-model="form1.password"
placeholder="请输入登录密码" autocomplete="off">
</div>
<div v-if="loginMethod == 'mobile'" class="input-group clear">
<div class="input-group-addon">
<i class="icon_user"></i>
</div>
<input type="text" class="form-control" v-model="form1.mobile"
placeholder="请输入手机号" autocomplete="off">
</div>
<div v-if="loginMethod == 'mobile'" class="input-group clear">
<div class="input-group-addon">
<i class="icon_phone"></i>
</div>
<input type="text" class="form-control" v-model="form1.smsCode"
placeholder="请输入短信验证码" autocomplete="off" />
<view @click="sendSmsCode" id="btnSendCode1" type="button"
class="btn-default" value="">{{smsTips}}</view>
</div>
</div>
</div>
<div class="input-groupp clear">
<button @click="handleSubmit" type="submit" id="login" class="btnMarymt"
style="width: 100%;">立即登录</button>
</div>
</div>
<div class="input-groupwp clear">
<navigator url="/pages/auth/register/register" style="float: left;text-align: left;">免费注册新账号</navigator>
<a href="/user/find_pwd.html" style="float: right;text-align: right;">找回密码</a>
</div>
<div class=" threeBorder"><span>第三方登录</span></div>
<div class="input-groupwpg clear">
<!-- <a href="" class="dsf-wetChat" title="微信"><i></i></a>-->
<a href="/user/qq_login.html" class="dsf-qq" title="QQ"><i></i></a>
<!-- <a href="" class="dsf-dx" title="短信"><i></i></a>-->
</div>
</div>
</div>
</div>
</div>
</div>
</view>
</template>
<script>
var vk = uni.vk
let timer = null
let timeS = 60
export default {
data() {
return {
memberType: 'personal', // business 企业 、、personal个人
loginMethod: 'username', // username 用户名 + 密码 、、mobile 手机号 + 验证码
smsTips: '获取验证码',
form1: {
mobile: '',
password: '',
smsCode: '',
username: ''
}
};
},
methods: {
handleSubmit() {
let data = {}
const {
username,
password,
mobile,
smsCode
} = this.form1
if (this.loginMethod == 'username') {
data = {
username,
password
}
vk.userCenter.login({
loading: false,
data,
success: (data) => {
this.loginSuccess()
}
});
} else {
vk.userCenter.loginBySms({
loading: false,
data: {
mobile: mobile,
code: smsCode,
},
success: (data) => {
this.loginSuccess()
}
});
}
},
sendSmsCode() {
if (timer != null) {
return
}
vk.userCenter.sendSmsCode({
loading: false,
data: {
mobile: this.form1.mobile,
type: 'login',
},
success: (data) => {
this.$message({
message: "验证码已发送",
type: 'success'
})
timeS = 60
timer = setInterval(() => {
timeS--
if (timeS == 0) {
this.stopTimer()
this.smsTips = "重新发送"
} else {
this.smsTips = timeS + "秒"
}
}, 1000)
}
});
},
stopTimer() {
if (timer != null) {
clearInterval(timer)
timer = null
}
},
loginSuccess() {
uni.reLaunch({
url: '/'
})
}
},
onUnload() {
this.stopTimer()
}
}
</script>
<style lang="scss" scoped>
@charset "utf-8";
.login-method {
display: flex;
justify-content: space-between;
font-size: 14px;
margin-bottom: 2px;
&-item {
color: #d0111a;
cursor: pointer;
}
}
.outter-wrapper {
background-color: #fff;
}
.zg-logo img {
width: 230px;
border: none;
}
.layout-common-footer {
text-align: center;
margin: 15px 0px 10px;
}
.layout-common-footer .copyright .link>a {
color: #666;
padding: 0 10px;
display: inline-block;
line-height: 2
}
.w-1180 {
width: 1200px;
margin: 0px auto;
box-sizing: border-box;
}
.flex-h-ac {
display: flex;
align-items: center;
}
.header {
height: 90px;
}
.main-container {
min-width: 1200px;
padding: 60px 0;
background: #e8f5fd url(/static/images/login-bg.jpg)50% no-repeat;
}
.flex-h-e,
.flex-h-e-ac {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.main-container .login-container {
width: 350px;
box-sizing: border-box;
padding: 30px 35px 30px;
background-color: #fff;
}
.login-container h2 {
text-align: center;
line-height: 2;
color: #000;
font-size: 25px;
margin-bottom: 25px;
}
.btnMarymt {
height: 48px;
line-height: 48px;
background: #a92924;
color: #fff !important;
text-align: center;
width: 100%;
background: linear-gradient(90deg, #f0242e, #d0111a);
font-size: 16px;
cursor: pointer;
text-align: center;
}
.btnMarymt:hover {
background: #f12d36
}
.input-group {
width: 100%;
height: 46px;
}
.input-group-addon {}
.input-group .form-control {
flex: 1;
height: 100%;
border: none;
background: none;
margin-left: 12px;
outline: none;
font-size: 13px;
color: #333;
}
.input-group {
display: flex;
align-items: center;
border: 1px solid #d4d4d4;
margin-bottom: 15px;
position: relative;
}
.input-group-addon i {
background: url(/static/images/iconsmall.png)no-repeat center center;
width: 38px;
border-right: 1px solid #d4d4d4;
height: 26px;
overflow: hidden;
display: inline-block
}
.input-group-addon .icon_user {
background-position: -212px -35px;
}
.input-group-addon .icon_phone {
background-position: -212px -67px;
}
.input-group-addon .icon_password {
background-position: -212px -100px;
}
.input-group-addon .icon_yaoqingma {
background-position: -209px -318px;
}
.input-groupp {
width: 100%;
}
#btnSendCode1 {
position: absolute;
right: 1px;
top: 8px;
line-height: 31px;
color: #d0111a;
width: 79px;
text-align: center;
cursor: pointer;
border-left: 1px solid;
background: none;
font-size: 14px;
}
.input-group.focus {
background-color: #fff;
box-shadow: 0 2px 11px 0 rgba(0, 0, 0, .04)
}
.input-groupwp {
width: 100%;
text-align: center;
height: 60px;
line-height: 60px;
font-size: 14px;
margin-bottom: 10px;
}
.input-groupwpg a {
display: inline-block;
}
.input-groupwpg .dsf-wetChat i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -218px -132px;
}
.input-groupwpg .dsf-qq i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -216px -178px;
margin: 0px 24px;
}
.input-groupwpg .dsf-dx i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -215px -224px;
}
.threeBorder {
position: relative;
text-align: center;
}
.threeBorder:after {
content: '';
position: absolute;
z-index: 0;
bottom: 10px;
left: 10px;
width: 95%;
height: 1px;
border-bottom: 1px solid #CCCCCC;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
}
.threeBorder span {
color: #888888;
background: #fff;
width: 90px;
margin: 0 auto;
z-index: 1002;
position: relative;
display: block;
}
.input-groupwpg {
width: 100%;
text-align: center;
height: 48px;
font-size: 14px;
margin-top: 22px;
}
.login-con {
display: none;
}
.input-grouptabs span {
color: #666;
cursor: pointer;
font-size: 16px;
line-height: 23px;
font-weight: normal;
display: inline-block;
padding: 0px 18px;
text-align: center;
margin: 0px auto;
}
.input-grouptabs {
text-align: center;
margin: 0px auto 30px;
width: 100%;
}
.input-grouptabs i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 25px;
height: 25px;
float: left;
margin-right: 5px;
}
.input-grouptabs .tab-active#normal i {
background-position: -218px -269px;
}
.input-grouptabs .tab-active#nopw i {
background-position: -218px -269px;
}
.input-grouptabs #normal i {
background-position: -218px -293px;
}
.input-grouptabs #nopw i {
background-position: -218px -293px;
}
.input-grouptabs span.tab-active {
color: #a92924
}
.active {
display: block;
}
.input-groupread {
height: 40px;
line-height: 30px;
width: 100%;
text-align: left;
}
.agreement_dialogs {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
width: 100%;
height: 100%;
z-index: 99999;
text-align: center;
display: none;
background-color: rgba(35, 35, 35, 0.4);
-webkit-transition: all 0.5s linear;
transition: all 0.5s linear;
}
.agreement_dialogs .dialog_lay_1syd {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
display: inline-block;
width: 750px;
color: #656565;
font-size: 12px;
line-height: 20px;
background-color: #fff;
text-align: left;
vertical-align: middle;
-webkit-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.agreement_dialogs .dialog_foot_1hHfr {
height: 80px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
border-top: 1px solid #d5d5d5;
margin: 0;
text-align: center;
}
.agreement_dialogs .dialog_minorBtn_1u8nf {
display: inline-block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px #316ccb solid;
padding: 0 30px;
height: 40px;
background: #a92924;
background: linear-gradient(90deg, #f0242e, #d0111a);
line-height: 40px;
cursor: pointer;
font-size: 16px;
vertical-align: top;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #fff;
border-color: #fff;
}
.agreement_titley {
height: 55px;
line-height: 55px;
font-size: 16px;
color: #666;
text-align: center;
border-bottom: 1px solid #d5d5d5;
font-weight: 400;
}
.agreement_content {
margin: 23px 32px;
}
.con-subhead {
font-size: 14px;
font-weight: 500;
color: #333;
margin-bottom: 16px;
}
.con-content {
height: 240px;
overflow-y: scroll;
line-height: 2;
font-size: 13px;
}
</style>