feat: 添加 URL 输入提示,优化 iframe 测试功能的用户体验

This commit is contained in:
kuaifan 2025-11-24 01:23:22 +00:00
parent df382dafb4
commit 7e6f3f92cf
2 changed files with 41 additions and 4 deletions

View File

@ -2267,4 +2267,7 @@ AI 分析已更新
归档已完成任务
你确定将列表【(*)】中所有已完成的任务归档吗?
已归档列表中所有已完成任务
归档失败,请稍后再试
归档失败,请稍后再试
请输入 URL
URL不能为空

View File

@ -3,10 +3,14 @@
</template>
<script>
import {mapState} from "vuex";
import MicroApps from "../../components/MicroApps";
export default {
components: { MicroApps },
computed: {
...mapState(['userIsAdmin']),
},
async mounted() {
const {name} = this.$route.params;
@ -17,11 +21,23 @@ export default {
// iframe
if (name === 'iframe-test') {
const {url} = this.$route.query;
if (!url) {
$A.modalError("URL不能为空");
if (!this.userIsAdmin) {
return
}
let {url} = this.$route.query;
if (!url) {
url = await this.promptIframeUrl();
if (!url) {
return
}
this.$router.replace({
path: this.$route.path,
query: {
...this.$route.query,
url
}
}).catch(() => {});
}
await this.$refs.app.onOpen({
id: 'iframe-test',
name: 'iframe-test',
@ -40,6 +56,24 @@ export default {
}
await this.$refs.app.onOpen(app)
},
methods: {
promptIframeUrl() {
return new Promise((resolve, reject) => {
$A.modalInput({
title: this.$L("请输入 URL"),
placeholder: "https://example.com",
onOk: (val) => {
const input = (val || "").trim();
if (!input) {
return this.$L("URL不能为空");
}
resolve(input);
},
onCancel: () => reject()
});
}).catch(() => null);
}
}
}
</script>