From b5c6e17f2e9cb10ed323c1adfa2e449bab307134 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 17 一月 2025 15:15:12 +0800
Subject: [PATCH] 考核结果路由跳转、工单详情权限
---
src/views/login.vue | 78 +++++++++++++++++++++------------------
1 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index b0e0d55..82cadab 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -7,7 +7,7 @@
<div class="logo">
<img src="../assets/icons/logo.png" alt="">
</div>
- <p class="title">鑷础鍏畨澶╃綉杩愮淮骞冲彴</p>
+ <p class="title">杩愮淮鑰冩牳骞冲彴</p>
</div>
<div class="logo-wrapper">
<img src="../assets/svg/login-box-bg.svg" alt="">
@@ -18,28 +18,28 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<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" />
+ <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" />
+ @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" />
+ @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" />
+ <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">
+ @click.native.prevent="handleLogin">
<span v-if="!loading">鐧� 褰�</span>
<span v-else>鐧� 褰� 涓�...</span>
</el-button>
@@ -49,13 +49,10 @@
</el-form-item>
</el-form>
</div>
- <el-dialog title="涓轰簡鎮ㄧ殑璐﹀彿瀹夊叏,棣栨鐧婚檰璇蜂慨鏀瑰瘑鐮�" :visible.sync="loginInfo.firstLogin == 0">
+ <el-dialog title="涓轰簡鎮ㄧ殑璐﹀彿瀹夊叏,棣栨鐧婚檰璇蜂慨鏀瑰瘑鐮�" :modal="false" width="500px" :visible.sync="loginInfo.firstLogin == 0">
<el-form>
<el-form-item label="鏂板瘑鐮�">
- <el-input v-model="newPassword" autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="璇风‘璁ゅ瘑鐮�">
- <el-input v-model="confirmPassword" autocomplete="off"></el-input>
+ <el-input v-model="newPassword" show-password autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -70,10 +67,10 @@
</template>
<script>
-import { getCodeImg, getInfo } from "@/api/login";
+import {getCodeImg, getInfo} from "@/api/login";
import Cookies from "js-cookie";
-import { encrypt, decrypt } from '@/utils/jsencrypt'
-import { updateUserPwd } from "@/api/system/user";
+import {encrypt, decrypt} from '@/utils/jsencrypt'
+import {updateUserPwd} from "@/api/system/user";
export default {
//鏂板瀵硅薄銆佸彉閲�
@@ -90,8 +87,7 @@
var regex = /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[\W_])/;
if (value.length < 8 || value.length > 10) {
callback(new Error('璇疯緭鍏�8-10浣嶅ぇ鍐欏瓧姣�+灏忓啓瀛楁瘝+鏁板瓧+鐗规畩瀛楃'));
- }
- else if (!regex.test(value)) {
+ } else if (!regex.test(value)) {
callback(new Error("璇疯緭鍏�8-10浣嶅ぇ鍐欏瓧姣�+灏忓啓瀛楁瘝+鏁板瓧+鐗规畩瀛楃"));
} else {
callback();
@@ -100,8 +96,8 @@
return {
codeUrl: "",
loginForm: {
- username: "admin",
- password: "admin123",
+ username: "",
+ password: "",
rememberMe: false,
code: "",
uuid: ""
@@ -109,25 +105,26 @@
loginInfo: {
firstLogin: 1
},
+ roles:[],
newPassword: undefined,
confirmPassword: undefined,
loginRules: {
username: [
- { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }
+ {required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�"}
],
password: [
- { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" }
+ {required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�"}
],
- code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }]
+ code: [{required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜"}]
},
rules: {
newPassword: [
- { required: true, message: "鏂板瘑鐮佷笉鑳戒负绌�", trigger: "blur" },
- { required: true, validator: validatePassword, trigger: "blur" }
+ {required: true, message: "鏂板瘑鐮佷笉鑳戒负绌�", trigger: "blur"},
+ {required: true, validator: validatePassword, trigger: "blur"}
],
confirmPassword: [
- { required: true, message: "纭瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
- { required: true, validator: equalToPassword, trigger: "blur" }
+ {required: true, message: "纭瀵嗙爜涓嶈兘涓虹┖", trigger: "blur"},
+ {required: true, validator: equalToPassword, trigger: "blur"}
]
},
loading: false,
@@ -177,9 +174,9 @@
this.loading = true;
if (this.loginForm.rememberMe) {
- Cookies.set("username", this.loginForm.username, { expires: 30 });
- Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
- Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
+ Cookies.set("username", this.loginForm.username, {expires: 30});
+ Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
+ Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
} else {
Cookies.remove("username");
Cookies.remove("password");
@@ -189,15 +186,24 @@
this.$store.dispatch("Login", this.loginForm).then((res) => {
getInfo().then(loginInfo => {
this.loginInfo = loginInfo.user
+ this.roles = loginInfo.roles
//濡傛灉杩斿洖涓�1姝e父璺宠浆
if (this.loginInfo.firstLogin == 1) {
- this.$router.push({ path: "/" }).catch(() => { });
- return;
- this.$router.push({ path: this.redirect || "/" }).catch(() => { });
+ // this.$router.push({ path: "/" }).catch(() => { });
+ // return;
+ if (this.roles .includes("admin") || this.roles .includes("city_leader")) {
+ this.$router.push({
+ path: '/screen'
+ })
+ } else {
+ this.$router.push({path: this.redirect || "/index"}).catch(() => {
+ });
+ }
} else {
localStorage.setItem('firstLogin', 0)
}
- }).catch(() => { })
+ }).catch(() => {
+ })
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
@@ -213,7 +219,8 @@
// 淇敼瀹屾垚灏唂irstLogin鏀逛负1
localStorage.setItem('firstLogin', 1)
this.$modal.msgSuccess("淇敼鎴愬姛");
- this.$router.push({ path: this.redirect || "/" }).catch(() => { });
+ this.$router.push({path: this.redirect || "/"}).catch(() => {
+ });
}).catch((e) => {
console.info(e)
});
@@ -322,7 +329,6 @@
animation-delay: 0.1s;
}
}
-
.login-form {
--
Gitblit v1.8.0