mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {mapState} from "vuex";
|
||||||
import MicroApps from "../../components/MicroApps";
|
import MicroApps from "../../components/MicroApps";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { MicroApps },
|
components: { MicroApps },
|
||||||
|
computed: {
|
||||||
|
...mapState(['userIsAdmin']),
|
||||||
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const {name} = this.$route.params;
|
const {name} = this.$route.params;
|
||||||
@ -17,11 +21,23 @@ export default {
|
|||||||
|
|
||||||
// iframe 测试
|
// iframe 测试
|
||||||
if (name === 'iframe-test') {
|
if (name === 'iframe-test') {
|
||||||
const {url} = this.$route.query;
|
if (!this.userIsAdmin) {
|
||||||
if (!url) {
|
|
||||||
$A.modalError("URL不能为空");
|
|
||||||
return
|
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({
|
await this.$refs.app.onOpen({
|
||||||
id: 'iframe-test',
|
id: 'iframe-test',
|
||||||
name: 'iframe-test',
|
name: 'iframe-test',
|
||||||
@ -40,6 +56,24 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.$refs.app.onOpen(app)
|
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>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user