From 6c33f9c50792c03e55549f82c17405552ecff540 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期三, 08 二月 2023 17:18:09 +0800 Subject: [PATCH] IFME主题切换效果优化,角色管理,资源管理主题切换界面优化 --- src/views/PackageTwo/WareInspection.vue | 78 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/views/PackageTwo/WareInspection.vue b/src/views/PackageTwo/WareInspection.vue index 1aa26e1..e89b3cf 100644 --- a/src/views/PackageTwo/WareInspection.vue +++ b/src/views/PackageTwo/WareInspection.vue @@ -2,6 +2,7 @@ <template> <div class="wareBox"> <iframe + id="ifream" style="border:none" width="100%" height="100%" @@ -15,15 +16,83 @@ export default { data() { return { - reportUrl: '' + reportUrl: '', + url: '', + } + }, + computed: { + Obj() { + return this.$store.state.themeflag + }, + lang() { + return this.$store.state.language + } + }, + watch: { + Obj(newVal, oldVal) { + //鍙互瀵规暟鎹墽琛岀浉搴旂殑鎿嶄綔 + this.refreash(newVal) + }, + lang(newVal, oldVal) { + this.langreash(newVal) } }, methods: { + langreash(res) { + if (this.url == '') return + this.reportUrl = '' + if (res == true) { + if (this.url.indexOf('theme=white') != -1) { + this.url = this.url.replace('theme=white', 'theme=dark'); + } + } else if (res == false) { + if (this.url.indexOf('theme=dark') != -1) { + this.url = this.url.replace('theme=dark', 'theme=white'); + } + } + this.reportUrl = this.url; + this.$store.state.reporturl = this.url; + this.$router.push('/QualityInspection') + }, + refreash(res) { + if (this.url == '') return + this.reportUrl = '' + if (res == true) { + if (this.url.indexOf('lang=en') != -1) { + this.url = this.url.replace('lang=en', 'lang=zh'); + } + } else if (res == false) { + if (this.url.indexOf('lang=zh') != -1) { + this.url = this.url.replace('lang=zh', 'lang=en'); + } + } + this.reportUrl = this.url; + this.$store.state.reporturl = this.url; + this.$router.push('/QualityInspection') + }, showChangeIfream(res) { + if (this.$store.state.themeflag == true) { + if (res.indexOf('theme=white') != -1) { + res = res.replace('theme=white', 'theme=dark'); + } + } else if (this.$store.state.themeflag == false) { + if (res.indexOf('theme=dark') != -1) { + res = res.replace('theme=dark', 'theme=white'); + } + } + if (this.$store.state.language == true) { + if (res.indexOf('lang=en') != -1) { + res = res.replace('lang=en', 'lang=zh'); + } + } else if (this.$store.state.language == false) { + if (res.indexOf('lang=zh') != -1) { + res = res.replace('lang=zh', 'lang=en'); + } + } if (res.indexOf('{fmeHost}') != -1) { - - res = res.replace('{fmeHost}',fmeHost ) + + res = res.replace('{fmeHost}', fmeHost) } if (res.indexOf('token=') != -1) { @@ -32,12 +101,13 @@ this.$store.state.reporturl = res; this.reportUrl = res; + this.url = res // console.log("2", this.reportUrl) } }, mounted() { this.showChangeIfream(this.$store.reporturl) - // console.log("1", this.reportUrl) + this.$bus.$on('changeNaveUrl', (res) => { this.showChangeIfream(res) }); -- Gitblit v1.9.3