修改链接

new-map
ihzero 2023-05-22 17:52:01 +08:00
parent c77514378f
commit ce4621feb9
3 changed files with 58 additions and 7 deletions

View File

@ -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: '推荐',

View File

@ -57,7 +57,7 @@
</div>
</template>
</LinkModal>
<IframeModal v-model:visible="iframeModalShow" :footer="null" />
<IframeModal v-model:visible="iframeModalShow" :footer="null" :url="current.content" />
</div>
</template>
@ -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
}

View File

@ -30,11 +30,11 @@
/>
</div>
</div>
<div class="h-full mt-5">
<div class="h-full py-5">
<iframe
v-if="url"
v-if="urlStr"
onload="Javascript:setHeight(this)"
:src="url"
:src="urlStr"
frameborder="0"
width="100%"
height="100%"
@ -76,7 +76,7 @@
}
return attr
})
const url = computed(() => {
const urlStr = computed(() => {
return props.url
})
const closeModal = () => {
@ -97,8 +97,8 @@
}
return {
urlStr,
isFull,
url,
closeModal,
handleFull,
getBindValue,