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 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 64 * * render 图标
36 65 * @param icon 图标
37 66 * @param set 设置项
... ... @@ -359,24 +388,22 @@ export const setTitle = (title?: string) => {
359 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 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 397 // 地址栏URL没有查询参数,返回空
371   - if (!after) return null;
  398 + if (!after) return null
372 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 405 // 如果url中"name"没有值,返回空
379   - if (!r) return null;
380   -
381   - return r[2];
382   -}
\ No newline at end of file
  406 + if (!r) return null
  407 +
  408 + return r[2]
  409 +}
... ...
... ... @@ -5,7 +5,7 @@
5 5 <n-checkbox v-model:checked="cardData.checkedValue"> </n-checkbox>
6 6 </template>
7 7 <div class="list-content">
8   - <div class="list-content-img">
  8 + <div class="list-content-img" @click="editHandle()">
9 9 <n-image
10 10 object-fit="fill"
11 11 height="180"
... ... @@ -20,15 +20,19 @@
20 20 <template #action>
21 21 <div class="go-flex-items-center list-footer" justify="space-between">
22 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 29 <span class="title">
26 30 {{ cardData.name || cardData.id }}
27 31 </span>
28 32 </n-button>
29 33 </n-text>
30 34 <n-input
31   - v-show="focus"
  35 + v-else
32 36 ref="inputInstRef"
33 37 size="small"
34 38 type="text"
... ... @@ -102,7 +106,7 @@ const emit = defineEmits(['delete', 'resize', 'edit', 'release', 'inputUpdateCar
102 106
103 107 const props = defineProps({
104 108 cardData: Object as PropType<ChartType>,
105   - operationKey: String,
  109 + operationKey: String
106 110 })
107 111
108 112 // 处理url获取
... ... @@ -234,6 +238,14 @@ $contentHeight: 180px;
234 238 justify-content: flex-end;
235 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 251 </style>
... ...
... ... @@ -100,7 +100,7 @@ import { useDataListInit } from './hooks/useData.hook'
100 100 import { ref } from 'vue'
101 101 import type { FormInst } from 'naive-ui'
102 102 import { icon } from '@/plugins'
103   -import { getUUID } from '@/utils/utils'
  103 +import { generateUUIDv4 } from '@/utils/utils'
104 104 import { threeJsDeleteApi, putReleaseThreeJsModel } from '@/api/external/contentSave/content'
105 105 import { ChartType } from '../..'
106 106 import { DialogEnum } from '@/enums/pluginEnum'
... ... @@ -170,7 +170,7 @@ const releaseGoDialog = (message: string, state: number, messageText: string) =>
170 170 window['$message'].success(window['$t'](messageText))
171 171 handleSearchClick()
172 172 isBulkOperationFlag.value = true
173   - selectAllTextFlag.value = false
  173 + selectAllTextFlag.value = true
174 174 operationKey.value = ''
175 175 resetSelect(list.value, false)
176 176 }
... ... @@ -197,7 +197,7 @@ const handleOperationSelect = async (key: string) => {
197 197 window['$message'].success(window['$t']('common.deleteSuccessText'))
198 198 handleSearchClick()
199 199 isBulkOperationFlag.value = true
200   - selectAllTextFlag.value = false
  200 + selectAllTextFlag.value = true
201 201 operationKey.value = ''
202 202 resetSelect(list.value, false)
203 203 }
... ... @@ -249,7 +249,7 @@ const handleResetClick = () => {
249 249
250 250 const handleOpenThreeEditor = () => {
251 251 const { host, protocol, pathname } = location
252   - const randomId = getUUID(32)
  252 + const randomId = generateUUIDv4()
253 253 window.open(`${protocol}//${host}${pathname}editor/?three_file_uuid=${randomId}&action_type=create`)
254 254 }
255 255 </script>
... ...