|
@@ -1,62 +1,55 @@
|
|
|
<template>
|
|
|
- <div class="bg">
|
|
|
+ <div class="login">
|
|
|
<main class="login-main">
|
|
|
- <!-- <img class="left_tree" src="../assets/images/login_main_left_tree.png" /> -->
|
|
|
-
|
|
|
- <div class="logo-text">题库</div>
|
|
|
- <div class="right_login">
|
|
|
- <h1 style="font-size: 20px; color: #666">欢迎登录</h1>
|
|
|
- <div class="username">
|
|
|
- <v-icon
|
|
|
- name="user"
|
|
|
- scale="1.4"
|
|
|
- style="padding: 5px 0px; z-index: 3"
|
|
|
- />
|
|
|
- <input
|
|
|
- id="accountValue"
|
|
|
- v-model="loginInfo.accountValue"
|
|
|
- type="text"
|
|
|
- placeholder="请输入账号"
|
|
|
- @keyup.enter="login"
|
|
|
- @change="nameChange"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="password">
|
|
|
- <v-icon
|
|
|
- name="lock"
|
|
|
- scale="1.4"
|
|
|
- style="padding: 5px 0px; z-index: 3"
|
|
|
- />
|
|
|
- <input
|
|
|
- id="password"
|
|
|
- v-model="loginInfo.password"
|
|
|
- type="password"
|
|
|
- placeholder="请输入密码"
|
|
|
- @keyup.enter="login"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="smscode">
|
|
|
- <v-icon
|
|
|
- v-if="dialogVisible"
|
|
|
- name="lock"
|
|
|
- scale="1.4"
|
|
|
- style="padding: 5px 0px; z-index: 3"
|
|
|
- />
|
|
|
- <input
|
|
|
- v-if="dialogVisible"
|
|
|
- id="smsCode"
|
|
|
- v-model="loginInfo.smsCode"
|
|
|
- type="text"
|
|
|
- placeholder="请输入短信验证码"
|
|
|
- @keyup.enter="login"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <button class="login-btn" @click="login">登 录</button>
|
|
|
+ <div class="login-title">
|
|
|
+ <p>欢迎登录</p>
|
|
|
+ <p>题库管理系统</p>
|
|
|
+ </div>
|
|
|
+ <div class="login-footer">
|
|
|
+ Copyright © 2021 <a href="https://www.qmth.com.cn">启明泰和</a>.
|
|
|
+ </div>
|
|
|
+ <div class="login-body" @keyup.enter="submit">
|
|
|
+ <h1 class="login-body-title">题库管理系统</h1>
|
|
|
+ <el-form ref="loginForm" :model="loginInfo" :rules="loginRules">
|
|
|
+ <el-form-item prop="accountValue">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="loginInfo.accountValue"
|
|
|
+ placeholder="请输入账号"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <i slot="prefix" class="icon icon-username"></i>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="password">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="loginInfo.password"
|
|
|
+ type="password"
|
|
|
+ placeholder="请输入密码"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <i slot="prefix" class="icon icon-password"></i>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="dialogVisible" prop="smsCode">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="loginInfo.smsCode"
|
|
|
+ placeholder="请输入短信验证码"
|
|
|
+ clearable=""
|
|
|
+ >
|
|
|
+ <i slot="prefix" class="icon icon-code"></i>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ class="login-submit-btn"
|
|
|
+ type="danger"
|
|
|
+ :disabled="isSubmit"
|
|
|
+ @click="submit"
|
|
|
+ >登录</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
- <footer class="login-footer">
|
|
|
- Copyright © 2021
|
|
|
- <a href="https://www.qmth.com.cn">启明泰和</a>.
|
|
|
- </footer>
|
|
|
</main>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -69,9 +62,7 @@ import { QUESTION_API } from "@/constants/constants";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- errorInfo: "",
|
|
|
- title: "题库",
|
|
|
- jwptCustomize: false,
|
|
|
+ isSubmit: false,
|
|
|
dialogVisible: false,
|
|
|
loginInfo: {
|
|
|
rootOrgId: "",
|
|
@@ -81,6 +72,30 @@ export default {
|
|
|
password: "",
|
|
|
smsCode: null,
|
|
|
},
|
|
|
+ loginRules: {
|
|
|
+ accountValue: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入用户名",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ password: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ pattern: /^[a-zA-Z0-9_]{6,20}$/,
|
|
|
+ message: "密码只能由数字、字母和下划线组成,长度6-20个字符",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ smsCode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入短信验证码",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -102,48 +117,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions([USER_SIGNIN]),
|
|
|
- nameChange() {
|
|
|
- // this.dialogVisible = false;
|
|
|
- },
|
|
|
- checkAccountValue() {
|
|
|
- this.errorInfo = "";
|
|
|
- if (!this.loginInfo.accountValue) {
|
|
|
- this.errorInfo += "账号不能为空!\n";
|
|
|
- }
|
|
|
- if (this.errorInfo) {
|
|
|
- this.$notify({
|
|
|
- showClose: true,
|
|
|
- message: this.errorInfo,
|
|
|
- type: "error",
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
+ async submit() {
|
|
|
+ const valid = await this.$refs.loginForm.validate().catch(() => {});
|
|
|
+ if (!valid) return;
|
|
|
|
|
|
- checkPassword() {
|
|
|
- this.errorInfo = "";
|
|
|
- if (!this.loginInfo.password) {
|
|
|
- this.errorInfo += "密码不能为空!\n";
|
|
|
- }
|
|
|
- if (this.errorInfo) {
|
|
|
- this.$notify({
|
|
|
- showClose: true,
|
|
|
- message: this.errorInfo,
|
|
|
- type: "error",
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
-
|
|
|
- login() {
|
|
|
- if (!this.checkAccountValue()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!this.checkPassword()) {
|
|
|
- return;
|
|
|
- }
|
|
|
var url = QUESTION_API + "/auth/login";
|
|
|
this.$httpWithMsg
|
|
|
.post(url, this.loginInfo)
|
|
@@ -165,134 +142,8 @@ export default {
|
|
|
},
|
|
|
loginWithSms() {
|
|
|
this.dialogVisible = false;
|
|
|
- this.login();
|
|
|
+ this.submit();
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-.bg {
|
|
|
- width: 100vw;
|
|
|
- height: 100vh;
|
|
|
- background-image: url("../assets/images/bg.jpg");
|
|
|
- background-size: cover;
|
|
|
-}
|
|
|
-
|
|
|
-.qm-logo-text {
|
|
|
- font-size: 36px;
|
|
|
- font-weight: 700;
|
|
|
- font-stretch: normal;
|
|
|
- line-height: 36px;
|
|
|
- letter-spacing: 0px;
|
|
|
- margin-left: 40px;
|
|
|
-}
|
|
|
-
|
|
|
-.logo-text {
|
|
|
- /* font-family: "Xingkai SC", "STXingkai", "KaiTi"; */
|
|
|
- width: 100%;
|
|
|
- height: 40px;
|
|
|
- font-size: 40px;
|
|
|
- margin-bottom: 30px;
|
|
|
- font-weight: bold;
|
|
|
- font-stretch: normal;
|
|
|
- line-height: 48px;
|
|
|
- letter-spacing: 0px;
|
|
|
- color: #3968d7;
|
|
|
- text-shadow: 0px 7px 4px rgba(77, 124, 196, 0.3);
|
|
|
- text-align: center;
|
|
|
- letter-spacing: 0.2em;
|
|
|
-}
|
|
|
-
|
|
|
-.login-main {
|
|
|
- width: 100%;
|
|
|
- height: 90vh;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
-}
|
|
|
-
|
|
|
-.right_login {
|
|
|
- width: 480px;
|
|
|
- height: 330px;
|
|
|
- background-color: #ffffff;
|
|
|
- box-shadow: 0px 7px 20px 0px rgba(77, 124, 196, 0.1);
|
|
|
- border-radius: 38px;
|
|
|
- opacity: 0.8;
|
|
|
- padding: 0 80px;
|
|
|
-}
|
|
|
-
|
|
|
-.right_login h1 {
|
|
|
- text-align: center;
|
|
|
- height: 20px;
|
|
|
- font-size: 20px;
|
|
|
- font-weight: normal;
|
|
|
- font-stretch: normal;
|
|
|
- line-height: 24px;
|
|
|
- letter-spacing: 0px;
|
|
|
- color: #666666;
|
|
|
- margin: 30px 0;
|
|
|
-}
|
|
|
-
|
|
|
-.right_login .username {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-items: center;
|
|
|
-}
|
|
|
-.right_login .password {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-items: center;
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-.right_login .smscode {
|
|
|
- height: 38px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-items: center;
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.right_login input {
|
|
|
- width: 100%;
|
|
|
- padding: 5px 30px;
|
|
|
- margin-left: -21px;
|
|
|
- font-size: 16px;
|
|
|
- border-radius: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.right_login input::placeholder {
|
|
|
- font-size: 16px;
|
|
|
- color: #000000;
|
|
|
- opacity: 0.3;
|
|
|
-}
|
|
|
-
|
|
|
-.login-btn {
|
|
|
- margin-top: 20px;
|
|
|
- margin-bottom: 20px;
|
|
|
- width: 100%;
|
|
|
- background-color: #4d7cc4;
|
|
|
- font-size: 25px;
|
|
|
- color: #fff;
|
|
|
- cursor: pointer;
|
|
|
- border-radius: 27px;
|
|
|
-}
|
|
|
-
|
|
|
-.login-btn:hover {
|
|
|
- box-shadow: 0 16px 29px rgba(29, 170, 240, 0.3);
|
|
|
-}
|
|
|
-
|
|
|
-.login-footer {
|
|
|
- clear: both;
|
|
|
- width: 240px;
|
|
|
- height: 40px;
|
|
|
- line-height: 40px;
|
|
|
- background-color: #fff;
|
|
|
- color: #999999;
|
|
|
- margin: -20px auto;
|
|
|
- text-align: center;
|
|
|
- border-radius: 25px;
|
|
|
- z-index: 3;
|
|
|
-}
|
|
|
-</style>
|