提交 | 用户 | 时间
|
820397
|
1 |
<template> |
e7305d
|
2 |
<ToolHeader ref="toolHeader" /> |
H |
3 |
<div> |
|
4 |
<h1>IAILAB 平台主页</h1> |
|
5 |
</div> |
|
6 |
<el-skeleton :loading="loading" animated> |
|
7 |
<div id="app" v-for="(item, index) in appList" :key="`dynamics-${index}`"> |
|
8 |
<div class="card" @click="gotoApp(item)"> |
|
9 |
{{item.appName}} |
|
10 |
</div> |
|
11 |
</div> |
|
12 |
</el-skeleton> |
820397
|
13 |
|
H |
14 |
</template> |
|
15 |
<script lang="ts" setup> |
|
16 |
|
e7305d
|
17 |
import * as AppApi from '@/api/system/app' |
H |
18 |
import * as LoginApi from '@/api/login' |
|
19 |
import ToolHeader from '@/layout/components/ToolHeader.vue' |
|
20 |
import {Apps} from "@/views/Home/types"; |
|
21 |
import {CACHE_KEY, useCache} from "@/hooks/web/useCache"; |
|
22 |
import {usePermissionStore} from "@/store/modules/permission"; |
|
23 |
import {OAuth2Login, OAuth2TokenVO} from "@/api/system/oauth2/token"; |
|
24 |
import * as authUtil from "@/utils/auth"; |
|
25 |
import {CommonStatusEnum} from "@/utils/constants"; |
|
26 |
import * as UserApi from "@/api/system/user"; |
|
27 |
const permissionStore = usePermissionStore() |
|
28 |
const { push } = useRouter() |
|
29 |
|
|
30 |
const formData = ref({ |
|
31 |
grantType: 'password', |
|
32 |
scope: 'user.read user.write', |
|
33 |
refreshToken: authUtil.getRefreshToken(), |
|
34 |
username: authUtil.getLoginForm().username, |
|
35 |
password: authUtil.getLoginForm().password, |
|
36 |
redirectUri: 'http://localhost:90', |
|
37 |
}) |
820397
|
38 |
|
H |
39 |
defineOptions({ name: 'Home2' }) |
|
40 |
|
e7305d
|
41 |
const { wsCache } = useCache() |
H |
42 |
|
820397
|
43 |
const loading = ref(true) |
H |
44 |
|
e7305d
|
45 |
let appList = reactive<Apps[]>([]) |
820397
|
46 |
|
e7305d
|
47 |
const getAppList = async () => { |
H |
48 |
const data = await AppApi.getAppList() |
|
49 |
appList = Object.assign(appList, data) |
820397
|
50 |
} |
H |
51 |
|
|
52 |
const getAllApi = async () => { |
e7305d
|
53 |
await Promise.all([ |
H |
54 |
getAppList() |
|
55 |
]) |
820397
|
56 |
loading.value = false |
H |
57 |
} |
|
58 |
|
|
59 |
getAllApi() |
e7305d
|
60 |
|
H |
61 |
// 进入应用 |
|
62 |
const gotoApp = async (item) => { |
|
63 |
let appType = item.appType |
|
64 |
console.log(appType) |
|
65 |
if(appType === 1) { |
|
66 |
window.location.href = '/index' |
|
67 |
} else { |
|
68 |
// await OAuth2Login(formData.value) |
|
69 |
window.open('http://localhost:90/login?appid=' + item.appMenuId + "&username=" + authUtil.getLoginForm().username, '_blank') |
|
70 |
} |
|
71 |
} |
|
72 |
|
820397
|
73 |
</script> |
H |
74 |
|
|
75 |
<style lang="scss" scoped> |
e7305d
|
76 |
#app{ |
H |
77 |
width: 300px; |
|
78 |
height: 140px; |
|
79 |
display: inline-block; |
|
80 |
background: transparent; |
|
81 |
} |
|
82 |
.card{ |
|
83 |
width: 300px; |
|
84 |
height: 100px; |
|
85 |
padding: 30px; |
|
86 |
text-align: center; |
|
87 |
justify-content: center; |
|
88 |
font-size: 30px; |
|
89 |
font-weight: bolder; |
|
90 |
color: blue; |
|
91 |
background: aliceblue; |
|
92 |
border-radius: 10px; |
820397
|
93 |
} |
H |
94 |
</style> |