mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
feat: 添加 URL 输入提示,优化 iframe 测试功能的用户体验
This commit is contained in:
parent
df382dafb4
commit
7e6f3f92cf
@ -2267,4 +2267,7 @@ AI 分析已更新
|
||||
归档已完成任务
|
||||
你确定将列表【(*)】中所有已完成的任务归档吗?
|
||||
已归档列表中所有已完成任务
|
||||
归档失败,请稍后再试
|
||||
归档失败,请稍后再试
|
||||
|
||||
请输入 URL
|
||||
URL不能为空
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user