<template>
|
<ToolHeader/>
|
<div>
|
<h1>IAILAB FAST快速开发平台主页</h1>
|
</div>
|
<el-skeleton :loading="loading" animated>
|
<div id="app" v-for="(item, index) in appList" :key="`dynamics-${index}`">
|
<div class="card" @click="gotoApp(item)">
|
{{item.appName}}
|
</div>
|
</div>
|
</el-skeleton>
|
|
</template>
|
<script lang="ts" setup>
|
|
import * as AppApi from '@/api/system/app'
|
import ToolHeader from "@/layout/components/ToolHeader.vue";
|
import {Apps} from "@/views/Home/types";
|
import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
|
import {usePermissionStore} from "@/store/modules/permission";
|
const permissionStore = usePermissionStore()
|
const { push } = useRouter()
|
|
defineOptions({ name: 'Home2' })
|
|
const { wsCache } = useCache()
|
|
const loading = ref(true)
|
let appList = reactive<Apps[]>([])
|
|
const getAppList = async () => {
|
const data = await AppApi.getAppList()
|
console.log(data)
|
appList = Object.assign(appList, data)
|
}
|
|
const getAllApi = async () => {
|
await Promise.all([
|
getAppList()
|
])
|
loading.value = false
|
}
|
|
getAllApi()
|
|
// 进入应用
|
const gotoApp = async (app) => {
|
if(app.appType == 1) {
|
|
} else {
|
const data = await AppApi.getAppMenuList(app)
|
let data2 = [{
|
path: '/',
|
redirect: '/home',
|
name: 'Index',
|
meta: {
|
hidden: true,
|
breadcrumb: false
|
}
|
}]
|
if(data && data.length > 0) {
|
data.forEach(item => {
|
data2.push(item)
|
})
|
}
|
wsCache.set(CACHE_KEY.ROLE_ROUTERS, data2)
|
let user = wsCache.get('user')
|
user.menus = data2
|
wsCache.set('user', user)
|
// 后端过滤菜单
|
await permissionStore.generateRoutes()
|
push({path: '/home'})
|
}
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
#app{
|
width: 300px;
|
height: 140px;
|
display: inline-block;
|
background: transparent;
|
}
|
.card{
|
width: 300px;
|
height: 100px;
|
padding: 30px;
|
text-align: center;
|
justify-content: center;
|
font-size: 30px;
|
font-weight: bolder;
|
color: blue;
|
background: aliceblue;
|
border-radius: 10px;
|
}
|
</style>
|