增加激活按钮
parent
398b415410
commit
684e71358c
|
@ -69,3 +69,8 @@ export const deleteTaskAPI = (taskId: string) => {
|
|||
export const checkCloneTaskAPI = (roleId: string) => {
|
||||
return request.get(`/system/charter/checkCloneTask/${roleId}`);
|
||||
};
|
||||
|
||||
// 添加激活声音接口
|
||||
export const activateVoiceAPI = (roleId: string) => {
|
||||
return request.post(`/system/charter/activateVoice/${roleId}`);
|
||||
};
|
||||
|
|
|
@ -50,7 +50,10 @@
|
|||
</div>
|
||||
<div class="flex justify-end">
|
||||
<ElButton @click="handleEdit(item)" type="warning" size="small">编辑</ElButton>
|
||||
<ElButton v-if="!item.activate" @click="handleClone(item)" type="primary" size="small" class="ml-2" :disabled="item.remainingCloneCount === 0">克隆音频</ElButton>
|
||||
<template v-if="!item.activate">
|
||||
<ElButton @click="handleClone(item)" type="primary" size="small" class="ml-2" :disabled="item.remainingCloneCount === 0"> 克隆音频 </ElButton>
|
||||
<ElButton v-if="item.originAudioUrl" @click="handleActivate(item)" type="success" size="small" class="ml-2"> 激活声音 </ElButton>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
@ -163,8 +166,8 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { addSystemCharterAPI, querySystemCharterAPI, editSystemCharterAPI, getSystemCharterDetailAPI } from "@/api/SystemCharter";
|
||||
import { ElButton, ElLoading, ElMessage, FormInstance, ElPagination, UploadProps } from "element-plus";
|
||||
import { addSystemCharterAPI, querySystemCharterAPI, editSystemCharterAPI, getSystemCharterDetailAPI, activateVoiceAPI } from "@/api/SystemCharter";
|
||||
import { ElButton, ElLoading, ElMessage, FormInstance, ElPagination, UploadProps, ElMessageBox } from "element-plus";
|
||||
import { UploadFilled, Delete, Plus, Document, Check, Search } from "@element-plus/icons-vue";
|
||||
import createOss, { OssPath } from "@/utils/oss";
|
||||
import CloneSpeak from "./CloneSpeak.vue";
|
||||
|
@ -399,6 +402,31 @@ const handleClone = (item: any) => {
|
|||
const showTaskList = () => {
|
||||
taskListVisible.value = true;
|
||||
};
|
||||
|
||||
// 添加激活处理方法
|
||||
const handleActivate = async (item: any) => {
|
||||
try {
|
||||
await ElMessageBox.confirm("激活后将不能继续克隆,是否确认激活?", "激活确认", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
|
||||
const loading = ElLoading.service();
|
||||
try {
|
||||
await activateVoiceAPI(item.id);
|
||||
ElMessage.success("激活成功");
|
||||
// 刷新列表
|
||||
initSystemCharterDataSource();
|
||||
} finally {
|
||||
loading.close();
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== "cancel") {
|
||||
ElMessage.error("激活失败");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue