feat: 优化
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onBeforeUnmount, nextTick, watch } from 'vue'
|
||||
import { Empty } from 'ant-design-vue'
|
||||
import { Empty, message } from 'ant-design-vue'
|
||||
import { SoundOutlined } from '@ant-design/icons-vue'
|
||||
import { useVoiceCopyStore } from '@/stores/voiceCopy'
|
||||
import { useTTS, TTS_PROVIDERS } from '@/composables/useTTS'
|
||||
@@ -205,6 +205,14 @@ const initPlayer = (url) => {
|
||||
|
||||
nextTick(() => {
|
||||
try {
|
||||
// 检查容器是否存在
|
||||
if (!playerContainer.value) {
|
||||
message.error('播放器容器未就绪')
|
||||
isPlayerInitializing.value = false
|
||||
audioUrl.value = ''
|
||||
return
|
||||
}
|
||||
|
||||
player = new APlayer({
|
||||
container: playerContainer.value,
|
||||
autoplay: true,
|
||||
@@ -225,6 +233,7 @@ const initPlayer = (url) => {
|
||||
|
||||
player.on('error', (e) => {
|
||||
console.error('APlayer 播放错误:', e)
|
||||
message.error('音频播放失败,请重试')
|
||||
})
|
||||
|
||||
player.on('canplay', () => {
|
||||
@@ -232,7 +241,9 @@ const initPlayer = (url) => {
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('APlayer 初始化失败:', e)
|
||||
message.error('播放器初始化失败,请重试')
|
||||
isPlayerInitializing.value = false
|
||||
audioUrl.value = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ref, reactive } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { MaterialService } from '@/api/material'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { OSS_ORIGINAL, isDev } from '@gold/config/api'
|
||||
|
||||
// GB转字节常量
|
||||
const GB_TO_BYTES = 1073741824
|
||||
@@ -106,11 +107,12 @@ export function useUpload() {
|
||||
reject(new Error('网络错误,上传失败'))
|
||||
})
|
||||
|
||||
// 发起PUT请求 - 使用代理路径
|
||||
const uploadUrl = presignedData.presignedUrl.replace(
|
||||
'https://muye-ai-chat.oss-cn-hangzhou.aliyuncs.com',
|
||||
'/oss'
|
||||
)
|
||||
// 发起PUT请求
|
||||
// 开发环境:使用 /oss 代理避免CORS问题
|
||||
// 生产环境:直接使用OSS原始域名(需要OSS配置CORS)
|
||||
const uploadUrl = isDev()
|
||||
? presignedData.presignedUrl.replace(OSS_ORIGINAL, '/oss')
|
||||
: presignedData.presignedUrl
|
||||
xhr.open('PUT', uploadUrl)
|
||||
if (presignedData.headers && presignedData.headers['Content-Type']) {
|
||||
xhr.setRequestHeader('Content-Type', presignedData.headers['Content-Type'])
|
||||
|
||||
@@ -406,10 +406,16 @@ const handleSaveGroupName = async (group) => {
|
||||
const handleDeleteGroup = async (group, event) => {
|
||||
event?.stopPropagation?.()
|
||||
|
||||
// 校验:分组内还有文件时不允许删除
|
||||
if (group.fileCount > 0) {
|
||||
message.warning(`分组「${group.name}」内还有 ${group.fileCount} 个文件,请先删除文件后再删除分组`)
|
||||
return
|
||||
}
|
||||
|
||||
const confirmed = await new Promise((resolve) => {
|
||||
Modal.confirm({
|
||||
title: '删除分组',
|
||||
content: `确定要删除分组「${group.name}」吗?删除后该分组下的所有文件将被移动到默认分组。此操作不可恢复。`,
|
||||
content: `确定要删除分组「${group.name}」吗?此操作不可恢复。`,
|
||||
okText: '确认删除',
|
||||
cancelText: '取消',
|
||||
okType: 'danger',
|
||||
|
||||
@@ -70,7 +70,7 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
},
|
||||
'/oss': {
|
||||
target: 'https://muye-ai-chat.oss-cn-hangzhou.aliyuncs.com',
|
||||
target: 'https://oss.muyetools.cn',
|
||||
changeOrigin: true,
|
||||
rewrite: (path: string) => path.replace(/^\/oss/, ''),
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user