|
@@ -4,29 +4,43 @@
|
|
|
<div class="close-icon-box">
|
|
|
<i class="el-icon-circle-close close-icon" @click="$emit('callback')"></i>
|
|
|
</div>
|
|
|
- <div class="login-form">
|
|
|
+ <div class="login-form">
|
|
|
+ <div class="login-tab" :class="{
|
|
|
+ active1:nowTab.id === 1,
|
|
|
+ active2:nowTab.id === 2
|
|
|
+ }">
|
|
|
+ <div class="tab-item" :class="{
|
|
|
+ active:nowTab.id === tab.id
|
|
|
+ }" v-for="(tab, index) in tabs" :key="index" @click="nowTab = tab">
|
|
|
+ {{ tab.name }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<el-form :model="loginForm" :rules="loginRules" status-icon ref="loginForm" label-position="left">
|
|
|
<el-form-item prop="phone">
|
|
|
<el-input type="text" prefix-icon="iconfont huifont-shoujihao" v-model="loginForm.phone"
|
|
|
placeholder="手机号" maxlength="11">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="code" class="image-item">
|
|
|
- <el-input type="text" prefix-icon="iconfont huifont-tuxingyanzhengma" v-model="loginForm.code"
|
|
|
- placeholder="图片验证码" maxlength="4"></el-input>
|
|
|
- <img v-if="codeImg" :src="codeImg" alt="图片验证码" class="code-image" @click="imgCodeFunc">
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="phoneCode" class="phone-code">
|
|
|
- <el-input type="number" prefix-icon="iconfont huifont-duanxinyanzhengma"
|
|
|
- v-model="loginForm.phoneCode" placeholder="短信验证码"
|
|
|
- oninput="if(value.length > 6) value=value.slice(0, 6)">
|
|
|
- </el-input>
|
|
|
- <div class="get-code-btn">
|
|
|
- <el-button type="primary" size="samll" @click="getPhoneCode"
|
|
|
- :disabled="codeName !== '获取验证码'">
|
|
|
- {{codeName}}
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
+ <el-form-item prop="code" class="image-item" v-if="nowTab.id === 1">
|
|
|
+ <el-input type="text" prefix-icon="iconfont huifont-tuxingyanzhengma" v-model="loginForm.code"
|
|
|
+ placeholder="图片验证码" maxlength="4"></el-input>
|
|
|
+ <img v-if="codeImg" :src="codeImg" alt="图片验证码" class="code-image" @click="imgCodeFunc">
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="phoneCode" class="phone-code" v-if="nowTab.id === 1">
|
|
|
+ <el-input type="number" prefix-icon="iconfont huifont-duanxinyanzhengma"
|
|
|
+ v-model="loginForm.phoneCode" placeholder="短信验证码"
|
|
|
+ oninput="if(value.length > 6) value=value.slice(0, 6)">
|
|
|
+ </el-input>
|
|
|
+ <div class="get-code-btn">
|
|
|
+ <el-button type="primary" size="samll" @click="getPhoneCode" :disabled="codeName !== '获取验证码'">
|
|
|
+ {{codeName}}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="password" v-if="nowTab.id === 2">
|
|
|
+ <el-input type="password" prefix-icon="iconfont huifont-mima" v-model="loginForm.password"
|
|
|
+ :show-password="true" placeholder="请输入密码">
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-button class="submit" type="primary" @click="loginSubmit" :loading="loginLoading">登录</el-button>
|
|
@@ -53,7 +67,8 @@
|
|
|
loginForm: {
|
|
|
phone: '',
|
|
|
code: '',
|
|
|
- phoneCode: ''
|
|
|
+ phoneCode: '',
|
|
|
+ password: ''
|
|
|
},
|
|
|
loginLoading: false,
|
|
|
codeImg: '',
|
|
@@ -84,7 +99,18 @@
|
|
|
message: '请输入短信验证码',
|
|
|
trigger: 'blur'
|
|
|
}]
|
|
|
- },
|
|
|
+ },
|
|
|
+ tabs: [{
|
|
|
+ id: 1,
|
|
|
+ name: '验证码登录'
|
|
|
+ }, {
|
|
|
+ id: 2,
|
|
|
+ name: '账号密码登录'
|
|
|
+ }],
|
|
|
+ nowTab: {
|
|
|
+ id: 1,
|
|
|
+ name: '验证码登录'
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -182,7 +208,48 @@
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .login-tab {
|
|
|
+ display: flex;
|
|
|
+ border: 1px solid #bebebe;
|
|
|
+ margin-bottom: 28px;
|
|
|
+ height: 36px;
|
|
|
+ border-radius: 4px;
|
|
|
+ align-items: center;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &:before {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ background: #bebebe;
|
|
|
+ width: 159px;
|
|
|
+ height: 28px;
|
|
|
+ border-radius: 4px;
|
|
|
+ z-index: 8;
|
|
|
+ transition: left 0.3s;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active1:before {
|
|
|
+ left: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active2:before {
|
|
|
+ left: 167px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .tab-item {
|
|
|
+ flex: 1;
|
|
|
+ text-align: center;
|
|
|
+ z-index: 9;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: color 0.3s;
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.website-login-box {
|
|
|
width: 100%;
|
|
|
height: 100%;
|