|
@@ -67,18 +67,18 @@
|
|
|
<script>
|
|
|
import Identify from "./identify.vue";
|
|
|
import Dialog from "@/layout/components/Dialog/index.vue";
|
|
|
-import { GetCheckCode, gettoken } from "@/api/login";
|
|
|
-import { GetSystemSet } from "@/api/systemConfiguration";
|
|
|
-import { setCodeToken } from '@/utils/auth';
|
|
|
+import { GetCheckCode, gettoken, GetSystemSet } from "@/api/newLogin";
|
|
|
+import { Query } from "@/api/dataIntegration";
|
|
|
+// import { GetCheckCode, gettoken,GetSystemSet } from "@/api/login";
|
|
|
+// import { GetSystemSet } from "@/api/systemConfiguration";
|
|
|
+import { setCodeToken, setToken, TokenKey, getCodeToken } from '@/utils/auth';
|
|
|
import { getAuthListByUser } from '@/api/Account';
|
|
|
-import { setToken } from '@/utils/auth';
|
|
|
-import router from '@/router'
|
|
|
export default {
|
|
|
name: "Login",
|
|
|
components: { Identify, Dialog },
|
|
|
data () {
|
|
|
return {
|
|
|
- text:`<a onclick='("XSS")'>链接</a>`,
|
|
|
+ text: `<a onclick='("XSS")'>链接</a>`,
|
|
|
type: 1,
|
|
|
flag: false,
|
|
|
PwdMessage: null,
|
|
@@ -109,16 +109,25 @@ export default {
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
+ '$store.state.user.isLogin': {
|
|
|
+ handler (val) {
|
|
|
+ if (val) {
|
|
|
+ this.noPwdLogin()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
},
|
|
|
async created () {
|
|
|
// this.getCheckCode();
|
|
|
// this.getSystemSet();
|
|
|
try {
|
|
|
const res = await gettoken({
|
|
|
- 'appID': PLATFROM_CONFIG.appId
|
|
|
+ 'appid': PLATFROM_CONFIG.appId,
|
|
|
+ 'appSecret': PLATFROM_CONFIG.appSecret
|
|
|
})
|
|
|
- if (res.code == 0 && res.returnData.token) {
|
|
|
- setCodeToken(res.returnData.token);
|
|
|
+ if (res.code == 0 && res.data) {
|
|
|
+ setCodeToken(res.data);
|
|
|
setTimeout(() => {
|
|
|
this.getCheckCode();
|
|
|
this.getSystemSet();
|
|
@@ -141,35 +150,53 @@ export default {
|
|
|
this.$refs.password.focus();
|
|
|
});
|
|
|
},
|
|
|
+ //免密登录
|
|
|
+ noPwdLogin () {
|
|
|
+ this.$store.dispatch("user/setPowerToken", "token");
|
|
|
+ this.$store.dispatch("user/setPowerName", '匿名用户');
|
|
|
+ this.$store.dispatch("app/toggleOutcheck", false);
|
|
|
+ this.$store.dispatch('user/setPowerList', ['admin']);
|
|
|
+ setToken(TokenKey, "token");
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$store.dispatch('user/getInfo');
|
|
|
+ sessionStorage.setItem('userAuthList', JSON.stringify(['admin']));
|
|
|
+ sessionStorage.setItem("userName", '匿名用户');
|
|
|
+ this.$router.push({ path: this.redirect || "/" });
|
|
|
+ this.$store.dispatch("user/setIsLogin", false);
|
|
|
+ }, 100);
|
|
|
+ },
|
|
|
// 登录
|
|
|
handleLogin () {
|
|
|
this.$refs.loginForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
const params = {
|
|
|
- LoginName: this.loginForm.username.replace(/\s+/g, ""),
|
|
|
- LoginPwd: this.loginForm.password.replace(/\s+/g, ""),
|
|
|
- CheckCode: this.loginForm.identify.replace(/\s+/g, ""),
|
|
|
+ username: this.loginForm.username.replace(/\s+/g, ""),
|
|
|
+ password: this.loginForm.password.replace(/\s+/g, ""),
|
|
|
+ verificationCode: this.loginForm.identify.replace(/\s+/g, ""),
|
|
|
};
|
|
|
this.$store
|
|
|
.dispatch("user/login", params)
|
|
|
.then(() => {
|
|
|
this.$store.dispatch("app/toggleOutcheck", false);
|
|
|
- sessionStorage.setItem("userName", params.LoginName);
|
|
|
+ sessionStorage.setItem("userName", params.username);
|
|
|
setTimeout(() => {
|
|
|
const UserId = this.$store.getters.UserId;
|
|
|
- const UserType = this.$store.getters.UserType;
|
|
|
- getAuthListByUser({
|
|
|
- UserId: UserId,
|
|
|
- UserType: UserType
|
|
|
+ // const UserType = this.$store.getters.UserType;
|
|
|
+ Query({
|
|
|
+ id: 128,
|
|
|
+ dataContent: [UserId]
|
|
|
}).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
//res.returnData.push('account_menu');
|
|
|
- const datas = res.returnData
|
|
|
+ const { listValues } = res.returnData
|
|
|
+ const datas = listValues
|
|
|
if (datas && datas.length) {
|
|
|
const arrs = [];
|
|
|
for (const item of datas) {
|
|
|
- arrs.push(item.AuthIdent);
|
|
|
+ if (item.ident) {
|
|
|
+ arrs.push(item.ident);
|
|
|
+ }
|
|
|
}
|
|
|
// arrs.push('transit');
|
|
|
sessionStorage.setItem('userAuthList', JSON.stringify(arrs));
|
|
@@ -209,9 +236,11 @@ export default {
|
|
|
},
|
|
|
//获取动态验证码
|
|
|
async getCheckCode () {
|
|
|
- const res = await GetCheckCode({});
|
|
|
- if (res.code === 0) {
|
|
|
- this.loginForm.CheckCode = res.returnData;
|
|
|
+ const res = await GetCheckCode({
|
|
|
+ code: getCodeToken()
|
|
|
+ });
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.loginForm.CheckCode = res.data;
|
|
|
} else {
|
|
|
this.$message.error(res.message);
|
|
|
}
|
|
@@ -220,10 +249,11 @@ export default {
|
|
|
getSystemSet () {
|
|
|
GetSystemSet({})
|
|
|
.then((response) => {
|
|
|
- const { returnData } = response;
|
|
|
- const { PwdMessage } = returnData;
|
|
|
- this.PwdMessage = PwdMessage;
|
|
|
- this.$store.dispatch("app/getSystemSet", returnData);
|
|
|
+ const { code, data, message } = response;
|
|
|
+ if (code == 0) {
|
|
|
+ this.$store.dispatch("app/getSystemSet", data);
|
|
|
+ }
|
|
|
+ this.PwdMessage = message;
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
reject(error);
|