|
@@ -1,5 +1,3 @@
|
|
|
-
|
|
|
-
|
|
|
<template>
|
|
|
<div class="app">
|
|
|
<div class="header">
|
|
@@ -23,10 +21,11 @@ import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
|
|
import dayjs from 'dayjs';
|
|
|
import 'dayjs/locale/zh-cn';
|
|
|
import http from "@/utils/http";
|
|
|
+import { useUserStore } from '@/stores';
|
|
|
dayjs.locale('zh-cn');
|
|
|
|
|
|
const locale = ref(zhCN)
|
|
|
-
|
|
|
+const store = useUserStore();
|
|
|
onBeforeMount(() => {
|
|
|
document.title = window?.AppGlobalConfig?.system?.name || '';
|
|
|
})
|
|
@@ -46,6 +45,7 @@ const getUrlParamByToken = () => {
|
|
|
if(isLogin === '1') return
|
|
|
var urlStr = window.location.href
|
|
|
var arr = urlStr.split('?')
|
|
|
+
|
|
|
if (arr.length === 1) {
|
|
|
foundHandle()
|
|
|
return
|
|
@@ -80,27 +80,33 @@ const getCommonToken = async () => {
|
|
|
if (!ticketStr.value) { return }
|
|
|
const urlApi = `/auth/ticket`
|
|
|
var p = { ticket: ticketStr.value };
|
|
|
- http.get(urlApi, p, this, false).then(async (resultData) => {
|
|
|
- if (!resultData || resultData['error_code']) {
|
|
|
- message.error('用户不合法,请核实用户信息!')
|
|
|
- foundHandle()
|
|
|
- return
|
|
|
- }
|
|
|
- if (resultData['error']) {
|
|
|
- message.error(resultData['error'])
|
|
|
- foundHandle()
|
|
|
- return
|
|
|
- }
|
|
|
- if(resultData['syUser']){
|
|
|
- const syUserObj = resultData["syUser"];
|
|
|
- store.updateUser({
|
|
|
- syUser: syUserObj
|
|
|
- })
|
|
|
- // getByUser(syUserObj['UserName'], syUserObj['Id'])
|
|
|
- setLocalStorageWithExpiry("_isLogin", "1", 3600000 * window?.AppGlobalConfig?.authorization?.time);
|
|
|
- localStorage.setItem("_sykjzlptv2_ticket", ticketStr.value);
|
|
|
- }
|
|
|
- });
|
|
|
+ http.get(urlApi, p, this, false)
|
|
|
+ .then(async (resultData) => {
|
|
|
+ if (!resultData || resultData['error_code']) {
|
|
|
+ message.error('用户不合法,请核实用户信息!')
|
|
|
+ foundHandle()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (resultData['error']) {
|
|
|
+ message.error(resultData['error'])
|
|
|
+ foundHandle()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(resultData['syUser']){
|
|
|
+ const syUserObj = resultData["syUser"];
|
|
|
+ store.updateUser({
|
|
|
+ syUser: syUserObj
|
|
|
+ })
|
|
|
+
|
|
|
+ setLocalStorageWithExpiry("_isLogin", "1", 3600000 * window?.AppGlobalConfig?.authorization?.time);
|
|
|
+ localStorage.setItem("_sykjzlptv2_ticket", ticketStr.value);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ foundHandle(error);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
getUrlParamByToken()
|