From 35e15fbff475569999f9325d774d5e66090907e5 Mon Sep 17 00:00:00 2001 From: hyf-github-user <1348977728@qq.com> Date: Wed, 6 Nov 2024 16:18:01 +0800 Subject: [PATCH 1/4] add headshots index --- src/components/common/TopHeader.vue | 5 +++++ src/i18n/zh-CN/index.json | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/components/common/TopHeader.vue b/src/components/common/TopHeader.vue index 8ba300d6..c5786aa6 100644 --- a/src/components/common/TopHeader.vue +++ b/src/components/common/TopHeader.vue @@ -16,6 +16,11 @@ + Date: Wed, 6 Nov 2024 16:20:52 +0800 Subject: [PATCH 2/4] fix suno use --- src/components/suno/task/Preview.vue | 56 +++++++++++++++++++++------- src/i18n/zh-CN/suno.json | 8 ++++ 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/components/suno/task/Preview.vue b/src/components/suno/task/Preview.vue index 440e1570..44ea19ff 100644 --- a/src/components/suno/task/Preview.vue +++ b/src/components/suno/task/Preview.vue @@ -37,14 +37,6 @@ {{ $t('suno.button.extend') }} - - - + + + + + + + + @@ -62,9 +75,10 @@ import { defineComponent } from 'vue'; import { useFormatDuring } from '@/utils/number'; import { ISunoAudio, ISunoTask } from '@/models'; -import { ElImage, ElIcon, ElTooltip, ElButton } from 'element-plus'; +import { ElImage, ElIcon, ElTooltip, ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus'; import { VideoPlay, VideoPause } from '@element-plus/icons-vue'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; +import { saveAs } from 'file-saver'; export default defineComponent({ name: 'TaskPreview', @@ -75,7 +89,10 @@ export default defineComponent({ ElButton, FontAwesomeIcon, VideoPlay, - VideoPause + VideoPause, + ElDropdown, + ElDropdownMenu, + ElDropdownItem }, props: { modelValue: { @@ -153,13 +170,26 @@ export default defineComponent({ }, onDownload(event: MouseEvent, audioUrl: string) { event.stopPropagation(); - console.log('on download'); + console.log('on download', audioUrl); + // 使用 URL 对象解析 + const parsedUrl = new URL(audioUrl); + + // 获取路径名 + const pathname = parsedUrl.pathname; + // 提取文件名 + const filename = pathname.substring(pathname.lastIndexOf('/') + 1); + console.log('on preview', filename); + fetch(audioUrl) + .then((response) => response.blob()) + .then((blob) => { + saveAs(blob, filename); + }); // download url here - window.open(audioUrl, '_blank'); + // window.open(audioUrl, '_blank'); }, onPreview(event: MouseEvent, videoUrl: string) { event.stopPropagation(); - console.log('on preview'); + console.log('on preview', videoUrl); // preview url here window.open(videoUrl, '_blank'); } diff --git a/src/i18n/zh-CN/suno.json b/src/i18n/zh-CN/suno.json index 12dcbcf3..381f73ca 100644 --- a/src/i18n/zh-CN/suno.json +++ b/src/i18n/zh-CN/suno.json @@ -11,6 +11,14 @@ "message": "视频", "description": "视频按钮文本" }, + "button.download_video": { + "message": "下载视频", + "description": "下载视频按钮文本" + }, + "button.download_audio": { + "message": "下载音乐", + "description": "下载音乐按钮文本" + }, "model.model1": { "message": "v2", "description": "用于生成音乐的模型" From 403bcaa3f6870e7f3d6062ed145c9fb4a3dad7c3 Mon Sep 17 00:00:00 2001 From: hyf-github-user <1348977728@qq.com> Date: Wed, 6 Nov 2024 23:06:43 +0800 Subject: [PATCH 3/4] add change --- ...acloud-nexior-5b35d836-e534-4236-99c2-5731103de68d.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@acedatacloud-nexior-5b35d836-e534-4236-99c2-5731103de68d.json diff --git a/change/@acedatacloud-nexior-5b35d836-e534-4236-99c2-5731103de68d.json b/change/@acedatacloud-nexior-5b35d836-e534-4236-99c2-5731103de68d.json new file mode 100644 index 00000000..812c5058 --- /dev/null +++ b/change/@acedatacloud-nexior-5b35d836-e534-4236-99c2-5731103de68d.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix suno use", + "packageName": "@acedatacloud/nexior", + "email": "1348977728@qq.com", + "dependentChangeType": "patch" +} From ddf27ff6d53ade026b521887a56389bc55bf1726 Mon Sep 17 00:00:00 2001 From: hyf-github-user <1348977728@qq.com> Date: Wed, 6 Nov 2024 23:16:31 +0800 Subject: [PATCH 4/4] update package --- package.json | 2 ++ yarn.lock | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/package.json b/package.json index 1b372d93..0c8346ed 100644 --- a/package.json +++ b/package.json @@ -42,11 +42,13 @@ "@fortawesome/vue-fontawesome": "^3.0.2", "@icon-park/vue-next": "^1.3.6", "@skjnldsv/vue-plyr": "^7.5.0", + "@types/file-saver": "^2.0.7", "axios": "^1.6.0", "codemirror": "^6.0.1", "copy-to-clipboard": "^3.3.3", "dayjs": "^1.10.7", "element-plus": "^2.2.28", + "file-saver": "^2.0.5", "github-markdown-css": "^5.1.0", "highlight.js": "^11.7.0", "mac-scrollbar": "^0.13.5", diff --git a/yarn.lock b/yarn.lock index 87043f3e..8b6ed50e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -778,6 +778,11 @@ resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== +"@types/file-saver@^2.0.7": + version "2.0.7" + resolved "https://registry.npmmirror.com/@types/file-saver/-/file-saver-2.0.7.tgz#8dbb2f24bdc7486c54aa854eb414940bbd056f7d" + integrity sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A== + "@types/fs-extra@^8.0.0": version "8.1.5" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.5.tgz#33aae2962d3b3ec9219b5aca2555ee00274f5927" @@ -2664,6 +2669,11 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-saver@^2.0.5: + version "2.0.5" + resolved "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38" + integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA== + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz"