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" +} diff --git a/package.json b/package.json index b874a003..fe5a2859 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/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 @@ + {{ $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/index.json b/src/i18n/zh-CN/index.json index ee1b57e8..8921919d 100644 --- a/src/i18n/zh-CN/index.json +++ b/src/i18n/zh-CN/index.json @@ -19,6 +19,10 @@ "message": "AI 视频", "description": "AI 视频章节标题" }, + "title.headshots": { + "message": "AI 证件照", + "description": "AI 证件照章节标题" + }, "title.comments": { "message": "客户评价", "description": "客户评价章节标题" 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": "用于生成音乐的模型" 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"