ZGC4846 1 неделя назад
Родитель
Сommit
3139298c5c
12 измененных файлов с 32 добавлено и 36 удалено
  1. 2 2
      .env
  2. 5 5
      README.md
  3. 2 2
      package-lock.json
  4. 1 1
      package.json
  5. 9 15
      src/App.vue
  6. 1 1
      src/config/setting.js
  7. 1 1
      src/main.js
  8. 4 3
      src/router/index.js
  9. 1 1
      src/styles/App.css
  10. 3 2
      src/utils/request.js
  11. 1 1
      src/views/login/index.vue
  12. 2 2
      vue.config.js

+ 2 - 2
.env

@@ -1,7 +1,7 @@
 VUE_APP_NAME=OA PC
 VUE_APP_API_BASE_URL=/api
-VUE_APP_PUBLIC_PATH=/oa-pc/
-VUE_APP_QIANKUN_ACTIVE_RULE=/page-oa-pc/
+VUE_APP_PUBLIC_PATH=/page-hr/
+VUE_APP_QIANKUN_ACTIVE_RULE=/page-hr/
 VUE_APP_PORT=8091
 VUE_APP_MAP_KEY=006d995d433058322319fa797f2876f5
 VUE_APP_ELE_ADMIN_LICENSE=dk9mcwJyetRWQlxWRiojIqJWdzJCLi4Wa4MDNxojI0NWZlJiOiQWaiwCMsICOyRjTEZGWi42bpNnclZnI0nIxEjLxIiO0NW=

+ 5 - 5
README.md

@@ -11,7 +11,7 @@ npm install
 npm run dev
 ```
 
-默认独立访问地址:`http://localhost:8091/oa-pc/`。
+默认独立访问地址:`http://localhost:8091/page-hr/`。
 
 ## qiankun 注册信息
 
@@ -19,12 +19,12 @@ npm run dev
 
 ```js
 {
-  name: 'oa-pc',
-  entry: '/oa-pc/',
-  activeRule: '/page-oa-pc'
+  name: 'page-hr',
+  entry: '/page-hr/',
+  activeRule: '/page-hr'
 }
 ```
 
-开发联调时 `entry` 可改为 `http://localhost:8091/oa-pc/`。
+开发联调时 `entry` 可改为 `http://localhost:8091/page-hr/`。
 
 应用名称、端口、独立运行路径和 qiankun 路由前缀均可在 `.env` 中调整。

+ 2 - 2
package-lock.json

@@ -1,11 +1,11 @@
 {
-  "name": "page-oa-pc",
+  "name": "page-hr",
   "version": "1.0.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
-      "name": "page-oa-pc",
+      "name": "page-hr",
       "version": "1.0.0",
       "dependencies": {
         "axios": "^0.27.2",

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "page-oa-pc",
+  "name": "page-hr",
   "version": "1.0.0",
   "private": true,
   "scripts": {

+ 9 - 15
src/App.vue

@@ -1,5 +1,5 @@
 <template>
-  <div id="oa-pc-app">
+  <div id="page-hr-app">
     <router-view v-if="isQiankun || isFullPage" :key="$route.fullPath" />
     <ele-pro-layout
       v-else
@@ -13,7 +13,7 @@
       tab-style="card"
       :tab-sortable="true"
       home-title="首页"
-      home-path="/"
+      home-path="/home"
       layout-path="/"
       @tab-add="onTabAdd"
       @tab-remove="onTabRemove"
@@ -43,7 +43,7 @@ export default {
       homeComponents: [],
       pageRefreshing: false,
       menus: [
-      { path: '/', meta: { title: '首页', icon: 'el-icon-house' } },
+      { path: '/home', meta: { title: '首页', icon: 'el-icon-house' } },
       {
         path: '/position',
         meta: { title: '岗位管理', icon: 'el-icon-suitcase' },
@@ -63,21 +63,15 @@ export default {
       },
 
       {
-        path: '/hr',
+        path: '/hr-management',
         meta: { title: '人事管理', icon: 'el-icon-user' },
         children: [
           // { path: '/organization', meta: { title: '组织机构' } },
           { path: '/employee-archive', meta: { title: '员工档案' } },
           { path: '/onboarding-handling', meta: { title: '办理入职' } },
           { path: '/regularization-handling', meta: { title: '转正办理' } },
-          {
-            path: '/resignation',
-            meta: { title: '离职管理' },
-            children: [
-              { path: '/resignation-application', meta: { title: '离职申请' } },
-              { path: '/resignation-handover-order', meta: { title: '离职交接单' } }
-            ]
-          },
+          { path: '/resignation-application', meta: { title: '离职申请' } },
+          { path: '/resignation-handover-order', meta: { title: '离职交接单' } },
           { path: '/position-transfer', meta: { title: '岗位调动办理' } },
           { path: '/qualification-management', meta: { title: '资质管理' } },
           { path: '/term-management', meta: { title: '期限管理' } },
@@ -146,7 +140,7 @@ export default {
       return this.pageTabs.findIndex((tab) => tab.key === key);
     },
     tabPath(tab) {
-      return (tab && (tab.fullPath || tab.key)) || '/';
+      return (tab && (tab.fullPath || tab.key)) || '/home';
     },
     goTabOrHome(tab) {
       const path = this.tabPath(tab);
@@ -191,7 +185,7 @@ export default {
     },
     onTabRemoveAll() {
       this.pageTabs = [];
-      if (this.$route.path !== '/') this.$router.push('/');
+      if (this.$route.path !== '/home') this.$router.push('/home');
     },
     onTabSortChange(tabs) {
       this.pageTabs = tabs || [];
@@ -206,7 +200,7 @@ export default {
       this.homeComponents = components || [];
     },
     onLogoClick(isHome) {
-      if (!isHome) this.$router.push('/');
+      if (!isHome) this.$router.push('/home');
     }
   }
 };

+ 1 - 1
src/config/setting.js

@@ -3,7 +3,7 @@ export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL;
 
 /** 应用及系统标识 */
 export const PROJECT_NAME = process.env.VUE_APP_NAME || 'OA PC';
-export const SYSTEM_NAME = 'oa-pc';
+export const SYSTEM_NAME = 'page-hr';
 
 /** EleAdmin 高德地图配置 */
 export const MAP_KEY = process.env.VUE_APP_MAP_KEY || '';

+ 1 - 1
src/main.js

@@ -90,7 +90,7 @@ if (!window.__POWERED_BY_QIANKUN__) {
 }
 
 export async function bootstrap() {
-  console.info('[oa-pc] bootstrap');
+  console.info('[page-hr] bootstrap');
 }
 
 export async function mount(props) {

+ 4 - 3
src/router/index.js

@@ -9,7 +9,8 @@ export function getRouter() { return routerInstance; }
 const dev = process.env.NODE_ENV === 'development';
 const routes = [
   { path: '/login', name: 'login', component: () => import('@/views/login/index.vue'), meta: { title: '登录', public: true, fullPage: true } },
-  { path: '/', name: 'home', component: HomeView, meta: { title: '首页', public: dev } },
+  { path: '/', redirect: '/home' },
+  { path: '/home', name: 'home', component: HomeView, meta: { title: '首页', public: dev } },
   // { path: '/organization', name: 'organization', component: () => import('@/views/organization/index.vue'), meta: { title: '组织架构', public: dev } },
   { path: '/position-management', name: 'positionManagement', component: () => import('@/views/positionManagement/index.vue'), meta: { title: '岗位设定', public: dev } },
   { path: '/position-sequence', name: 'positionSequence', component: () => import('@/views/positionSequence/index.vue'), meta: { title: '岗位序列', public: dev } },
@@ -49,8 +50,8 @@ export default function createRouter(routerBase) {
   routerInstance = router;
   router.beforeEach((to, from, next) => {
     if (to.meta && to.meta.title) document.title = `${to.meta.title} - ${process.env.VUE_APP_NAME}`;
-    if (!window.__POWERED_BY_QIANKUN__ && !to.meta?.public && !getToken()) { next({ path: '/login', query: to.fullPath === '/' ? {} : { from: to.fullPath } }); return; }
-    if (to.path === '/login' && getToken()) { next('/'); return; }
+    if (!window.__POWERED_BY_QIANKUN__ && !to.meta?.public && !getToken()) { next({ path: '/login', query: to.fullPath === '/home' || to.fullPath === '/' ? {} : { from: to.fullPath } }); return; }
+    if (to.path === '/login' && getToken()) { next('/home'); return; }
     next();
   });
   return router;

+ 1 - 1
src/styles/App.css

@@ -1,7 +1,7 @@
 html,
 body,
 #app,
-#oa-pc-app {
+#page-hr-app {
   height: 100%;
   min-height: 100vh;
   margin: 0;

+ 3 - 2
src/utils/request.js

@@ -44,8 +44,9 @@ function markParentHandledToast(notified) {
 
 /** 跳转登录页,独立运行和 qiankun 嵌入运行分别处理。 */
 function redirectToLogin(from) {
+  const isHome = !from || from === '/' || from === '/home';
   if (window.__POWERED_BY_QIANKUN__) {
-    const query = from && from !== '/' ? `?from=${encodeURIComponent(from)}` : '';
+    const query = isHome ? '' : `?from=${encodeURIComponent(from)}`;
     window.location.replace(`${window.location.origin}/login${query}`);
     return;
   }
@@ -55,7 +56,7 @@ function redirectToLogin(from) {
     router
       .replace({
         path: '/login',
-        query: from && from !== '/' ? { from } : {}
+        query: isHome ? {} : { from }
       })
       .catch(() => {});
   }

+ 1 - 1
src/views/login/index.vue

@@ -107,7 +107,7 @@
             this.$store.commit('SET_USER', result.data);
             this.$message.success(result.message || '登录成功');
             await this.$router
-              .replace(this.$route.query.from || '/')
+              .replace(this.$route.query.from || '/home')
               .catch(() => {});
           } catch (error) {
             // 业务错误由此处提示,网络错误由请求拦截器统一提示。

+ 2 - 2
vue.config.js

@@ -7,7 +7,7 @@ function resolve(dir) {
   return path.join(__dirname, dir);
 }
 
-const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/oa-pc/";
+const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/page-hr/";
 
 module.exports = {
   publicPath,
@@ -39,7 +39,7 @@ module.exports = {
         name: "redirect-to-app",
         middleware(req, res, next) {
           const url = (req.url || "").split("?")[0];
-          if (url === "/" || url === "/oa" || url === "/oa/") {
+          if (url === "/" || url === "/oa" || url === "/oa/" || url === "/oa-pc" || url === "/oa-pc/") {
             res.redirect(publicPath);
             return;
           }