| | |
| | | <el-skeleton :loading="loading" animated> |
| | | <div id="app" v-for="(item, index) in appList" :key="`dynamics-${index}`"> |
| | | <div class="card" @click="gotoApp(item)"> |
| | | <img :src="item.icon" style="width: 100px; height: 100px" /> |
| | | <img :src="item.icon" style="width: 100px; height: 100px"/> |
| | | <div> |
| | | {{item.appName}} |
| | | {{ item.appName }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import * as AppApi from '@/api/system/app' |
| | | import {Apps} from "@/views/Home/types"; |
| | | import {CACHE_KEY, useCache} from "@/hooks/web/useCache"; |
| | | import * as authUtil from "@/utils/auth"; |
| | | |
| | | |
| | | defineOptions({ name: 'Home' }) |
| | | defineOptions({name: 'Home'}) |
| | | |
| | | const { wsCache } = useCache() |
| | | const {wsCache} = useCache() |
| | | |
| | | const loading = ref(true) |
| | | |
| | |
| | | appList = Object.assign(appList, data) |
| | | } |
| | | |
| | | const getAppMenuList = async (id) => { |
| | | const getAppMenuList = async (id, appCode) => { |
| | | const data = await AppApi.getAppMenuList(id) |
| | | console.log(data) |
| | | |
| | | let userInfo = wsCache.get(CACHE_KEY.USER) |
| | | let routers = wsCache.get(CACHE_KEY.ROLE_ROUTERS) |
| | | console.log(userInfo) |
| | | console.log(routers) |
| | | userInfo.menus = data |
| | | wsCache.set(CACHE_KEY.USER, userInfo) |
| | | wsCache.set(CACHE_KEY.ROLE_ROUTERS, data) |
| | |
| | | |
| | | // 进入应用 |
| | | const gotoApp = async (item) => { |
| | | let path = window.location.pathname |
| | | let appName = path.split("/")[0] |
| | | console.log(appName) |
| | | let id = item.id |
| | | let type = item.type |
| | | console.log(type) |
| | | if(type === 0) { |
| | | getAppMenuList(id) |
| | | let appCode = item.appCode |
| | | if (type === 0) { |
| | | await getAppMenuList(id, appCode) |
| | | } else { |
| | | // await OAuth2Login(formData.value) |
| | | window.open(item.appDomain + '/login?appid=' + item.id + "&username=" + authUtil.getLoginForm().username, '_blank') |
| | | const data = await AppApi.getAppMenuList(id) |
| | | let userInfo = wsCache.get(CACHE_KEY.USER) |
| | | userInfo.menus = data |
| | | wsCache.set(CACHE_KEY.USER, userInfo) |
| | | wsCache.set(CACHE_KEY.ROLE_ROUTERS, data) |
| | | window.open(item.appDomain + '/index', '_blank') |
| | | // window.open('/plat/shasteel', '_blank') |
| | | // window.location.href = '/plat/shasteel' |
| | | // window.location.href = `/plat/shasteel?key=energy&url=http://localhost:9000&energy=/energy/demo` |
| | | } |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | #app{ |
| | | #app { |
| | | width: 300px; |
| | | height: 200px; |
| | | display: inline-block; |
| | | background: transparent; |
| | | } |
| | | .card{ |
| | | |
| | | .card { |
| | | border: thin dashed gainsboro; |
| | | width: 150px; |
| | | height: 120px; |