From c5fea2c79e77889261be1c2c8510a297b322c5e3 Mon Sep 17 00:00:00 2001 From: Silent YANG Date: Fri, 11 Oct 2024 18:00:39 +0800 Subject: [PATCH] edit func of channel share --- src/views/idea/channel/index.vue | 50 +++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/src/views/idea/channel/index.vue b/src/views/idea/channel/index.vue index c82f352..c149f09 100644 --- a/src/views/idea/channel/index.vue +++ b/src/views/idea/channel/index.vue @@ -67,8 +67,9 @@
{{ item.desc }} -
+
{{ item.create_time_text }}  + 编辑  删除
@@ -147,6 +148,7 @@ }) const formData = reactive({ + id: 0, title: '', desc: '', firmware: [] @@ -176,6 +178,7 @@ } const showUpload = () => { + formData.id = 0 formData.title = '' formData.desc = '' formData.firmware = [] @@ -190,19 +193,46 @@ }); return; } - await axios.post("https://k5ws.vicicode.cn/api/channel/add?server=1", { - 'title': formData.title, - 'desc': formData.desc, - 'data': formData.firmware[0].response.data.file.url - }, { - headers: { - 'ba-user-token': userStore.accountId - } - }) + if(formData.id === 0){ + await axios.post("https://k5ws.vicicode.cn/api/channel/add?server=1", { + 'title': formData.title, + 'desc': formData.desc, + 'data': formData.firmware[0].response.data.file.url + }, { + headers: { + 'ba-user-token': userStore.accountId + } + }) + }else{ + await axios.post("https://k5ws.vicicode.cn/api/channel/edit?server=1", { + 'id': formData.id, + 'title': formData.title, + 'desc': formData.desc, + 'data': formData.firmware[0].url ?? formData.firmware[0].response.data.file.url + }, { + headers: { + 'ba-user-token': userStore.accountId + } + }) + } state.showUpload = false; showPanel() } + const onET = async (id: any) => { + formData.id = id + formData.title = state.myList.filter((e: any)=>e.id == id)[0].title + formData.desc = state.myList.filter((e: any)=>e.id == id)[0].desc + formData.firmware = [ + { + name: state.myList.filter((e: any)=>e.id == id)[0].title, + status: 'success', + url: state.myList.filter((e: any)=>e.id == id)[0].file + } + ] + state.showUpload = true + } + const onDT = async (id: any) => { await axios.post("https://k5ws.vicicode.cn/api/channel/del?server=1", { 'id': id,