From 669a325fc5cb1e9fcfdc2d2f8642763966338cd0 Mon Sep 17 00:00:00 2001 From: lixuliang <lixuliang_hd@126.com> Date: 星期四, 29 八月 2024 18:01:48 +0800 Subject: [PATCH] se-ui --- se-ui/src/utils/request.js | 68 +++++++++-------- se-ui/src/layout/components/Navbar.vue | 57 +++++++------ se-ui/.env.staging | 2 se-ui/src/permission.js | 20 ++++- se-ui/src/views/system/user/profile/index.vue | 7 + se-ui/src/components/Breadcrumb/index.vue | 4 se-ui/src/views/login.vue | 6 se-ui/src/views/system/role/index.vue | 33 ++++++- se-ui/.env.development | 2 se-ui/.env.production | 2 se-ui/vue.config.js | 3 11 files changed, 128 insertions(+), 76 deletions(-) diff --git a/se-ui/.env.development b/se-ui/.env.development index 4462057..2fbdd7f 100644 --- a/se-ui/.env.development +++ b/se-ui/.env.development @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 绠$悊绯荤粺 +VUE_APP_TITLE = 缁煎悎绠$悊鍒嗙郴缁� # 寮�鍙戠幆澧冮厤缃� ENV = 'development' diff --git a/se-ui/.env.production b/se-ui/.env.production index 13ffacb..7d29c97 100644 --- a/se-ui/.env.production +++ b/se-ui/.env.production @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 绠$悊绯荤粺 +VUE_APP_TITLE = 缁煎悎绠$悊鍒嗙郴缁� # 鐢熶骇鐜閰嶇疆 ENV = 'production' diff --git a/se-ui/.env.staging b/se-ui/.env.staging index b08e82f..b2791cb 100644 --- a/se-ui/.env.staging +++ b/se-ui/.env.staging @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 绠$悊绯荤粺 +VUE_APP_TITLE = 缁煎悎绠$悊鍒嗙郴缁� NODE_ENV = production diff --git a/se-ui/src/components/Breadcrumb/index.vue b/se-ui/src/components/Breadcrumb/index.vue index 1696f54..a13b7b0 100644 --- a/se-ui/src/components/Breadcrumb/index.vue +++ b/se-ui/src/components/Breadcrumb/index.vue @@ -35,10 +35,12 @@ const first = matched[0] if (!this.isDashboard(first)) { - matched = [{ path: '/index', meta: { title: '棣栭〉' }}].concat(matched) + // matched = [{ path: '/index', meta: { title: '棣栭〉' }}].concat(matched) } this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) + + }, isDashboard(route) { const name = route && route.name diff --git a/se-ui/src/layout/components/Navbar.vue b/se-ui/src/layout/components/Navbar.vue index 4806bea..7673e93 100644 --- a/se-ui/src/layout/components/Navbar.vue +++ b/se-ui/src/layout/components/Navbar.vue @@ -1,13 +1,18 @@ <template> <div class="navbar"> - <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> + <hamburger + id="hamburger-container" + :is-active="sidebar.opened" + class="hamburger-container" + @toggleClick="toggleSideBar" + /> - <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/> - <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/> + <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav" /> + <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" /> <div class="right-menu"> <template v-if="device!=='mobile'"> - <search id="header-search" class="right-menu-item" /> + <!-- <search id="header-search" class="right-menu-item" /> --> <!-- <el-tooltip content="婧愮爜鍦板潃" effect="dark" placement="bottom"> <se-git id="se-git" class="right-menu-item hover-effect" /> @@ -15,28 +20,27 @@ <el-tooltip content="鏂囨。鍦板潃" effect="dark" placement="bottom"> <se-doc id="se-doc" class="right-menu-item hover-effect" /> - </el-tooltip> --> + </el-tooltip>--> <screenfull id="screenfull" class="right-menu-item hover-effect" /> - <el-tooltip content="甯冨眬澶у皬" effect="dark" placement="bottom"> + <!-- <el-tooltip content="甯冨眬澶у皬" effect="dark" placement="bottom"> <size-select id="size-select" class="right-menu-item hover-effect" /> - </el-tooltip> - + </el-tooltip>--> </template> <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <div class="avatar-wrapper"> - <img :src="avatar" class="user-avatar"> + <img :src="avatar" class="user-avatar" /> <i class="el-icon-caret-bottom" /> </div> <el-dropdown-menu slot="dropdown"> <router-link to="/user/profile"> <el-dropdown-item>涓汉涓績</el-dropdown-item> </router-link> - <el-dropdown-item @click.native="setting = true"> + <!-- <el-dropdown-item @click.native="setting = true"> <span>甯冨眬璁剧疆</span> - </el-dropdown-item> + </el-dropdown-item>--> <el-dropdown-item divided @click.native="logout"> <span>閫�鍑虹櫥褰�</span> </el-dropdown-item> @@ -47,15 +51,15 @@ </template> <script> -import { mapGetters } from 'vuex' -import Breadcrumb from '@/components/Breadcrumb' -import TopNav from '@/components/TopNav' -import Hamburger from '@/components/Hamburger' -import Screenfull from '@/components/Screenfull' -import SizeSelect from '@/components/SizeSelect' -import Search from '@/components/HeaderSearch' -import SEGit from '@/components/se/Git' -import SEDoc from '@/components/se/Doc' +import { mapGetters } from "vuex"; +import Breadcrumb from "@/components/Breadcrumb"; +import TopNav from "@/components/TopNav"; +import Hamburger from "@/components/Hamburger"; +import Screenfull from "@/components/Screenfull"; +import SizeSelect from "@/components/SizeSelect"; +import Search from "@/components/HeaderSearch"; +import SEGit from "@/components/se/Git"; +import SEDoc from "@/components/se/Doc"; export default { components: { @@ -69,11 +73,8 @@ SEDoc }, computed: { - ...mapGetters([ - 'sidebar', - 'avatar', - 'device' - ]), setting: { + ...mapGetters(["sidebar", "avatar", "device"]), + setting: { get() { return this.$store.state.settings.showSettings; }, @@ -102,7 +103,11 @@ }) .then(() => { this.$store.dispatch("LogOut").then(() => { - location.href = window.location.origin + '/sso/login' + if ((process.env.ENV = "development")) { + window.location.href = "http://localhost:8080/login"; + } else if ((process.env.ENV = "production")) { + window.location.href = window.location.origin + "/sso/login"; + } }); }) .catch(() => {}); diff --git a/se-ui/src/permission.js b/se-ui/src/permission.js index ddb9d8a..b1eb0a7 100644 --- a/se-ui/src/permission.js +++ b/se-ui/src/permission.js @@ -16,7 +16,12 @@ to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/ if (to.path === '/login') { - next({ path: '/' }) + if (process.env.ENV = 'development') { + window.location.href = 'http://localhost:8080/login' + } else if (process.env.ENV = 'production') { + window.location.href = window.location.origin + '/sso/login' + } + // next({ path: '/' }) NProgress.done() } else if (whiteList.indexOf(to.path) !== -1) { next() @@ -34,7 +39,11 @@ }).catch(err => { store.dispatch('LogOut').then(() => { Message.error(err) - window.location.href = window.location.origin + '/sso/login' + if (process.env.ENV = 'development') { + window.location.href = 'http://localhost:8080/login' + } else if (process.env.ENV = 'production') { + window.location.href = window.location.origin + '/sso/login' + } // next({ path: '/' }) }) }) @@ -48,8 +57,11 @@ // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆 next() } else { - // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤� - window.location.href = window.location.origin + '/sso/login' + if (process.env.ENV = 'development') { + window.location.href = 'http://localhost:8080/login' + } else if (process.env.ENV = 'production') { + window.location.href = window.location.origin + '/sso/login' + } NProgress.done() } } diff --git a/se-ui/src/utils/request.js b/se-ui/src/utils/request.js index 6283580..f92e8f6 100644 --- a/se-ui/src/utils/request.js +++ b/se-ui/src/utils/request.js @@ -68,46 +68,50 @@ } return config }, error => { - console.log(error) - Promise.reject(error) + console.log(error) + Promise.reject(error) }) // 鍝嶅簲鎷︽埅鍣� service.interceptors.response.use(res => { - // 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬� - const code = res.data.code || 200; - // 鑾峰彇閿欒淇℃伅 - const msg = errorCode[code] || res.data.msg || errorCode['default'] - // 浜岃繘鍒舵暟鎹垯鐩存帴杩斿洖 - if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { - return res.data - } - if (code === 401) { - if (!isRelogin.show) { - isRelogin.show = true; - MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', { confirmButtonText: '閲嶆柊鐧诲綍', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - isRelogin.show = false; - store.dispatch('LogOut').then(() => { - location.href = '/index'; - }) + // 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬� + const code = res.data.code || 200; + // 鑾峰彇閿欒淇℃伅 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + // 浜岃繘鍒舵暟鎹垯鐩存帴杩斿洖 + if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { + return res.data + } + if (code === 401) { + if (!isRelogin.show) { + isRelogin.show = true; + MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', { confirmButtonText: '閲嶆柊鐧诲綍', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { + isRelogin.show = false; + store.dispatch('LogOut').then(() => { + if ((process.env.ENV = "development")) { + window.location.href = "http://localhost:8080/login"; + } else if ((process.env.ENV = "production")) { + window.location.href = window.location.origin + "/sso/login"; + } + }) }).catch(() => { isRelogin.show = false; }); } - return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�') - } else if (code === 500) { - Message({ message: msg, type: 'error' }) - return Promise.reject(new Error(msg)) - } else if (code === 601) { - Message({ message: msg, type: 'warning' }) - return Promise.reject('error') - } else if (code !== 200) { - Notification.error({ title: msg }) - return Promise.reject('error') - } else { - return res.data - } - }, + return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�') + } else if (code === 500) { + Message({ message: msg, type: 'error' }) + return Promise.reject(new Error(msg)) + } else if (code === 601) { + Message({ message: msg, type: 'warning' }) + return Promise.reject('error') + } else if (code !== 200) { + Notification.error({ title: msg }) + return Promise.reject('error') + } else { + return res.data + } +}, error => { console.log('err' + error) let { message } = error; diff --git a/se-ui/src/views/login.vue b/se-ui/src/views/login.vue index 4f28dca..23b0636 100644 --- a/se-ui/src/views/login.vue +++ b/se-ui/src/views/login.vue @@ -57,8 +57,8 @@ return { codeUrl: "", loginForm: { - username: "admin", - password: "admin123", + username: "", + password: "", rememberMe: false, code: "", uuid: "" @@ -89,7 +89,7 @@ } }, created() { - // this.getCode(); + this.getCode(); this.getCookie(); }, methods: { diff --git a/se-ui/src/views/system/role/index.vue b/se-ui/src/views/system/role/index.vue index 3116194..ca99356 100644 --- a/se-ui/src/views/system/role/index.vue +++ b/se-ui/src/views/system/role/index.vue @@ -1,5 +1,5 @@ <template> - <div class="app-container"> + <div :style="styleObject" class="app-container"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="瑙掕壊鍚嶇О" prop="roleName"> <el-input @@ -166,16 +166,20 @@ /> <!-- 娣诲姞鎴栦慨鏀硅鑹查厤缃璇濇 --> + <!-- :wrapperClosable="false" 鐐瑰嚮閬僵灞傛槸鍚﹀彲浠ュ叧闂� Drawer--> <el-drawer title="淇℃伅淇敼" :visible.sync="open" direction="rtl" custom-class="demo-drawer" + size="500px" ref="drawer" append-to-body + :modal="false" + :before-close="cancel" > <div class="demo-drawer__content"> - <el-form ref="form" :model="form" :rules="rules" label-width="100px"> + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form-item label="瑙掕壊鍚嶇О" prop="roleName"> <el-input v-model="form.roleName" placeholder="璇疯緭鍏ヨ鑹插悕绉�" /> </el-form-item> @@ -231,12 +235,12 @@ </el-form-item> </el-form> <div class="demo-drawer__footer"> - <!-- <el-button >鍙� 娑�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> <el-button type="primary" - @click="$refs.drawer.closeDrawer()" + @click="submitForm" :loading="loading" - >{{ loading ? '鎻愪氦涓� ...' : '纭� 瀹�' }}</el-button>--> + >{{ loading ? '鎻愪氦涓� ...' : '纭� 瀹�' }}</el-button> </div> </div> </el-drawer> @@ -341,7 +345,18 @@ </el-dialog> </div> </template> - +<style scoped> +.demo-drawer__footer { + width: 100%; + position: absolute; + bottom: 0; + left: 0; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + background-color: bfa; +} +</style> <script> import { listRole, @@ -424,6 +439,7 @@ roleKey: undefined, status: undefined }, + styleObject: {}, // 琛ㄥ崟鍙傛暟 form: {}, defaultProps: { @@ -517,6 +533,7 @@ // 鍙栨秷鎸夐挳 cancel() { this.open = false; + this.styleObject = { width: "100%" }; this.reset(); }, // 鍙栨秷鎸夐挳锛堟暟鎹潈闄愶級 @@ -619,6 +636,7 @@ this.reset(); this.getMenuTreeselect(); this.open = true; + this.title = "娣诲姞瑙掕壊"; }, /** 淇敼鎸夐挳鎿嶄綔 */ @@ -629,6 +647,7 @@ getRole(roleId).then(response => { this.form = response.data; this.open = true; + this.styleObject = { width: "70%" }; this.$nextTick(() => { roleMenu.then(res => { let checkedKeys = res.checkedKeys; @@ -677,6 +696,7 @@ updateRole(this.form).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛"); this.open = false; + this.styleObject = { width: "100%" }; this.getList(); }); } else { @@ -684,6 +704,7 @@ addRole(this.form).then(response => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; + this.styleObject = { width: "100%" }; this.getList(); }); } diff --git a/se-ui/src/views/system/user/profile/index.vue b/se-ui/src/views/system/user/profile/index.vue index 529c564..75f739e 100644 --- a/se-ui/src/views/system/user/profile/index.vue +++ b/se-ui/src/views/system/user/profile/index.vue @@ -20,6 +20,12 @@ <div class="pull-right">{{ user.phonenumber }}</div> </li> <li class="list-group-item"> + <svg-icon icon-class="phone" />瀵嗙骇 + <div + class="pull-right" + >{{selectDictLabel(dict.type.sys_secret_level, user.secretLevel)}}</div> + </li> + <li class="list-group-item"> <svg-icon icon-class="email" />鐢ㄦ埛閭 <div class="pull-right">{{ user.email }}</div> </li> @@ -67,6 +73,7 @@ export default { name: "Profile", components: { userAvatar, userInfo, resetPwd }, + dicts: ["sys_secret_level"], data() { return { user: {}, diff --git a/se-ui/vue.config.js b/se-ui/vue.config.js index 7ef2354..bd4f0b7 100644 --- a/se-ui/vue.config.js +++ b/se-ui/vue.config.js @@ -34,7 +34,8 @@ proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://192.168.11.203:8090`, + target: `http://localhost:8080`, + //target: `http://192.168.11.203:8090`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API -- Gitblit v1.9.3