diff --git a/src/views/system/links/links.data.ts b/src/views/system/links/links.data.ts index fe44c2e1..26f6d5ee 100644 --- a/src/views/system/links/links.data.ts +++ b/src/views/system/links/links.data.ts @@ -59,6 +59,41 @@ export const columns: BasicColumn[] = [ return h(Tag, { color: color }, () => text) }, }, + { + title: '内链', + dataIndex: 'is_iframe', + width: 100, + customRender: ({ record }) => { + if (!Reflect.has(record, 'pendingShowStatus')) { + record.pendingShowStatus = false + } + return h(Switch, { + checked: record.is_iframe === 1, + checkedChildren: '开启', + unCheckedChildren: '关闭', + loading: record.pendingShowStatus, + onChange(checked: boolean) { + record.pendingShowStatus = true + const newStatus = checked ? 1 : 0 + const { createMessage } = useMessage() + updateFriendinks({ + id: record.id, + is_iframe: checked, + }) + .then(() => { + record.is_iframe = newStatus + createMessage.success(`已成功设置内链状态`) + }) + .catch(() => { + createMessage.error('修改内链状态失败') + }) + .finally(() => { + record.pendingShowStatus = false + }) + }, + }) + }, + }, { title: '推荐', dataIndex: 'is_recommend', @@ -197,6 +232,17 @@ export const accountFormSchema: FormSchema[] = [ precision: 0, }, }, + { + field: 'is_iframe', + label: '是否内链', + required: true, + defaultValue: false, + component: 'Switch', + componentProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + }, { field: 'is_recommend', label: '推荐', diff --git a/src/views/visualization/components/Footer.vue b/src/views/visualization/components/Footer.vue index cee7a1b6..ce7b1526 100644 --- a/src/views/visualization/components/Footer.vue +++ b/src/views/visualization/components/Footer.vue @@ -57,7 +57,7 @@ - + @@ -118,7 +118,12 @@ function onClick(e) { current.value = e if (e.type == 1) { - window.open(e.content) + console.log(e) + if (e.is_iframe == 1) { + iframeModalShow.value = true + } else { + window.open(e.content) + } } else { visibleModal.value = true } diff --git a/src/views/visualization/components/IframeModal.vue b/src/views/visualization/components/IframeModal.vue index 88ae19e1..7a1a15b8 100644 --- a/src/views/visualization/components/IframeModal.vue +++ b/src/views/visualization/components/IframeModal.vue @@ -30,11 +30,11 @@ /> -
+