Commit 08532c05b85e9419069bbdff19d85928e40be87b
Merge branch 'perf/editor/10-24-59/2024' into 'main_dev'
perf(src/packages): 3D模型预览添加loading效果 See merge request yunteng/thingskit-view!302
Showing
8 changed files
with
66 additions
and
55 deletions
@@ -18,7 +18,7 @@ function Menubar( editor ) { | @@ -18,7 +18,7 @@ function Menubar( editor ) { | ||
18 | container.add( new MenubarView( editor ) ); | 18 | container.add( new MenubarView( editor ) ); |
19 | container.add( new MenubarHelp( editor ) ); | 19 | container.add( new MenubarHelp( editor ) ); |
20 | 20 | ||
21 | - container.add( new MenubarStatus( editor ) ); | 21 | + // container.add( new MenubarStatus( editor ) ); |
22 | 22 | ||
23 | return container; | 23 | return container; |
24 | 24 |
@@ -25,3 +25,13 @@ export function getThreeJsModel(id) { | @@ -25,3 +25,13 @@ export function getThreeJsModel(id) { | ||
25 | url: API['URL'] + '/' + id | 25 | url: API['URL'] + '/' + id |
26 | }) | 26 | }) |
27 | } | 27 | } |
28 | + | ||
29 | +/** | ||
30 | + * @description: 3D模型 获取json数据 api | ||
31 | + */ | ||
32 | +export function getThreeJsModelByJson(id) { | ||
33 | + return defHttp.get({ | ||
34 | + url: API['URL'] + '/json' +'/'+id + '/root.json', | ||
35 | + timeout: 30 * 1000 | ||
36 | + }) | ||
37 | +} |
@@ -8,7 +8,7 @@ import { Player } from './js/Player.js' | @@ -8,7 +8,7 @@ import { Player } from './js/Player.js' | ||
8 | import { Sidebar } from './js/Sidebar.js' | 8 | import { Sidebar } from './js/Sidebar.js' |
9 | import { Menubar } from './js/Menubar.js' | 9 | import { Menubar } from './js/Menubar.js' |
10 | import { Resizer } from './js/Resizer.js' | 10 | import { Resizer } from './js/Resizer.js' |
11 | -import { getThreeJsModel } from './js/libs/http/api.js' | 11 | +import { getThreeJsModelByJson } from './js/libs/http/api.js' |
12 | import { useSpin } from './js/libs/spin/useSpin.js' | 12 | import { useSpin } from './js/libs/spin/useSpin.js' |
13 | 13 | ||
14 | window.URL = window.URL || window.webkitURL | 14 | window.URL = window.URL || window.webkitURL |
@@ -58,10 +58,9 @@ editor.storage.init(async function () { | @@ -58,10 +58,9 @@ editor.storage.init(async function () { | ||
58 | const { spin, stop } = useSpin() | 58 | const { spin, stop } = useSpin() |
59 | try { | 59 | try { |
60 | spin() | 60 | spin() |
61 | - const fileData = await getThreeJsModel(file_uuid) | 61 | + const fileData = await getThreeJsModelByJson(file_uuid) |
62 | if (!fileData) return | 62 | if (!fileData) return |
63 | - if (!fileData['content']) return | ||
64 | - await editor.fromJSON(fileData['content']) | 63 | + await editor.fromJSON(fileData) |
65 | } finally { | 64 | } finally { |
66 | stop() | 65 | stop() |
67 | } | 66 | } |
@@ -15,21 +15,19 @@ | @@ -15,21 +15,19 @@ | ||
15 | :intersectRecursive="true" | 15 | :intersectRecursive="true" |
16 | /> | 16 | /> |
17 | <div v-show="show" class="process"> | 17 | <div v-show="show" class="process"> |
18 | - <span> 拼命加载中... </span> | ||
19 | - <n-progress type="line" :color="themeColor" :percentage="process" :indicator-placement="'inside'" processing /> | 18 | + <n-spin :show="show"> |
19 | + <template #description> 拼命加载中... </template> | ||
20 | + </n-spin> | ||
20 | </div> | 21 | </div> |
21 | </div> | 22 | </div> |
22 | </div> | 23 | </div> |
23 | </template> | 24 | </template> |
24 | <script setup lang="ts"> | 25 | <script setup lang="ts"> |
25 | -import { PropType, toRefs, ref, nextTick, computed } from 'vue' | 26 | +import { PropType, toRefs, ref, nextTick } from 'vue' |
26 | import { CreateComponentType } from '@/packages/index.d' | 27 | import { CreateComponentType } from '@/packages/index.d' |
27 | import { vue3dLoader } from 'vue-3d-loader' | 28 | import { vue3dLoader } from 'vue-3d-loader' |
28 | -import { useDesignStore } from '@/store/modules/designStore/designStore' | ||
29 | import { getJwtToken } from '@/utils/external/auth' | 29 | import { getJwtToken } from '@/utils/external/auth' |
30 | 30 | ||
31 | -const designStore = useDesignStore() | ||
32 | - | ||
33 | const props = defineProps({ | 31 | const props = defineProps({ |
34 | chartConfig: { | 32 | chartConfig: { |
35 | type: Object as PropType<CreateComponentType>, | 33 | type: Object as PropType<CreateComponentType>, |
@@ -37,10 +35,6 @@ const props = defineProps({ | @@ -37,10 +35,6 @@ const props = defineProps({ | ||
37 | } | 35 | } |
38 | }) | 36 | }) |
39 | 37 | ||
40 | -const themeColor = computed(() => { | ||
41 | - return designStore.getAppTheme | ||
42 | -}) | ||
43 | - | ||
44 | const vue3dLoaderRef = ref(null) | 38 | const vue3dLoaderRef = ref(null) |
45 | 39 | ||
46 | const headers = { | 40 | const headers = { |
@@ -54,12 +48,16 @@ const webGLRendererOptions = { | @@ -54,12 +48,16 @@ const webGLRendererOptions = { | ||
54 | } | 48 | } |
55 | 49 | ||
56 | //三维模型加载 | 50 | //三维模型加载 |
57 | -const show = ref(false) | 51 | +const show = ref(true) |
52 | + | ||
53 | +const { dataset, backgroundColor, backgroundAlpha, borderConfig } = toRefs(props.chartConfig.option) as Recordable | ||
58 | 54 | ||
59 | const onLoad = async () => { | 55 | const onLoad = async () => { |
60 | //加载完成 | 56 | //加载完成 |
61 | await nextTick() | 57 | await nextTick() |
62 | - show.value = false | 58 | + if (dataset.value) { |
59 | + show.value = false | ||
60 | + } | ||
63 | } | 61 | } |
64 | 62 | ||
65 | //三维模型进度条 | 63 | //三维模型进度条 |
@@ -70,8 +68,6 @@ const onProcess = (event: Recordable) => { | @@ -70,8 +68,6 @@ const onProcess = (event: Recordable) => { | ||
70 | } | 68 | } |
71 | 69 | ||
72 | const { w, h } = toRefs(props.chartConfig.attr) | 70 | const { w, h } = toRefs(props.chartConfig.attr) |
73 | - | ||
74 | -const { dataset, backgroundColor, backgroundAlpha,borderConfig } = toRefs(props.chartConfig.option) as Recordable | ||
75 | </script> | 71 | </script> |
76 | 72 | ||
77 | <style lang="scss" scoped> | 73 | <style lang="scss" scoped> |
@@ -86,6 +82,9 @@ const { dataset, backgroundColor, backgroundAlpha,borderConfig } = toRefs(props. | @@ -86,6 +82,9 @@ const { dataset, backgroundColor, backgroundAlpha,borderConfig } = toRefs(props. | ||
86 | left: 50%; | 82 | left: 50%; |
87 | width: 50%; | 83 | width: 50%; |
88 | transform: translate(-50%, -50%); | 84 | transform: translate(-50%, -50%); |
85 | + display:flex; | ||
86 | + align-items: center; | ||
87 | + justify-content: center; | ||
89 | } | 88 | } |
90 | } | 89 | } |
91 | </style> | 90 | </style> |
@@ -108,7 +108,6 @@ export async function getPlayUrl( | @@ -108,7 +108,6 @@ export async function getPlayUrl( | ||
108 | } | 108 | } |
109 | } else if (accessMode === AccessMode.GBT28181) { | 109 | } else if (accessMode === AccessMode.GBT28181) { |
110 | const { securityPolicy } = useGlobSetting() | 110 | const { securityPolicy } = useGlobSetting() |
111 | - console.log(useGlobSetting()) | ||
112 | const { deviceId, channelNo } = params?.params || {}; | 111 | const { deviceId, channelNo } = params?.params || {}; |
113 | const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! }); | 112 | const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! }); |
114 | return { url: securityPolicy ? result.data.https_flv : result.data.flv, type: 'flv' }; | 113 | return { url: securityPolicy ? result.data.https_flv : result.data.flv, type: 'flv' }; |
@@ -20,28 +20,29 @@ | @@ -20,28 +20,29 @@ | ||
20 | <template #action> | 20 | <template #action> |
21 | <div class="go-flex-items-center list-footer" justify="space-between"> | 21 | <div class="go-flex-items-center list-footer" justify="space-between"> |
22 | <div style="display: flex; flex-direction: column; align-items: start"> | 22 | <div style="display: flex; flex-direction: column; align-items: start"> |
23 | - <n-text v-if="!focus" @click="handleFocus"> | ||
24 | - <n-button | ||
25 | - class="list-footer-button" | ||
26 | - secondary | ||
27 | - size="tiny" | ||
28 | - > | ||
29 | - <span class="title"> | ||
30 | - {{ cardData.name || cardData.id }} | ||
31 | - </span> | ||
32 | - </n-button> | ||
33 | - </n-text> | ||
34 | - <n-input | ||
35 | - v-else | ||
36 | - ref="inputInstRef" | ||
37 | - size="small" | ||
38 | - type="text" | ||
39 | - maxlength="16" | ||
40 | - show-count | ||
41 | - v-model:value.trim="title" | ||
42 | - @keyup.enter="handleBlur" | ||
43 | - @blur="handleBlur" | ||
44 | - ></n-input> | 23 | + <n-tooltip trigger="hover"> |
24 | + <template #trigger> | ||
25 | + <n-text v-if="!focus" @click="handleFocus"> | ||
26 | + <n-button class="list-footer-button" secondary size="tiny"> | ||
27 | + <span class="title"> | ||
28 | + {{ cardData.name || cardData.id }} | ||
29 | + </span> | ||
30 | + </n-button> | ||
31 | + </n-text> | ||
32 | + <n-input | ||
33 | + v-else | ||
34 | + ref="inputInstRef" | ||
35 | + size="small" | ||
36 | + type="text" | ||
37 | + maxlength="16" | ||
38 | + show-count | ||
39 | + v-model:value.trim="title" | ||
40 | + @keyup.enter="handleBlur" | ||
41 | + @blur="handleBlur" | ||
42 | + ></n-input> | ||
43 | + </template> | ||
44 | + {{ cardData.name || cardData.id }} | ||
45 | + </n-tooltip> | ||
45 | <n-text style="font-size: 12px; margin-left: 6px">{{ cardData.createTime }}</n-text> | 46 | <n-text style="font-size: 12px; margin-left: 6px">{{ cardData.createTime }}</n-text> |
46 | </div> | 47 | </div> |
47 | <!-- 工具 --> | 48 | <!-- 工具 --> |
@@ -241,7 +242,7 @@ $contentHeight: 180px; | @@ -241,7 +242,7 @@ $contentHeight: 180px; | ||
241 | .list-footer-button { | 242 | .list-footer-button { |
242 | display: flex; | 243 | display: flex; |
243 | // justify-content: flex-start; | 244 | // justify-content: flex-start; |
244 | - width: 135px; | 245 | + width: 125px; |
245 | overflow: hidden; | 246 | overflow: hidden; |
246 | text-overflow: ellipsis; | 247 | text-overflow: ellipsis; |
247 | white-space: nowrap; | 248 | white-space: nowrap; |
@@ -88,21 +88,22 @@ export const useDataListInit = (formValue: { name: string; state: string | null | @@ -88,21 +88,22 @@ export const useDataListInit = (formValue: { name: string; state: string | null | ||
88 | // 发布处理 | 88 | // 发布处理 |
89 | const releaseHandle = async (cardData: ChartType) => { | 89 | const releaseHandle = async (cardData: ChartType) => { |
90 | const { id, state } = cardData | 90 | const { id, state } = cardData |
91 | - await putThreeJsModelRelease({ | 91 | + const res = await putThreeJsModelRelease({ |
92 | id, | 92 | id, |
93 | // [0未发布, 1发布] | 93 | // [0未发布, 1发布] |
94 | state: state === 1 ? 0 : 1 | 94 | state: state === 1 ? 0 : 1 |
95 | }) | 95 | }) |
96 | - list.value = [] | ||
97 | - fetchList() | ||
98 | - // 发布 -> 未发布 | ||
99 | if (state === 1) { | 96 | if (state === 1) { |
100 | window['$message'].success(window['$t']('common.cancelReleaseSuccessText')) | 97 | window['$message'].success(window['$t']('common.cancelReleaseSuccessText')) |
101 | - return | 98 | + } else { |
99 | + window['$message'].success(window['$t']('common.releaseSuccessText')) | ||
100 | + } | ||
101 | + if(res) { | ||
102 | + setTimeout(() => { | ||
103 | + list.value = [] | ||
104 | + fetchList() | ||
105 | + }, 500) | ||
102 | } | 106 | } |
103 | - // 未发布 -> 发布 | ||
104 | - window['$message'].success(window['$t']('common.releaseSuccessText')) | ||
105 | - return | ||
106 | } | 107 | } |
107 | 108 | ||
108 | // 立即请求 | 109 | // 立即请求 |
@@ -161,14 +161,15 @@ const releaseGoDialog = (message: string, state: number, messageText: string) => | @@ -161,14 +161,15 @@ const releaseGoDialog = (message: string, state: number, messageText: string) => | ||
161 | // eslint-disable-next-line @typescript-eslint/no-empty-function | 161 | // eslint-disable-next-line @typescript-eslint/no-empty-function |
162 | onPositiveCallback: () => {}, | 162 | onPositiveCallback: () => {}, |
163 | promiseResCallback: async () => { | 163 | promiseResCallback: async () => { |
164 | - console.log(list.value) | ||
165 | // eslint-disable-next-line no-case-declarations | 164 | // eslint-disable-next-line no-case-declarations |
166 | const bulkDeleteIds = list.value | 165 | const bulkDeleteIds = list.value |
167 | ?.filter((item: ChartType) => item.checkedValue) | 166 | ?.filter((item: ChartType) => item.checkedValue) |
168 | ?.map((item: ChartType) => item.id) | 167 | ?.map((item: ChartType) => item.id) |
169 | await putReleaseThreeJsModel(state, bulkDeleteIds as unknown as string[]) | 168 | await putReleaseThreeJsModel(state, bulkDeleteIds as unknown as string[]) |
170 | window['$message'].success(window['$t'](messageText)) | 169 | window['$message'].success(window['$t'](messageText)) |
171 | - handleSearchClick() | 170 | + setTimeout(() => { |
171 | + handleSearchClick() | ||
172 | + }, 500) | ||
172 | isBulkOperationFlag.value = true | 173 | isBulkOperationFlag.value = true |
173 | selectAllTextFlag.value = true | 174 | selectAllTextFlag.value = true |
174 | operationKey.value = '' | 175 | operationKey.value = '' |
@@ -188,14 +189,15 @@ const handleOperationSelect = async (key: string) => { | @@ -188,14 +189,15 @@ const handleOperationSelect = async (key: string) => { | ||
188 | // eslint-disable-next-line @typescript-eslint/no-empty-function | 189 | // eslint-disable-next-line @typescript-eslint/no-empty-function |
189 | onPositiveCallback: () => {}, | 190 | onPositiveCallback: () => {}, |
190 | promiseResCallback: async () => { | 191 | promiseResCallback: async () => { |
191 | - console.log(list.value) | ||
192 | // eslint-disable-next-line no-case-declarations | 192 | // eslint-disable-next-line no-case-declarations |
193 | const bulkDeleteIds = list.value | 193 | const bulkDeleteIds = list.value |
194 | ?.filter((item: ChartType) => item.checkedValue) | 194 | ?.filter((item: ChartType) => item.checkedValue) |
195 | ?.map((item: ChartType) => item.id) | 195 | ?.map((item: ChartType) => item.id) |
196 | await threeJsDeleteApi([bulkDeleteIds] as unknown as string[]) | 196 | await threeJsDeleteApi([bulkDeleteIds] as unknown as string[]) |
197 | window['$message'].success(window['$t']('common.deleteSuccessText')) | 197 | window['$message'].success(window['$t']('common.deleteSuccessText')) |
198 | - handleSearchClick() | 198 | + setTimeout(() => { |
199 | + handleSearchClick() | ||
200 | + }, 500) | ||
199 | isBulkOperationFlag.value = true | 201 | isBulkOperationFlag.value = true |
200 | selectAllTextFlag.value = true | 202 | selectAllTextFlag.value = true |
201 | operationKey.value = '' | 203 | operationKey.value = '' |