From 2671888e8977e3e84d29130f32f113bb8154d8e5 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 02 九月 2024 11:26:38 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.11.205:9000/r/se-cloud --- se-ui/src/utils/request.js | 70 +++++++------ se-ui/src/layout/components/Navbar.vue | 98 ++++++++++--------- se-ui/.env.staging | 2 se-ui/src/permission.js | 26 ++++- se-ui/src/router/index.js | 29 +++-- se-ui/src/views/system/user/profile/index.vue | 7 + se-ui/src/components/Breadcrumb/index.vue | 4 se-ui/src/views/login.vue | 8 se-ui/src/views/system/role/index.vue | 33 +++++- se-ui/.env.development | 7 + se-ui/.env.production | 5 se-ui/vue.config.js | 4 12 files changed, 177 insertions(+), 116 deletions(-) diff --git a/se-ui/.env.development b/se-ui/.env.development index 85bfeec..2fbdd7f 100644 --- a/se-ui/.env.development +++ b/se-ui/.env.development @@ -1,11 +1,14 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 绠$悊绯荤粺 +VUE_APP_TITLE = 缁煎悎绠$悊鍒嗙郴缁� # 寮�鍙戠幆澧冮厤缃� ENV = 'development' # 绠$悊绯荤粺/寮�鍙戠幆澧� -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API = '/prod-api' # 璺敱鎳掑姞杞� VUE_CLI_BABEL_TRANSPILE_MODULES = true + +#椤圭洰瀛愯矾寰� +VUE_APP_ITEM_PATH = '/sys' \ No newline at end of file diff --git a/se-ui/.env.production b/se-ui/.env.production index 5feb40b..7d29c97 100644 --- a/se-ui/.env.production +++ b/se-ui/.env.production @@ -1,8 +1,11 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 绠$悊绯荤粺 +VUE_APP_TITLE = 缁煎悎绠$悊鍒嗙郴缁� # 鐢熶骇鐜閰嶇疆 ENV = 'production' # 绠$悊绯荤粺/鐢熶骇鐜 VUE_APP_BASE_API = '/prod-api' + +#椤圭洰瀛愯矾寰� +VUE_APP_ITEM_PATH = '/sys' 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 8df0e8f..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,45 +73,47 @@ SEDoc }, computed: { - ...mapGetters([ - 'sidebar', - 'avatar', - 'device' - ]), + ...mapGetters(["sidebar", "avatar", "device"]), setting: { get() { - return this.$store.state.settings.showSettings + return this.$store.state.settings.showSettings; }, set(val) { - this.$store.dispatch('settings/changeSetting', { - key: 'showSettings', + this.$store.dispatch("settings/changeSetting", { + key: "showSettings", value: val - }) + }); } }, topNav: { get() { - return this.$store.state.settings.topNav + return this.$store.state.settings.topNav; } } }, methods: { toggleSideBar() { - this.$store.dispatch('app/toggleSideBar') + this.$store.dispatch("app/toggleSideBar"); }, async logout() { - this.$confirm('纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - this.$store.dispatch('LogOut').then(() => { - location.href = '/index'; + this.$confirm("纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$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(() => {}); + .catch(() => {}); } } -} +}; </script> <style lang="scss" scoped> @@ -116,18 +122,18 @@ overflow: hidden; position: relative; background: #fff; - box-shadow: 0 1px 4px rgba(0,21,41,.08); + box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); .hamburger-container { line-height: 46px; height: 100%; float: left; cursor: pointer; - transition: background .3s; - -webkit-tap-highlight-color:transparent; + transition: background 0.3s; + -webkit-tap-highlight-color: transparent; &:hover { - background: rgba(0, 0, 0, .025) + background: rgba(0, 0, 0, 0.025); } } @@ -164,10 +170,10 @@ &.hover-effect { cursor: pointer; - transition: background .3s; + transition: background 0.3s; &:hover { - background: rgba(0, 0, 0, .025) + background: rgba(0, 0, 0, 0.025); } } } diff --git a/se-ui/src/permission.js b/se-ui/src/permission.js index c568979..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() @@ -32,11 +37,16 @@ next({ ...to, replace: true }) // hack鏂规硶 纭繚addRoutes宸插畬鎴� }) }).catch(err => { - store.dispatch('LogOut').then(() => { - Message.error(err) - next({ path: '/' }) - }) + store.dispatch('LogOut').then(() => { + Message.error(err) + 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: '/' }) }) + }) } else { next() } @@ -47,7 +57,11 @@ // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆 next() } else { - next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤� + 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/router/index.js b/se-ui/src/router/index.js index 71907b6..6b1ce51 100644 --- a/se-ui/src/router/index.js +++ b/se-ui/src/router/index.js @@ -41,11 +41,11 @@ } ] }, - { - path: '/login', - component: () => import('@/views/login'), - hidden: true - }, + // { + // path: '/login', + // component: () => import('@/views/login'), + // hidden: true + // }, { path: '/register', component: () => import('@/views/register'), @@ -64,15 +64,15 @@ { path: '', component: Layout, - redirect: 'index', - children: [ - { - path: 'index', - component: () => import('@/views/index'), - name: 'Index', - meta: { title: '棣栭〉', icon: 'dashboard', affix: true } - } - ] + redirect: 'system/user', + // children: [ + // { + // path: 'index', + // component: () => import('@/views/index'), + // name: 'Index', + // meta: { title: '棣栭〉', icon: 'dashboard', affix: true } + // } + // ] }, { path: '/user', @@ -178,6 +178,7 @@ export default new Router({ mode: 'history', // 鍘绘帀url涓殑# + base: process.env.VUE_APP_ITEM_PATH, scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) diff --git a/se-ui/src/utils/request.js b/se-ui/src/utils/request.js index 7d9f7be..f92e8f6 100644 --- a/se-ui/src/utils/request.js +++ b/se-ui/src/utils/request.js @@ -16,7 +16,7 @@ const service = axios.create({ // axios涓姹傞厤缃湁baseURL閫夐」锛岃〃绀鸿姹俇RL鍏叡閮ㄥ垎 baseURL: process.env.VUE_APP_BASE_API, - //baseURL: 'http://192.168.11.203:8090/prod-api', + // baseURL: 'http://192.168.11.203:8090/prod-api', // 瓒呮椂 timeout: 10000 }) @@ -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 4894d33..23b0636 100644 --- a/se-ui/src/views/login.vue +++ b/se-ui/src/views/login.vue @@ -47,7 +47,7 @@ </template> <script> -import { getCodeImg } from "@/api/login"; +// import { getCodeImg } from "@/api/login"; import Cookies from "js-cookie"; import { encrypt, decrypt } from '@/utils/jsencrypt' @@ -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 c4cf73e..bd4f0b7 100644 --- a/se-ui/vue.config.js +++ b/se-ui/vue.config.js @@ -17,7 +17,7 @@ // 閮ㄧ讲鐢熶骇鐜鍜屽紑鍙戠幆澧冧笅鐨刄RL銆� // 榛樿鎯呭喌涓嬶紝Vue CLI 浼氬亣璁句綘鐨勫簲鐢ㄦ槸琚儴缃插湪涓�涓煙鍚嶇殑鏍硅矾寰勪笂 // 渚嬪 https://www.se.vip/銆傚鏋滃簲鐢ㄨ閮ㄧ讲鍦ㄤ竴涓瓙璺緞涓婏紝浣犲氨闇�瑕佺敤杩欎釜閫夐」鎸囧畾杩欎釜瀛愯矾寰勩�備緥濡傦紝濡傛灉浣犵殑搴旂敤琚儴缃插湪 https://www.se.vip/admin/锛屽垯璁剧疆 baseUrl 涓� /admin/銆� - publicPath: process.env.NODE_ENV === "production" ? "/" : "/", + publicPath: process.env.NODE_ENV === "production" ? process.env.VUE_APP_ITEM_PATH : "/", // 鍦╪pm run build 鎴� yarn build 鏃� 锛岀敓鎴愭枃浠剁殑鐩綍鍚嶇О锛堣鍜宐aseUrl鐨勭敓浜х幆澧冭矾寰勪竴鑷达級锛堥粯璁ist锛� outputDir: 'dist', // 鐢ㄤ簬鏀剧疆鐢熸垚鐨勯潤鎬佽祫婧� (js銆乧ss銆乮mg銆乫onts) 鐨勶紱锛堥」鐩墦鍖呬箣鍚庯紝闈欐�佽祫婧愪細鏀惧湪杩欎釜鏂囦欢澶逛笅锛� @@ -38,7 +38,7 @@ //target: `http://192.168.11.203:8090`, changeOrigin: true, pathRewrite: { - ['^' + process.env.VUE_APP_BASE_API]: '' + ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API } } }, -- Gitblit v1.9.3