Commit c6a002da6a7093163fe64bdde3170f1d440f130e
1 parent
59995619
fix(src/packages): 修改3D编辑器,携带id为uuidv4版本
Showing
3 changed files
with
47 additions
and
20 deletions
@@ -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" |
@@ -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> |