Restructure backend and frontend modules; add story, library, and editor schema migrations. Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews. Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
46 lines
1.4 KiB
Vue
46 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { Share } from '@element-plus/icons-vue'
|
|
import { useAssetsStore } from '../stores/assets'
|
|
import { useSharedAssetsStore } from '../stores/sharedAssets'
|
|
import { errorMessage } from '../api'
|
|
const props = defineProps<{ assetId: string; disabled?: boolean }>(),
|
|
busy = ref(false),
|
|
assets = useAssetsStore(),
|
|
shared = useSharedAssetsStore()
|
|
async function publish() {
|
|
if (props.disabled || busy.value) return
|
|
const id = props.assetId,
|
|
session = assets.sessionId()
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
'将此素材的独立副本发布到共享库,所有已登录用户均可查看、下载和导入使用。撤回发布后,其他用户已经导入的副本仍会保留。是否发布?',
|
|
'发布到共享库',
|
|
{ confirmButtonText: '发布副本', cancelButtonText: '暂不发布', type: 'warning' },
|
|
)
|
|
} catch {
|
|
return
|
|
}
|
|
if (session !== assets.sessionId() || assets.deleted[id]) return
|
|
busy.value = true
|
|
try {
|
|
if (await shared.publish(id)) ElMessage.success('独立副本已发布到共享库')
|
|
} catch (error) {
|
|
ElMessage.error(errorMessage(error))
|
|
} finally {
|
|
busy.value = false
|
|
}
|
|
}
|
|
</script>
|
|
<template>
|
|
<el-button
|
|
text
|
|
:icon="Share"
|
|
:loading="busy"
|
|
:disabled="disabled"
|
|
@click="publish"
|
|
>发布到共享库</el-button
|
|
>
|
|
</template>
|