From aa638475e955207a5d5f76f9ec99415b5a18f5db Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 25 八月 2022 12:30:32 +0800 Subject: [PATCH] update 同步 ruoyi 新功能 --- ruoyi-ui/src/layout/components/IframeToggle/index.vue | 24 ++++++ ruoyi-ui/src/views/system/role/index.vue | 1 ruoyi-ui/src/components/ImageUpload/index.vue | 2 ruoyi-ui/src/views/system/menu/index.vue | 14 +- ruoyi-ui/src/layout/components/AppMain.vue | 10 + ruoyi-ui/src/layout/components/InnerLink/index.vue | 62 ++++++++++----- pom.xml | 1 ruoyi-ui/src/components/ImagePreview/index.vue | 8 + ruoyi-ui/src/views/system/user/profile/index.vue | 2 ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java | 5 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 1 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 2 ruoyi-ui/src/layout/components/TagsView/index.vue | 6 + ruoyi-ui/src/assets/styles/transition.scss | 5 + ruoyi-ui/src/store/modules/tagsView.js | 45 ++++++++--- 15 files changed, 141 insertions(+), 47 deletions(-) diff --git a/pom.xml b/pom.xml index 8bf0a3e..47edac0 100644 --- a/pom.xml +++ b/pom.xml @@ -434,3 +434,4 @@ </profiles> </project> + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index e939273..d1c6c57 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -247,4 +247,5 @@ public R<List<Tree<Long>>> deptTree(SysDept dept) { return R.ok(deptService.selectDeptTreeList(dept)); } + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 9df3a4a..e634ed2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -18,6 +18,11 @@ String GBK = "GBK"; /** + * www涓诲煙 + */ + String WWW = "www."; + + /** * http璇锋眰 */ String HTTP = "http://"; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index c29bfab..a573fda 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -447,7 +447,7 @@ * @return */ public String innerLinkReplaceEach(String path) { - return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS}, + return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "." }, new String[]{"", ""}); } } diff --git a/ruoyi-ui/src/assets/styles/transition.scss b/ruoyi-ui/src/assets/styles/transition.scss index 4cb27cc..eb49895 100644 --- a/ruoyi-ui/src/assets/styles/transition.scss +++ b/ruoyi-ui/src/assets/styles/transition.scss @@ -12,11 +12,16 @@ } /* fade-transform */ +.fade-transform--move, .fade-transform-leave-active, .fade-transform-enter-active { transition: all .5s; } +.fade-transform-leave-active { + position: absolute; +} + .fade-transform-enter { opacity: 0; transform: translateX(-30px); diff --git a/ruoyi-ui/src/components/ImagePreview/index.vue b/ruoyi-ui/src/components/ImagePreview/index.vue index 671eda3..cd99626 100644 --- a/ruoyi-ui/src/components/ImagePreview/index.vue +++ b/ruoyi-ui/src/components/ImagePreview/index.vue @@ -18,7 +18,7 @@ props: { src: { type: String, - required: true + default: "" }, width: { type: [Number, String], @@ -31,10 +31,16 @@ }, computed: { realSrc() { + if (!this.src) { + return; + } let real_src = this.src.split(",")[0]; return real_src; }, realSrcList() { + if (!this.src) { + return; + } let real_src_list = this.src.split(","); let srcList = []; real_src_list.forEach(item => { diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index 981ca46..9c92e86 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -208,7 +208,7 @@ } } return strs != "" ? strs.substr(0, strs.length - 1) : ""; - }, + } } }; </script> diff --git a/ruoyi-ui/src/layout/components/AppMain.vue b/ruoyi-ui/src/layout/components/AppMain.vue index 0c6f4b7..f4e74db 100644 --- a/ruoyi-ui/src/layout/components/AppMain.vue +++ b/ruoyi-ui/src/layout/components/AppMain.vue @@ -2,15 +2,19 @@ <section class="app-main"> <transition name="fade-transform" mode="out-in"> <keep-alive :include="cachedViews"> - <router-view :key="key" /> + <router-view v-if="!$route.meta.link" :key="key" /> </keep-alive> </transition> + <iframe-toggle /> </section> </template> <script> +import iframeToggle from "./IframeToggle/index" + export default { name: 'AppMain', + components: { iframeToggle }, computed: { cachedViews() { return this.$store.state.tagsView.cachedViews @@ -31,7 +35,7 @@ overflow: hidden; } -.fixed-header+.app-main { +.fixed-header + .app-main { padding-top: 50px; } @@ -41,7 +45,7 @@ min-height: calc(100vh - 84px); } - .fixed-header+.app-main { + .fixed-header + .app-main { padding-top: 84px; } } diff --git a/ruoyi-ui/src/layout/components/IframeToggle/index.vue b/ruoyi-ui/src/layout/components/IframeToggle/index.vue new file mode 100644 index 0000000..eeddc87 --- /dev/null +++ b/ruoyi-ui/src/layout/components/IframeToggle/index.vue @@ -0,0 +1,24 @@ +<template> + <transition-group name="fade-transform" mode="out-in"> + <inner-link + v-for="(item, index) in iframeViews" + :key="item.path" + :iframeId="'iframe' + index" + v-show="$route.path === item.path" + :src="item.meta.link" + ></inner-link> + </transition-group> +</template> + +<script> +import InnerLink from "../InnerLink/index" + +export default { + components: { InnerLink }, + computed: { + iframeViews() { + return this.$store.state.tagsView.iframeViews + } + } +} +</script> diff --git a/ruoyi-ui/src/layout/components/InnerLink/index.vue b/ruoyi-ui/src/layout/components/InnerLink/index.vue index 227ff2a..6edcdec 100644 --- a/ruoyi-ui/src/layout/components/InnerLink/index.vue +++ b/ruoyi-ui/src/layout/components/InnerLink/index.vue @@ -1,27 +1,47 @@ +<template> + <div :style="'height:' + height" v-loading="loading" element-loading-text="姝e湪鍔犺浇椤甸潰锛岃绋嶅�欙紒"> + <iframe + :id="iframeId" + style="width: 100%; height: 100%" + :src="src" + frameborder="no" + ></iframe> + </div> +</template> + <script> export default { - data() { - return {}; - }, - render() { - const { $route: { meta: { link } }, } = this; - if ({ link }.link === "") { - return "404"; + props: { + src: { + type: String, + default: "/" + }, + iframeId: { + type: String } - let url = { link }.link; - const height = document.documentElement.clientHeight - 94.5 + "px"; - const style = { height: height }; - - return ( - <div style={style}> - <iframe - src={url} - frameborder="no" - style="width: 100%; height: 100%" - scrolling="auto" - ></iframe> - </div> - ); }, + data() { + return { + loading: false, + height: document.documentElement.clientHeight - 94.5 + "px;" + }; + }, + mounted() { + var _this = this; + const iframeId = ("#" + this.iframeId).replace(/\//g, "\\/"); + const iframe = document.querySelector(iframeId); + // iframe椤甸潰loading鎺у埗 + if (iframe.attachEvent) { + this.loading = true; + iframe.attachEvent("onload", function () { + _this.loading = false; + }); + } else { + this.loading = true; + iframe.onload = function () { + _this.loading = false; + }; + } + } }; </script> diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue index 20c4b55..cc98071 100644 --- a/ruoyi-ui/src/layout/components/TagsView/index.vue +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -133,6 +133,9 @@ const { name } = this.$route if (name) { this.$store.dispatch('tagsView/addView', this.$route) + if (this.$route.meta.link) { + this.$store.dispatch('tagsView/addIframeView', this.$route) + } } return false }, @@ -153,6 +156,9 @@ }, refreshSelectedTag(view) { this.$tab.refreshPage(view); + if (this.$route.meta.link) { + this.$store.dispatch('tagsView/delIframeView', this.$route) + } }, closeSelectedTag(view) { this.$tab.closePage(view).then(({ visitedViews }) => { diff --git a/ruoyi-ui/src/store/modules/tagsView.js b/ruoyi-ui/src/store/modules/tagsView.js index 002c1d0..5fc011c 100644 --- a/ruoyi-ui/src/store/modules/tagsView.js +++ b/ruoyi-ui/src/store/modules/tagsView.js @@ -1,9 +1,18 @@ const state = { visitedViews: [], - cachedViews: [] + cachedViews: [], + iframeViews: [] } const mutations = { + ADD_IFRAME_VIEW: (state, view) => { + if (state.iframeViews.some(v => v.path === view.path)) return + state.iframeViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) + }, ADD_VISITED_VIEW: (state, view) => { if (state.visitedViews.some(v => v.path === view.path)) return state.visitedViews.push( @@ -18,7 +27,6 @@ state.cachedViews.push(view.name) } }, - DEL_VISITED_VIEW: (state, view) => { for (const [i, v] of state.visitedViews.entries()) { if (v.path === view.path) { @@ -26,6 +34,10 @@ break } } + state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) + }, + DEL_IFRAME_VIEW: (state, view) => { + state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) }, DEL_CACHED_VIEW: (state, view) => { const index = state.cachedViews.indexOf(view.name) @@ -36,6 +48,7 @@ state.visitedViews = state.visitedViews.filter(v => { return v.meta.affix || v.path === view.path }) + state.iframeViews = state.iframeViews.filter(item => item.path === view.path) }, DEL_OTHERS_CACHED_VIEWS: (state, view) => { const index = state.cachedViews.indexOf(view.name) @@ -45,16 +58,15 @@ state.cachedViews = [] } }, - DEL_ALL_VISITED_VIEWS: state => { // keep affix tags const affixTags = state.visitedViews.filter(tag => tag.meta.affix) state.visitedViews = affixTags + state.iframeViews = [] }, DEL_ALL_CACHED_VIEWS: state => { state.cachedViews = [] }, - UPDATE_VISITED_VIEW: (state, view) => { for (let v of state.visitedViews) { if (v.path === view.path) { @@ -63,7 +75,6 @@ } } }, - DEL_RIGHT_VIEWS: (state, view) => { const index = state.visitedViews.findIndex(v => v.path === view.path) if (index === -1) { @@ -77,10 +88,13 @@ if (i > -1) { state.cachedViews.splice(i, 1) } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } return false }) }, - DEL_LEFT_VIEWS: (state, view) => { const index = state.visitedViews.findIndex(v => v.path === view.path) if (index === -1) { @@ -94,6 +108,10 @@ if (i > -1) { state.cachedViews.splice(i, 1) } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } return false }) } @@ -104,13 +122,15 @@ dispatch('addVisitedView', view) dispatch('addCachedView', view) }, + addIframeView({ commit }, view) { + commit('ADD_IFRAME_VIEW', view) + }, addVisitedView({ commit }, view) { commit('ADD_VISITED_VIEW', view) }, addCachedView({ commit }, view) { commit('ADD_CACHED_VIEW', view) }, - delView({ dispatch, state }, view) { return new Promise(resolve => { dispatch('delVisitedView', view) @@ -127,13 +147,18 @@ resolve([...state.visitedViews]) }) }, + delIframeView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_IFRAME_VIEW', view) + resolve([...state.iframeViews]) + }) + }, delCachedView({ commit, state }, view) { return new Promise(resolve => { commit('DEL_CACHED_VIEW', view) resolve([...state.cachedViews]) }) }, - delOthersViews({ dispatch, state }, view) { return new Promise(resolve => { dispatch('delOthersVisitedViews', view) @@ -156,7 +181,6 @@ resolve([...state.cachedViews]) }) }, - delAllViews({ dispatch, state }, view) { return new Promise(resolve => { dispatch('delAllVisitedViews', view) @@ -179,18 +203,15 @@ resolve([...state.cachedViews]) }) }, - updateVisitedView({ commit }, view) { commit('UPDATE_VISITED_VIEW', view) }, - delRightTags({ commit }, view) { return new Promise(resolve => { commit('DEL_RIGHT_VIEWS', view) resolve([...state.visitedViews]) }) }, - delLeftTags({ commit }, view) { return new Promise(resolve => { commit('DEL_LEFT_VIEWS', view) diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 67d7e17..52eb8b9 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -107,7 +107,7 @@ <el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-row> <el-col :span="24"> - <el-form-item label="涓婄骇鑿滃崟"> + <el-form-item label="涓婄骇鑿滃崟" prop="parentId"> <treeselect v-model="form.parentId" :options="menuOptions" @@ -159,7 +159,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType != 'F'"> - <el-form-item> + <el-form-item prop="isFrame"> <span slot="label"> <el-tooltip content="閫夋嫨鏄閾惧垯璺敱鍦板潃闇�瑕佷互`http(s)://`寮�澶�" placement="top"> <i class="el-icon-question"></i> @@ -195,7 +195,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType != 'M'"> - <el-form-item> + <el-form-item prop="perms"> <el-input v-model="form.perms" placeholder="璇疯緭鍏ユ潈闄愭爣璇�" maxlength="100" /> <span slot="label"> <el-tooltip content="鎺у埗鍣ㄤ腑瀹氫箟鐨勬潈闄愬瓧绗︼紝濡傦細@SaCheckPermission('system:user:list')" placement="top"> @@ -206,7 +206,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType == 'C'"> - <el-form-item> + <el-form-item prop="queryParam"> <el-input v-model="form.queryParam" placeholder="璇疯緭鍏ヨ矾鐢卞弬鏁�" maxlength="255" /> <span slot="label"> <el-tooltip content='璁块棶璺敱鐨勯粯璁や紶閫掑弬鏁帮紝濡傦細`{"id": 1, "name": "ry"}`' placement="top"> @@ -217,7 +217,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType == 'C'"> - <el-form-item> + <el-form-item prop="isCache"> <span slot="label"> <el-tooltip content="閫夋嫨鏄垯浼氳`keep-alive`缂撳瓨锛岄渶瑕佸尮閰嶇粍浠剁殑`name`鍜屽湴鍧�淇濇寔涓�鑷�" placement="top"> <i class="el-icon-question"></i> @@ -231,7 +231,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType != 'F'"> - <el-form-item> + <el-form-item prop="visible"> <span slot="label"> <el-tooltip content="閫夋嫨闅愯棌鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼絾浠嶇劧鍙互璁块棶" placement="top"> <i class="el-icon-question"></i> @@ -248,7 +248,7 @@ </el-form-item> </el-col> <el-col :span="12" v-if="form.menuType != 'F'"> - <el-form-item> + <el-form-item prop="status"> <span slot="label"> <el-tooltip content="閫夋嫨鍋滅敤鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼篃涓嶈兘琚闂�" placement="top"> <i class="el-icon-question"></i> diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index c14984b..77d1d6a 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -605,3 +605,4 @@ } }; </script> + diff --git a/ruoyi-ui/src/views/system/user/profile/index.vue b/ruoyi-ui/src/views/system/user/profile/index.vue index 7a3e295..2cc7c2f 100644 --- a/ruoyi-ui/src/views/system/user/profile/index.vue +++ b/ruoyi-ui/src/views/system/user/profile/index.vue @@ -49,7 +49,7 @@ <userInfo :user="user" /> </el-tab-pane> <el-tab-pane label="淇敼瀵嗙爜" name="resetPwd"> - <resetPwd :user="user" /> + <resetPwd /> </el-tab-pane> </el-tabs> </el-card> -- Gitblit v1.9.3