From a0fe31e16cb808735275d2056aa45f948bb7be56 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 4 Dec 2024 16:48:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=8A=E7=82=B9=E6=BC=94=E7=A4=BA=E6=B2=A1?= =?UTF-8?q?=E6=9C=89api=E4=BC=A0=E5=85=A5=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049947 --user=刘瑞斌 【应用】应用列表中点演示按钮,跳转的页面没有带默认的api参数 https://www.tapd.cn/57709429/s/1625074 --- ui/src/views/application/index.vue | 39 +++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index 9aebc5144..3b2df8f21 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -185,6 +185,8 @@ const selectUserId = ref('all') const searchValue = ref('') +const apiInputParams = ref([]) + function copyApplication(row: any) { application.asyncGetApplicationDetail(row.id, loading).then((res: any) => { CopyApplicationDialogRef.value.open({ ...res.data, model_id: res.data.model }) @@ -234,9 +236,44 @@ function searchHandle() { paginationConfig.total = 0 getList() } + +function mapToUrlParams(map: any[]) { + const params = new URLSearchParams() + + map.forEach((item: any) => { + params.append(encodeURIComponent(item.name), encodeURIComponent(item.value)) + }) + + return params.toString() // 返回 URL 查询字符串 +} + function getAccessToken(id: string) { + applicationList.value.filter((app)=>app.id === id)[0]?.work_flow?.nodes + ?.filter((v: any) => v.id === 'base-node') + .map((v: any) => { + apiInputParams.value = v.properties.api_input_field_list + ? v.properties.api_input_field_list + .map((v: any) => { + return { + name: v.variable, + value: v.default_value + } + }) + : v.properties.input_field_list + ? v.properties.input_field_list + .filter((v: any) => v.assignment_method === 'api_input') + .map((v: any) => { + return { + name: v.variable, + value: v.default_value + } + }) + : [] + }) + + const apiParams = mapToUrlParams(apiInputParams.value) ? '?' + mapToUrlParams(apiInputParams.value) : '' application.asyncGetAccessToken(id, loading).then((res: any) => { - window.open(application.location + res?.data?.access_token) + window.open(application.location + res?.data?.access_token + apiParams) }) }