更新
This commit is contained in:
@ -15,9 +15,6 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="password1">
|
||||
<!-- <span class="svg-container">
|
||||
<svg-icon icon="password" />
|
||||
</span> -->
|
||||
<el-input placeholder="请输入密码" name="password" :type="passwordType" v-model="loginForm.password">
|
||||
<template #prepend>
|
||||
<span class="svg-container">
|
||||
@ -48,8 +45,7 @@
|
||||
|
||||
<!---登录按钮-->
|
||||
<el-form-item style="height: 49px" v-if="!loginDialog">
|
||||
<el-button @click="handleLogin" type="primary" style="width: 520px; height: 49px" :loading="loading"
|
||||
native-type="submit">登录</el-button>
|
||||
<el-button @click="handleLogin" type="primary" style="width: 520px; height: 49px" :loading="loading" native-type="submit">登录</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="choosedept-wrap" v-if="loginDialog">
|
||||
@ -68,6 +64,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<script setup>
|
||||
import { qcckPost } from "@/api/qcckApi.js";
|
||||
import { setItem } from "@/utils/storage";
|
||||
import { ElNotification } from "element-plus";
|
||||
import * as MOSTY from "@/components/MyComponents/index";
|
||||
@ -100,19 +97,14 @@ const loginRules = ref({
|
||||
kaptcha: [{ required: true, trigger: "blur", message: "验证码为必填项" }]
|
||||
});
|
||||
|
||||
const handleClose = () => { };
|
||||
const refreshToken = (e) => {
|
||||
store
|
||||
.dispatch("user/refreshToken", { deptId: e, jwtToken: authorization.value })
|
||||
.then((res) => {
|
||||
loading.value = false;
|
||||
store.commit("user/setDeptId", e);
|
||||
// window.location.href = '/'// 登录后操作
|
||||
router.push("/");
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
store.dispatch("user/refreshToken", { deptId: e, jwtToken: authorization.value }).then((res) => {
|
||||
loading.value = false;
|
||||
store.commit("user/setDeptId", e);
|
||||
router.push("/");
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
// 处理密码框文本显示状态
|
||||
const passwordType = ref("password");
|
||||
@ -131,41 +123,38 @@ const router = useRouter();
|
||||
const handleLogin = () => {
|
||||
loginFromRef.value.validate((valid) => {
|
||||
if (!valid) return false;
|
||||
// setItem("token", "1255555888");
|
||||
// setItem("isOatuh", 0);
|
||||
// router.push("/");
|
||||
loading.value = true;
|
||||
store
|
||||
.dispatch("user/login", loginForm.value)
|
||||
.then((res) => {
|
||||
loading.value = false;
|
||||
// 登录后操作;
|
||||
if (res.deptList.length === 1) {
|
||||
window.location.href = "/";
|
||||
} else {
|
||||
deptList.value = [...res.deptList];
|
||||
loginDialog.value = true;
|
||||
authorization.value = res.jwtToken;
|
||||
ElNotification({
|
||||
title: "提示",
|
||||
message: "请选择部门",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
store.dispatch("user/login", loginForm.value).then((res) => {
|
||||
loading.value = false;
|
||||
if (res.deptList.length === 1) {
|
||||
getSfzhByGsid(res.idEntityCard)
|
||||
} else {
|
||||
deptList.value = [...res.deptList];
|
||||
loginDialog.value = true;
|
||||
authorization.value = res.jwtToken;
|
||||
ElNotification({ title: "提示", message: "请选择部门", duration: 3000});
|
||||
}
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
const logout = () => {
|
||||
store.dispatch("user/logout");
|
||||
};
|
||||
const getSfzhByGsid = (sfzh) => {
|
||||
qcckPost({ sfzh }, "/mosty-base/baxx/cyry/queryBySfzh").then(res=>{
|
||||
if(!res) {
|
||||
ElNotification({ title: "提示", message: "无访问权限", duration: 3000});
|
||||
store.dispatch("user/logout");
|
||||
}else{
|
||||
let obj = { sfzh:res.sfzh , xm:res.xm , pxgs:res.pxgs , pxgsid:res.pxgsid }
|
||||
setItem("userInfo", JSON.stringify(obj));
|
||||
window.location.href = "/";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => { });
|
||||
const getKaptchaImg = () => {
|
||||
const res =
|
||||
`${process.env.VUE_APP_GATEWAY_BASE_URL}/mosty-base/kaptcha?date=` +
|
||||
new Date();
|
||||
const res = `${process.env.VUE_APP_GATEWAY_BASE_URL}/mosty-base/kaptcha?date=` + new Date();
|
||||
kaptchaUrl.value = res;
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user