增加激活按钮
parent
398b415410
commit
684e71358c
|
@ -69,3 +69,8 @@ export const deleteTaskAPI = (taskId: string) => {
|
||||||
export const checkCloneTaskAPI = (roleId: string) => {
|
export const checkCloneTaskAPI = (roleId: string) => {
|
||||||
return request.get(`/system/charter/checkCloneTask/${roleId}`);
|
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>
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end">
|
||||||
<ElButton @click="handleEdit(item)" type="warning" size="small">编辑</ElButton>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -163,8 +166,8 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, reactive, watch } from "vue";
|
import { ref, onMounted, reactive, watch } from "vue";
|
||||||
import { addSystemCharterAPI, querySystemCharterAPI, editSystemCharterAPI, getSystemCharterDetailAPI } from "@/api/SystemCharter";
|
import { addSystemCharterAPI, querySystemCharterAPI, editSystemCharterAPI, getSystemCharterDetailAPI, activateVoiceAPI } from "@/api/SystemCharter";
|
||||||
import { ElButton, ElLoading, ElMessage, FormInstance, ElPagination, UploadProps } from "element-plus";
|
import { ElButton, ElLoading, ElMessage, FormInstance, ElPagination, UploadProps, ElMessageBox } from "element-plus";
|
||||||
import { UploadFilled, Delete, Plus, Document, Check, Search } from "@element-plus/icons-vue";
|
import { UploadFilled, Delete, Plus, Document, Check, Search } from "@element-plus/icons-vue";
|
||||||
import createOss, { OssPath } from "@/utils/oss";
|
import createOss, { OssPath } from "@/utils/oss";
|
||||||
import CloneSpeak from "./CloneSpeak.vue";
|
import CloneSpeak from "./CloneSpeak.vue";
|
||||||
|
@ -399,6 +402,31 @@ const handleClone = (item: any) => {
|
||||||
const showTaskList = () => {
|
const showTaskList = () => {
|
||||||
taskListVisible.value = true;
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue