注册开发

This commit is contained in:
hanchaobo
2024-04-22 18:13:09 +08:00
parent d07ba431c5
commit aef3c0f53f
2 changed files with 82 additions and 59 deletions
+74 -58
View File
@@ -10,61 +10,46 @@
</div>
<!-- 右侧 -->
<div class="rightBox">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h2 class="title">用户登录</h2>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</el-form>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h2 class="title">用户登录</h2>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img" />
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<!-- <el-button type="text" @click="registrationLink('/register')">立即注册</el-button> -->
</div>
<!-- <div class="registerImg">
<div id="qrcodeImg"></div>
</div> -->
</el-form-item>
</el-form>
</div>
<!-- 底部 -->
<div class="el-login-footer">
<div>Copyright © 2023 乙巢(上海)企业管理服务有限公司.</div>
@@ -74,8 +59,9 @@
</template>
<script>
import { getCodeImg } from "@/api/login";
import { getCodeImg, selectIdentityAuthenticaEIDtoken } from "@/api/login";
import Cookies from "js-cookie";
import QRCode from "qrcodejs2";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
@@ -109,7 +95,7 @@ export default {
},
watch: {
$route: {
handler: function(route) {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
@@ -153,7 +139,7 @@ export default {
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
@@ -162,6 +148,21 @@ export default {
});
}
});
},
registrationLink(path) {
selectIdentityAuthenticaEIDtoken().then(res => {
console.log(res)
document.getElementById("qrcodeImg").innerHTML = "";
return new QRCode("qrcodeImg", {
width: 200,
height: 200,
text: url,
colorDark: "#000",
colorLight: "#fff",
});
})
// this.$router.push(path);
console.log("注册链接")
}
}
};
@@ -173,23 +174,28 @@ export default {
justify-content: center;
align-items: center;
height: 100%;
.leftBox {
width: 50%;
height: 90%;
.leftIcon {
height: 20%;
width: 100%;
margin: 0% 10% 1% 15%;
.Icon {
width: 100px;
height: 105px;
background-image: url("../assets/images/logos.png");
background-size: cover;
}
div {
font-size: 18px;
}
}
.leftImage {
width: 100%;
height: 90%;
@@ -199,7 +205,7 @@ export default {
background-size: cover;
}
}
.rightBox {
width: 50%;
height: 90%;
@@ -208,6 +214,7 @@ export default {
align-items: center;
}
}
.title {
margin: 0px auto 30px auto;
text-align: center;
@@ -220,32 +227,39 @@ export default {
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
background-color: rgb(126, 131, 135);
height: 55px;
@@ -258,10 +272,12 @@ export default {
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
div {
height: 30%;
}
}
.login-code-img {
height: 38px;
}