Commit 4c8ed34f25d30c3cd1363185fafe0d4cca9246e8

Authored by fengtao
2 parents bc87ffca e42540bc

Merge branch 'perf/editor/10-24/2024' into 'main_dev'

ferf(src/packages): 修改3D编辑器,携带id为uuidv4版本

See merge request yunteng/thingskit-view!299
@@ -32,6 +32,35 @@ export const getUUID = (randomLength = 10) => { @@ -32,6 +32,35 @@ export const getUUID = (randomLength = 10) => {
32 } 32 }
33 33
34 /** 34 /**
  35 + * 生成一个UUIDv4版本的
  36 + */
  37 +
  38 +export function generateUUIDv4() {
  39 + const len = 32 //32长度
  40 + let radix = 16 //16进制
  41 + const chars = '0123456789abcdefghijklmnopqrstuvwxyz'.split('')
  42 + const uuid = []
  43 + let i
  44 + radix = radix || chars.length
  45 + if (len) {
  46 + for (i = 0; i < len; i++) {
  47 + uuid[i] = chars[0 | (Math.random() * radix)]
  48 + }
  49 + } else {
  50 + let r
  51 + uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
  52 + uuid[14] = '4'
  53 + for (i = 0; i < 36; i++) {
  54 + if (!uuid[i]) {
  55 + r = 0 | (Math.random() * 16)
  56 + uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r]
  57 + }
  58 + }
  59 + }
  60 + return uuid.join('')
  61 +}
  62 +
  63 +/**
35 * * render 图标 64 * * render 图标
36 * @param icon 图标 65 * @param icon 图标
37 * @param set 设置项 66 * @param set 设置项
@@ -359,24 +388,22 @@ export const setTitle = (title?: string) => { @@ -359,24 +388,22 @@ export const setTitle = (title?: string) => {
359 title && (document.title = title) 388 title && (document.title = title)
360 } 389 }
361 390
362 -  
363 -  
364 -export const getUrlSearch = (name: string) =>{ 391 +export const getUrlSearch = (name: string) => {
365 // 未传参,返回空 392 // 未传参,返回空
366 - if (!name) return null; 393 + if (!name) return null
367 // 查询参数:先通过search取值,如果取不到就通过hash来取 394 // 查询参数:先通过search取值,如果取不到就通过hash来取
368 - let after = window.location.search;  
369 - after = after.substr(1) || window.location.hash.split('?')[1]; 395 + let after = window.location.search
  396 + after = after.substr(1) || window.location.hash.split('?')[1]
370 // 地址栏URL没有查询参数,返回空 397 // 地址栏URL没有查询参数,返回空
371 - if (!after) return null; 398 + if (!after) return null
372 // 如果查询参数中没有"name",返回空 399 // 如果查询参数中没有"name",返回空
373 - if (after.indexOf(name) === -1) return null;  
374 -  
375 - const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); 400 + if (after.indexOf(name) === -1) return null
  401 +
  402 + const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
376 // 当地址栏参数存在中文时,需要解码,不然会乱码 403 // 当地址栏参数存在中文时,需要解码,不然会乱码
377 - const r = decodeURI(after).match(reg); 404 + const r = decodeURI(after).match(reg)
378 // 如果url中"name"没有值,返回空 405 // 如果url中"name"没有值,返回空
379 - if (!r) return null;  
380 -  
381 - return r[2];  
382 -}  
  406 + if (!r) return null
  407 +
  408 + return r[2]
  409 +}
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <n-checkbox v-model:checked="cardData.checkedValue"> </n-checkbox> 5 <n-checkbox v-model:checked="cardData.checkedValue"> </n-checkbox>
6 </template> 6 </template>
7 <div class="list-content"> 7 <div class="list-content">
8 - <div class="list-content-img"> 8 + <div class="list-content-img" @click="editHandle()">
9 <n-image 9 <n-image
10 object-fit="fill" 10 object-fit="fill"
11 height="180" 11 height="180"
@@ -20,15 +20,19 @@ @@ -20,15 +20,19 @@
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 @click="handleFocus">  
24 - <n-button v-show="!focus" secondary size="tiny"> 23 + <n-text v-if="!focus" @click="handleFocus">
  24 + <n-button
  25 + class="list-footer-button"
  26 + secondary
  27 + size="tiny"
  28 + >
25 <span class="title"> 29 <span class="title">
26 {{ cardData.name || cardData.id }} 30 {{ cardData.name || cardData.id }}
27 </span> 31 </span>
28 </n-button> 32 </n-button>
29 </n-text> 33 </n-text>
30 <n-input 34 <n-input
31 - v-show="focus" 35 + v-else
32 ref="inputInstRef" 36 ref="inputInstRef"
33 size="small" 37 size="small"
34 type="text" 38 type="text"
@@ -102,7 +106,7 @@ const emit = defineEmits(['delete', 'resize', 'edit', 'release', 'inputUpdateCar @@ -102,7 +106,7 @@ const emit = defineEmits(['delete', 'resize', 'edit', 'release', 'inputUpdateCar
102 106
103 const props = defineProps({ 107 const props = defineProps({
104 cardData: Object as PropType<ChartType>, 108 cardData: Object as PropType<ChartType>,
105 - operationKey: String, 109 + operationKey: String
106 }) 110 })
107 111
108 // 处理url获取 112 // 处理url获取
@@ -234,6 +238,14 @@ $contentHeight: 180px; @@ -234,6 +238,14 @@ $contentHeight: 180px;
234 justify-content: flex-end; 238 justify-content: flex-end;
235 min-width: 180px; 239 min-width: 180px;
236 } 240 }
  241 + .list-footer-button {
  242 + display: flex;
  243 + // justify-content: flex-start;
  244 + width: 135px;
  245 + overflow: hidden;
  246 + text-overflow: ellipsis;
  247 + white-space: nowrap;
  248 + }
237 } 249 }
238 } 250 }
239 </style> 251 </style>
@@ -100,7 +100,7 @@ import { useDataListInit } from './hooks/useData.hook' @@ -100,7 +100,7 @@ import { useDataListInit } from './hooks/useData.hook'
100 import { ref } from 'vue' 100 import { ref } from 'vue'
101 import type { FormInst } from 'naive-ui' 101 import type { FormInst } from 'naive-ui'
102 import { icon } from '@/plugins' 102 import { icon } from '@/plugins'
103 -import { getUUID } from '@/utils/utils' 103 +import { generateUUIDv4 } from '@/utils/utils'
104 import { threeJsDeleteApi, putReleaseThreeJsModel } from '@/api/external/contentSave/content' 104 import { threeJsDeleteApi, putReleaseThreeJsModel } from '@/api/external/contentSave/content'
105 import { ChartType } from '../..' 105 import { ChartType } from '../..'
106 import { DialogEnum } from '@/enums/pluginEnum' 106 import { DialogEnum } from '@/enums/pluginEnum'
@@ -170,7 +170,7 @@ const releaseGoDialog = (message: string, state: number, messageText: string) => @@ -170,7 +170,7 @@ const releaseGoDialog = (message: string, state: number, messageText: string) =>
170 window['$message'].success(window['$t'](messageText)) 170 window['$message'].success(window['$t'](messageText))
171 handleSearchClick() 171 handleSearchClick()
172 isBulkOperationFlag.value = true 172 isBulkOperationFlag.value = true
173 - selectAllTextFlag.value = false 173 + selectAllTextFlag.value = true
174 operationKey.value = '' 174 operationKey.value = ''
175 resetSelect(list.value, false) 175 resetSelect(list.value, false)
176 } 176 }
@@ -197,7 +197,7 @@ const handleOperationSelect = async (key: string) => { @@ -197,7 +197,7 @@ const handleOperationSelect = async (key: string) => {
197 window['$message'].success(window['$t']('common.deleteSuccessText')) 197 window['$message'].success(window['$t']('common.deleteSuccessText'))
198 handleSearchClick() 198 handleSearchClick()
199 isBulkOperationFlag.value = true 199 isBulkOperationFlag.value = true
200 - selectAllTextFlag.value = false 200 + selectAllTextFlag.value = true
201 operationKey.value = '' 201 operationKey.value = ''
202 resetSelect(list.value, false) 202 resetSelect(list.value, false)
203 } 203 }
@@ -249,7 +249,7 @@ const handleResetClick = () => { @@ -249,7 +249,7 @@ const handleResetClick = () => {
249 249
250 const handleOpenThreeEditor = () => { 250 const handleOpenThreeEditor = () => {
251 const { host, protocol, pathname } = location 251 const { host, protocol, pathname } = location
252 - const randomId = getUUID(32) 252 + const randomId = generateUUIDv4()
253 window.open(`${protocol}//${host}${pathname}editor/?three_file_uuid=${randomId}&action_type=create`) 253 window.open(`${protocol}//${host}${pathname}editor/?three_file_uuid=${randomId}&action_type=create`)
254 } 254 }
255 </script> 255 </script>