fix(嵌入式): DIV嵌入式优化

This commit is contained in:
dataeaseShu 2024-02-18 17:52:34 +08:00
parent 596e3350bb
commit 81d34b1b82
3 changed files with 19 additions and 16 deletions

View File

@ -1,11 +1,7 @@
<script setup lang="ts">
import { shallowRef, defineAsyncComponent, onBeforeMount } from 'vue'
import { shallowRef, defineAsyncComponent } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { useAppStoreWithOut } from '@/store/modules/app'
const appStore = useAppStoreWithOut()
onBeforeMount(() => {
appStore.setIsDataEaseBi(true)
})
const VisualizationEditor = defineAsyncComponent(
() => import('@/views/data-visualization/index.vue')
)

View File

@ -58,7 +58,6 @@ import AppElement from './App.vue'
import { setupI18n } from '@/plugins/vue-i18n'
import { setupStore } from '@/store'
import { useEmbedded } from '@/store/modules/embedded'
import { useUserStoreWithOut } from '@/store/modules/user'
import { setupElementPlus, setupElementPlusIcons } from '@/plugins/element-plus'
import { setupRouter } from '@/router/embedded'
@ -88,8 +87,12 @@ const setupAll = async (
embeddedStore.setPid(pid)
embeddedStore.setChartId(chartId)
embeddedStore.setResourceId(resourceId)
const userStore = useUserStoreWithOut()
await userStore.setUser()
const res = await import('@/store/modules/user')
const userStore = res.userStore()
userStore.setUser()
const appRes = await import('@/store/modules/app')
const appStore = appRes.useAppStoreWithOut()
appStore.setIsDataEaseBi(true)
app.mount(dom)
return app
}
@ -151,9 +154,11 @@ class DataEaseBi {
}
destroy() {
const userStore = useUserStoreWithOut()
import('@/store/modules/user').then(res => {
const userStore = res.userStore()
userStore.setUser()
})
const embeddedStore = useEmbedded()
userStore.clear()
embeddedStore.setType(null)
embeddedStore.setBusiFlag(null)
embeddedStore.setToken(null)

View File

@ -2,8 +2,6 @@ import { defineStore } from 'pinia'
import { store } from '../index'
import { useCache } from '@/hooks/web/useCache'
import { useLocaleStoreWithOut } from './locale'
import { userInfo } from '@/api/user'
const { wsCache } = useCache()
const locale = useLocaleStoreWithOut()
interface UserState {
@ -49,9 +47,13 @@ export const userStore = defineStore('user', {
actions: {
async setUser() {
const desktop = wsCache.get('app.desktop')
const res = desktop
? { data: { uid: '1', name: 'DataEase 用户', oid: '1', language: 'zh-CN' } }
: await userInfo()
let res = null
if (desktop) {
res = { data: { uid: '1', name: 'DataEase 用户', oid: '1', language: 'zh-CN' } }
} else {
const user = await import('@/api/user')
res = await user.userInfo()
}
const data = res.data
data.token = wsCache.get('user.token')
data.exp = wsCache.get('user.exp')