123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <div class="bg">
- <!-- <header class="login-header">
- <img v-if="!jwptCustomize" src="../assets/images/login_footer_logo.jpg" />
- <img v-else src="../assets/images/new_login_logo.png" />
- <span class="qm-logo-text" v-if="!jwptCustomize">考试云平台</span>
- <span class="qm-logo-text" v-else>{{ title }}</span>
- </header> -->
- <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="2" style="padding: 5px 0px; z-index: 3;" />
- <input
- @keyup.enter="login"
- type="text"
- id="accountValue"
- v-model="loginInfo.accountValue"
- placeholder="请输入账号"
- />
- </div>
- <div class="password">
- <v-icon name="lock" scale="2" style="padding: 5px 0px; z-index: 3;" />
- <input
- @keyup.enter="login"
- type="password"
- id="password"
- v-model="loginInfo.password"
- placeholder="请输入密码"
- />
- </div>
- <button class="login-btn" @click="login">登 录</button>
- </div>
- <footer class="login-footer">
- Copyright © 2019 <a href="javascript:void(0)">讯飞启明</a>.
- </footer>
- </main>
- <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
- <input
- @keyup.enter="loginWithSms"
- type="number"
- v-model="loginInfo.smsCode"
- style="width: 80%"
- placeholder="请向王伟咨询手机验证码"
- />
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="loginWithSms">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import { mapActions } from "vuex";
- import { USER_SIGNIN } from "../store/user";
- import { CORE_API } from "@/constants/constants";
- export default {
- data() {
- return {
- errorInfo: "",
- title: "考试云平台",
- jwptCustomize: false,
- dialogVisible: false,
- loginInfo: {
- rootOrgId: "",
- domain: "",
- accountType: "COMMON_LOGIN_NAME",
- accountValue: "",
- password: "",
- smsCode: null
- }
- };
- },
- methods: {
- ...mapActions([USER_SIGNIN]),
- 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;
- },
- 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 = CORE_API + "/auth/login";
- this.$httpWithMsg
- .post(url, this.loginInfo)
- .then(response => {
- var user = response.data;
- this.USER_SIGNIN(user);
- this.$router.replace({ path: "/home/overview" });
- this.$notify({
- message: "登录成功",
- type: "success",
- duration: 1000
- });
- })
- .catch(error => {
- if (error.response.data.code === "B-001100") {
- this.dialogVisible = true;
- }
- });
- },
- loginWithSms() {
- this.dialogVisible = false;
- this.login();
- },
- jwptCustomizeMethod() {
- // 普通高校考试综合管理平台 定制
- if (location.host === "jwpt.ecs.qmth.com.cn") {
- document.title = "普通高校-题库";
- this.title = " | 普通高校-题库";
- this.jwptCustomize = true;
- }
- }
- },
- created() {
- if (this.$route.hash && this.$route.hash.startsWith("#/access?")) {
- this.$router.push(this.$route.hash.slice(1));
- return;
- }
- this.loginInfo.domain = window.location.host;
- sessionStorage.clear();
- var params = this.$route.query;
- this.loginInfo.rootOrgId = params.orgId;
- this.jwptCustomizeMethod();
- },
- watch: {
- $route(to) {
- this.loginInfo.rootOrgId = to.query.orgId;
- }
- }
- };
- </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;
- }
- .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 {
- height: 46px;
- display: flex;
- align-items: center;
- justify-items: center;
- }
- .right_login .password {
- height: 46px;
- display: flex;
- align-items: center;
- justify-items: center;
- margin-top: 30px;
- }
- .right_login input {
- width: 100%;
- padding: 10px 30px;
- margin-left: -28px;
- font-size: 16px;
- border-radius: 10px;
- }
- .right_login input::placeholder {
- font-size: 16px;
- color: #000000;
- opacity: 0.3;
- }
- .login-btn {
- margin-top: 30px;
- 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>
|