Browse Source

refactor: change structure and reorganize

zhangyuhan 3 năm trước cách đây
mục cha
commit
fc5bfe0b91
52 tập tin đã thay đổi với 370 bổ sung711 xóa
  1. 2 1
      .env.production
  2. 1 1
      .gitignore
  3. 2 34
      README.md
  4. 0 41
      config/dev-proxy.js
  5. 4 4
      package.json
  6. 4 0
      packages/api/index.js
  7. 0 0
      packages/api/interceptors.js
  8. 0 0
      packages/api/service.js
  9. 0 0
      packages/components/Loading/index.vue
  10. 4 4
      packages/components/Menu/index.vue
  11. 0 0
      packages/components/Navbar/components/item.vue
  12. 5 7
      packages/components/Navbar/index.vue
  13. 22 0
      packages/index.js
  14. 0 0
      packages/layout/work-bench/content.vue
  15. 18 24
      packages/layout/work-bench/index.vue
  16. 0 0
      packages/layout/work-bench/layout.vue
  17. 0 10
      packages/micro-frame/iframe/layout.vue
  18. 2 2
      packages/micro-frame/iframe/router.js
  19. 83 0
      packages/micro-frame/index.js
  20. 34 0
      packages/micro-frame/qiankun/layout.vue
  21. 12 0
      packages/micro-frame/qiankun/router.js
  22. 103 0
      packages/micro-frame/qiankun/store.js
  23. 35 0
      packages/router/index.js
  24. 9 0
      packages/router/router.js
  25. 11 0
      packages/store/index.js
  26. 2 20
      packages/store/modules/menu.js
  27. 13 0
      packages/store/modules/navbar.js
  28. 1 28
      packages/store/modules/user.js
  29. 0 0
      packages/style/_variables.scss
  30. 0 0
      packages/style/base.scss
  31. 0 0
      packages/style/common.scss
  32. 0 0
      packages/style/index.scss
  33. BIN
      public/favicon.ico
  34. 0 1
      public/index.html
  35. 0 7
      src/App.vue
  36. 0 5
      src/api/index.js
  37. 0 181
      src/api/mock/index.js
  38. 0 3
      src/api/modules/index.js
  39. 0 10
      src/api/modules/menu.js
  40. 0 10
      src/api/modules/navbar.js
  41. 0 28
      src/api/modules/user.js
  42. 0 28
      src/main.js
  43. 0 16
      src/micro-frame/iframe/router.js
  44. 0 12
      src/micro-frame/qiankun/index.js
  45. 0 18
      src/micro-frame/qiankun/layout.vue
  46. 0 53
      src/router/index.js
  47. 0 51
      src/router/modules/work-bench.js
  48. 0 21
      src/store/index.js
  49. 0 24
      src/store/modules/navbar.js
  50. 0 11
      src/views/404.vue
  51. 0 52
      src/views/Test.vue
  52. 3 4
      vue.config.js

+ 2 - 1
.env.production

@@ -3,4 +3,5 @@ VUE_APP_BASE_API=''
 VUE_APP_API_MOCK=true
 VUE_APP_TEMPLATE=true
 VUE_APP_ID=10000
-VUE_APP_BASE_PUBLIC='/home'
+VUE_APP_BASE_URL='/home'
+VUE_APP_BASE_PUBLIC='/home/'

+ 1 - 1
.gitignore

@@ -1,6 +1,6 @@
 .DS_Store
 node_modules
-/dist
+/home
 
 
 # local env files

+ 2 - 34
README.md

@@ -1,41 +1,9 @@
 # @jianyu/work-bench-frame
-> 管理应用框架
+> 管理应用框架, 项目示例已移除,本地开发需搭配 @jianyu/work-bench-template 理解使用
 
 ## Install
 ```
 yarn add @jianyu/work-bench-frame
 ```
 
-## Use
-```
-# main.js or mian.ts
-
-import { Vue, router, store } from "@jianyu/work-bench-frame"
-
-new Vue({
-   ...
-})
-```
-
-## Project setup
-```
-yarn install
-```
-
-### Compiles and hot-reloads for development
-```
-yarn serve
-```
-
-### Compiles and minifies for production
-```
-yarn build
-```
-
-### Lints and fixes files
-```
-yarn lint
-```
-
-### Customize configuration
-See [Configuration Reference](https://cli.vuejs.org/config/).
+## Waiting

+ 0 - 41
config/dev-proxy.js

@@ -1,41 +0,0 @@
-let proxy = {
-  '^/jianyu-page': {
-    target: 'https://jybx-webtest.jydev.jianyu360.com',
-    changeOrigin: true,
-    logLevel: 'debug',
-    pathRewrite: {
-      '^/jianyu-page': ''
-    }
-  },
-  '^/api': {
-    target: 'https://jybx-webtest.jydev.jianyu360.com',
-    changeOrigin: true,
-    logLevel: 'debug',
-    pathRewrite: {
-      '^/api': ''
-    }
-  }
-}
-
-function getProxy (prefix) {
-  return {
-    value: {
-      target: 'https://jybx-webtest.jydev.jianyu360.com',
-      changeOrigin: true,
-      logLevel: 'debug',
-      pathRewrite: {
-        ['^/' + prefix]: '/' + prefix
-      }
-    },
-    key: ['^/' + prefix]
-  }
-}
-
-['dataExport', 'pccss', 'course', 'public-pc', 'js', 'css', 'jypay', 'subscribepay', 'front', 'common-module',
-  'page_big_pc'
-].forEach(v => {
-  const temp = getProxy(v)
-  proxy[temp.key] = temp.value
-})
-
-module.exports = proxy

+ 4 - 4
package.json

@@ -1,12 +1,11 @@
 {
   "name": "@jianyu/work-bench-frame",
-  "version": "0.1.6",
+  "version": "0.3.1",
   "description": "jianyu work-bench-frame",
-  "mian": "src/main.js",
+  "exports": "packages/index.js",
   "author": "zhangyuhan",
   "files": [
-    "public",
-    "src"
+    "packages"
   ],
   "scripts": {
     "serve": "vue-cli-service serve",
@@ -45,6 +44,7 @@
     "sass-loader": "^12.0.0",
     "vue-template-compiler": "^2.6.14"
   },
+  "license": "ISC",
   "homepage": "http://192.168.3.207:20080/efe/work-bench-frame",
   "bugs": "http://192.168.3.207:20080/efe/work-bench-frame/issues",
   "repository": {

+ 4 - 0
packages/api/index.js

@@ -0,0 +1,4 @@
+import service from './service'
+import './interceptors'
+
+export default service

+ 0 - 0
src/api/core/interceptors.js → packages/api/interceptors.js


+ 0 - 0
src/api/core/service.js → packages/api/service.js


+ 0 - 0
src/components/Loading/index.vue → packages/components/Loading/index.vue


+ 4 - 4
src/components/Menu/index.vue → packages/components/Menu/index.vue

@@ -74,11 +74,11 @@ export default {
     }
   },
   computed: {
-    ...mapState('menu', [
+    ...mapState('work-bench/menu', [
       'type',
       'active'
     ]),
-    ...mapGetters('menu', [
+    ...mapGetters('work-bench/menu', [
       'filterMenus',
       'menuTypes',
       'filterSubMenus',
@@ -89,10 +89,10 @@ export default {
   },
   created () {},
   methods: {
-    ...mapMutations('menu', [
+    ...mapMutations('work-bench/menu', [
       'setActiveOfType'
     ]),
-    ...mapActions('menu', [
+    ...mapActions('work-bench/menu', [
       'setMenuType'
     ]),
     /**

+ 0 - 0
src/components/Navbar/components/item.vue → packages/components/Navbar/components/item.vue


+ 5 - 7
src/components/Navbar/index.vue → packages/components/Navbar/index.vue

@@ -67,7 +67,7 @@
 </template>
 
 <script>
-import NavbarItem from '@/components/Navbar/components/item'
+import NavbarItem from './components/item'
 import { mapActions, mapGetters, mapState } from 'vuex'
 export default {
   name: 'header-navbar',
@@ -117,22 +117,20 @@ export default {
     }
   },
   computed: {
-    ...mapState('navbar', [
+    ...mapState('work-bench/navbar', [
       'messageCount'
     ]),
-    ...mapGetters('user', [
+    ...mapGetters('work-bench/user', [
       'hasExclusiveCustomer',
       'exclusiveCustomerInfo',
       'userInfo'
     ])
   },
   methods: {
-    ...mapActions('user', [
+    ...mapActions('work-bench', [
       'getPower',
       'getUserSimpleInfo',
-      'setSignOut'
-    ]),
-    ...mapActions('navbar', [
+      'setSignOut',
       'getMessageCount'
     ]),
     onClickOut () {

+ 22 - 0
packages/index.js

@@ -0,0 +1,22 @@
+import service from './api'
+import routerModules, { addRouter } from './router'
+import storeModules from './store'
+import { setRouter } from './router/router'
+import { openLink } from './micro-frame'
+
+const install = function (Vue, { router }) {
+  if (install.installed) return
+  setRouter(router)
+}
+
+export {
+  service,
+  routerModules,
+  storeModules,
+  addRouter,
+  openLink
+}
+
+export default {
+  install
+}

+ 0 - 0
src/layout/work-bench/content.vue → packages/layout/work-bench/content.vue


+ 18 - 24
src/layout/work-bench/index.vue → packages/layout/work-bench/index.vue

@@ -13,6 +13,7 @@
 <script>
 import WorkBenchLayout from './layout'
 import { mapActions } from 'vuex'
+import { openLink } from '../../micro-frame'
 export default {
   name: 'work-bench',
   components: {
@@ -23,20 +24,22 @@ export default {
     next(async (vm) => {
       await vm.getMenus()
       vm.tryMatchMenu({
-        link: to.query.link
+        link: to.query.link || to.fullPath
       })
     })
   },
   async beforeRouteUpdate (to, from, next) {
     console.log('xxxx update')
     this.tryMatchMenu({
-      link: to.query.link
+      link: to.query.link || to.fullPath
     })
     next()
   },
   methods: {
-    ...mapActions('menu', [
-      'getMenus',
+    ...mapActions('work-bench', [
+      'getMenus'
+    ]),
+    ...mapActions('work-bench/menu', [
       'tryMatchMenu'
     ]),
     onBeforeSelect (menu) {
@@ -67,38 +70,29 @@ export default {
     onOpenMenu (menu) {
       console.log('onOpenMenu', menu)
       const { appType, openType, link, label } = menu
-      switch (appType) {
-        case 'iframe': {
-          this.$router.push({
-            name: 'page',
-            query: {
-              link: link
-            }
-          })
-          break
-        }
-        default: {
-          this.$router.push({
-            name: 'test',
-            params: {
-              link: label
-            }
-          })
-          break
+      openLink({
+        link: link,
+        options: {
+          type: appType
         }
-      }
+      })
     }
   }
 }
 </script>
 
 <style lang="scss">
-@import "../../assets/style/index";
+@import "../../style/index";
 .content-shadow {
   background: #FFFFFF;
   box-shadow: 0px 4px 8px 0px rgba(0,0,0,0.0800);
   border-radius: 5px 5px 5px 5px;
 }
+.abnormal-tip {
+  margin: $padding-lg;
+  padding: $padding-xl;
+  @extend .content-shadow;
+}
 
 .custom-message-box{
   width: 380px!important;

+ 0 - 0
src/layout/work-bench/layout.vue → packages/layout/work-bench/layout.vue


+ 0 - 10
src/micro-frame/iframe/layout.vue → packages/micro-frame/iframe/layout.vue

@@ -42,14 +42,4 @@ export default {
 </script>
 
 <style>
-.micro-iframe--layout,
-.iframe-container {
-  width: 100%;
-  height: 100%;
-  overflow: hidden;
-}
-.iframe-container {
-  overflow: scroll;
-  border: none;
-}
 </style>

+ 2 - 2
src/micro-frame/qiankun/router.js → packages/micro-frame/iframe/router.js

@@ -1,7 +1,7 @@
 import Layout from './layout'
 
 export default {
-  path: 'app/*',
-  name: 'app',
+  path: 'page',
+  name: 'page',
   component: Layout
 }

+ 83 - 0
packages/micro-frame/index.js

@@ -0,0 +1,83 @@
+import { getRouter } from '../router/router'
+
+/**
+ * 补全URL地址
+ * @param link
+ * @param prefix
+ * @returns {string|*}
+ */
+function completeURLPrefix (link, prefix = 'https://jybx-webtest.jydev.jianyu360.com') {
+  const hasPrefix = /^http(s)?:\/\//.test(link)
+  const hasSign = /^\//.test(link)
+  if (!hasPrefix) {
+    return prefix + (hasSign ? '' : '/') + link
+  } else {
+    return link
+  }
+}
+
+/**
+ * 获取 qiankun 应用路由
+ * @param link
+ * @returns {string}
+ */
+export function getQKRoute (link, needBase = false) {
+  const router = getRouter()
+  const toRoute = router.resolve({
+    name: 'app',
+    hash: link
+  })
+  console.log(toRoute, needBase)
+  return decodeURIComponent(needBase ? toRoute.href : toRoute.route.fullPath)
+}
+
+/**
+ * 获取 iframe page 路由
+ * @param link
+ * @returns {string}
+ */
+export function getPageRoute (link, needBase = false) {
+  const router = getRouter()
+  const toRoute = router.resolve({
+    name: 'page',
+    query: {
+      link: completeURLPrefix(link)
+    }
+  })
+  console.log(toRoute, needBase)
+  return decodeURIComponent(needBase ? toRoute.href : toRoute.route.fullPath)
+}
+
+/**
+ * 根据 type 打开对应路由
+ * @param link
+ * @param options
+ */
+export function openLink ({ link, options = {}}) {
+  const router = getRouter()
+  console.log('[parent] openLink', link)
+  const { type = 'iframe' } = options
+  switch (type) {
+    case 'iframe': {
+      router.push({
+        path: getPageRoute(link)
+      })
+      break
+    }
+    case 'qiankun': {
+      router.push({
+        path: getQKRoute(link)
+      })
+      break
+    }
+    default: {
+      router.push({
+        name: 'base',
+        params: {
+          link: link
+        }
+      })
+      break
+    }
+  }
+}

+ 34 - 0
packages/micro-frame/qiankun/layout.vue

@@ -0,0 +1,34 @@
+<template>
+  <div class="micro-app--layout">
+    <logo-loading :loading="loading"></logo-loading>
+    <div id="app-container"></div>
+    <div class="abnormal-tip"  v-if="abnormal.status">
+      <h2><JyIcon svg name="bumanyi-cai" size="30"></JyIcon> {{abnormal.message}}</h2>
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapState } from 'vuex'
+import LogoLoading from '../../components/Loading'
+
+export default {
+  name: 'QKAppLayout',
+  components: {
+    [LogoLoading.name]: LogoLoading,
+  },
+  computed: {
+    ...mapState('work-bench/app', [
+      'loading',
+      'abnormal'
+    ])
+  }
+}
+</script>
+
+<style scoped>
+.micro-app--layout {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 12 - 0
packages/micro-frame/qiankun/router.js

@@ -0,0 +1,12 @@
+import Layout from './layout'
+
+export default {
+  path: 'app',
+  name: 'app',
+  component: Layout,
+  children: [
+    {
+      path: '*'
+    }
+  ]
+}

+ 103 - 0
packages/micro-frame/qiankun/store.js

@@ -0,0 +1,103 @@
+import { registerMicroApps, start, initGlobalState, addGlobalUncaughtErrorHandler } from 'qiankun'
+import { openLink, getQKRoute } from '../index'
+
+let action = null
+
+export default {
+  namespaced: true,
+  state: () => ({
+    MicroApps: [],
+    loading: true,
+    abnormal: {
+      status: false,
+      message: ''
+    },
+    sharedModel: {
+      use: 'parent use'
+    }
+  }),
+  mutations: {
+    register (state, data) {
+      state.MicroApps = state.MicroApps.concat(data)
+    },
+    toggleLoading (state, type) {
+      state.loading = type
+    },
+    syncModel (state, data) {
+      state.sharedModel = data
+    },
+    toggleAbnormal (state, { type, message }) {
+      state.abnormal.status = type
+      state.abnormal.message = message
+    }
+  },
+  actions: {
+    async microAppsStart ({ state, getters, commit, dispatch }) {
+      registerMicroApps(getters.apps, {
+        beforeLoad: (app) => {
+          commit('toggleLoading', true)
+          if (app.props.__QIANKUN_ROUTER_BASE) {
+            window.__QIANKUN_ROUTER_BASE = app.props.__QIANKUN_ROUTER_BASE
+          }
+        },
+        afterMount: (app) => {
+          console.log('after mount', app)
+          commit('toggleAbnormal', {
+            type: false
+          })
+          setTimeout(() => {
+            commit('toggleLoading', false)
+          }, 300)
+        }
+      })
+
+      start({
+        sandbox: {
+          strictStyleIsolation: true
+        }
+      })
+      addGlobalUncaughtErrorHandler((event) => {
+        commit('toggleLoading', false)
+        commit('toggleAbnormal', {
+          type: true,
+          message: '抱歉,加载应用未成功,请稍后重试'
+        })
+      })
+      dispatch('syncModel', state.sharedModel)
+    },
+    syncModel ({ state, commit }, payload = {}) {
+      if (!action) {
+        action = initGlobalState(payload)
+
+        action.onGlobalStateChange((data, prev) => {
+          commit('syncModel', data)
+        })
+      }
+
+      action.setGlobalState(payload)
+    }
+  },
+  getters: {
+    hooks () {
+      return {
+        openLink: openLink
+      }
+    },
+    apps (state, getters) {
+      return state.MicroApps.map(v => {
+        console.log(getQKRoute(v.rule, true), 'xx  rr')
+        return Object.assign({}, {
+          name: v.name,
+          entry: v.entry,
+          container: '#app-container',
+          activeRule: getQKRoute(v.rule, true)
+        }, v, {
+          props: Object.assign({}, {
+            __QIANKUN_ROUTER_BASE: getQKRoute(v.rule, true),
+            hooks: getters.hooks
+          }, v.props)
+        })
+      })
+    }
+  }
+}

+ 35 - 0
packages/router/index.js

@@ -0,0 +1,35 @@
+import WorkBench from '../layout/work-bench'
+import WorkBenchContentLayout from '../layout/work-bench/content'
+import Navbar from '../components/Navbar'
+import Menu from '../components/Menu'
+import appRoute from '../micro-frame/qiankun/router'
+import pageRoute from '../micro-frame/iframe/router'
+
+const workBenchContentRoutes = [
+  appRoute,
+  pageRoute
+]
+
+export function addRouter (routes = []) {
+  routes.forEach(v => {
+    workBenchContentRoutes.push(v)
+  })
+}
+
+const routes = [{
+  path: '',
+  component: WorkBench,
+  children: [
+    {
+      path: '',
+      components: {
+        default: WorkBenchContentLayout,
+        nav: Navbar,
+        menu: Menu
+      },
+      children: workBenchContentRoutes
+    }
+  ]
+}]
+
+export default routes

+ 9 - 0
packages/router/router.js

@@ -0,0 +1,9 @@
+let WorkBenchRouter = null
+
+export function setRouter (router) {
+  WorkBenchRouter = router
+}
+
+export function getRouter () {
+  return WorkBenchRouter
+}

+ 11 - 0
packages/store/index.js

@@ -0,0 +1,11 @@
+import menu from './modules/menu'
+import navbar from './modules/navbar'
+import user from './modules/user'
+import app from '../micro-frame/qiankun/store'
+
+export default {
+  menu,
+  navbar,
+  user,
+  app
+}

+ 2 - 20
src/store/modules/menu.js → packages/store/modules/menu.js

@@ -1,13 +1,12 @@
-import { ajaxGetMenus } from '../../api/modules/menu'
 import { intersection, cloneDeep } from 'lodash'
 
 const MenuTypes = [
   {
-    label: '全部服务',
+    label: '全部功能',
     key: 'all'
   },
   {
-    label: '可用服务',
+    label: '可用功能',
     key: 'available'
   }
 ]
@@ -99,23 +98,6 @@ export default {
     }
   },
   actions: {
-    /**
-     * 获取菜单数据源
-     * @param commit
-     * @param payload
-     * @returns {Promise<AxiosResponse<any>>}
-     */
-    getMenus ({ commit, state, dispatch }, payload = {}) {
-      return ajaxGetMenus(payload).then(({ data = {} }) => {
-        const { menuType = 0, menuList = [] } = data
-        commit('setMenu', menuList)
-        if (state.menuTypes[menuType]?.key) {
-          dispatch('setMenuType', {
-            key: state.menuTypes[menuType]?.key
-          })
-        }
-      })
-    },
     setMenuType({ commit, getters }, { key = 'all' } = {}) {
       if (key !== 'all' && !getters.activeMenu._compute._available) {
         return console.warn('当前菜单不可用,无法切换菜单类型')

+ 13 - 0
packages/store/modules/navbar.js

@@ -0,0 +1,13 @@
+export default {
+  namespaced: true,
+  state: () => ({
+    messageCount: 0
+  }),
+  mutations: {
+    changeCount (state, data) {
+      state.messageCount = data
+    },
+  },
+  actions: {},
+  getters: {}
+}

+ 1 - 28
src/store/modules/user.js → packages/store/modules/user.js

@@ -1,5 +1,3 @@
-import { ajaxGetPower, ajaxGetUserInfo, ajaxSetSignOut } from '../../api/modules'
-
 export default {
   namespaced: true,
   state: () => ({
@@ -14,32 +12,7 @@ export default {
       state.userSimpleInfo = data
     }
   },
-  actions: {
-    async getUserSimpleInfo ({ commit }, payload = {}) {
-      try {
-        const data = await ajaxGetUserInfo(payload)
-        commit('changeUserSimpleInfo', data || {})
-      } catch (error) {}
-    },
-    async checkPower ({ dispatch, state = {} }, payload = {}) {
-      if (Object.keys(state.power)?.length) {
-        return state.power || {}
-      } else {
-        return await dispatch('getPower', { noToast: true })
-      }
-    },
-    async getPower ({ commit }, payload = {}) {
-      try {
-        const { error_code: code, data = {} } = await ajaxGetPower(payload)
-        if (code === 0) {
-          commit('changePower', data || {})
-        }
-      } catch (error) {}
-    },
-    async setSignOut ({} , payload = {}) {
-      return ajaxSetSignOut(payload)
-    }
-  },
+  actions: {},
   getters: {
     isMember (state) {
       return state.power?.memberStatus > 0

+ 0 - 0
src/assets/style/_variables.scss → packages/style/_variables.scss


+ 0 - 0
src/assets/style/base.scss → packages/style/base.scss


+ 0 - 0
src/assets/style/common.scss → packages/style/common.scss


+ 0 - 0
src/assets/style/index.scss → packages/style/index.scss


BIN
public/favicon.ico


+ 0 - 1
public/index.html

@@ -4,7 +4,6 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <link rel="stylesheet" href="https://cdn-common.jianyu360.com/cdn/assets/iconfont/pc/22.7.2/iconfont.css">
     <title><%= htmlWebpackPlugin.options.title %></title>
   </head>

+ 0 - 7
src/App.vue

@@ -1,7 +0,0 @@
-<template>
-  <router-view/>
-</template>
-
-
-<style lang="scss">
-</style>

+ 0 - 5
src/api/index.js

@@ -1,5 +0,0 @@
-import service from './core/service'
-import './core/interceptors'
-import './mock/index'
-
-export default service

+ 0 - 181
src/api/mock/index.js

@@ -1,181 +0,0 @@
-import Mock from 'mockjs'
-
-function registeredInterceptor () {
-  const BaseAPI = process.env.VUE_APP_BASE_API
-
-  const Mocks = []
-
-  // 菜单数据
-  Mocks.push({
-    url: '/userCenter/userCenter/work/view',
-    type: 'post',
-    data: (option) => {
-      return {
-        error_code: '',
-        error_msg: '',
-        data: {
-          menuType: 0,
-          menuList: [
-            {
-              key: 'home',
-              label: '首页',
-              icon: 'icon-home',
-              available: true,
-              link: 'home',
-              appType: '',
-              openType: '',
-              match: []
-            },
-            {
-              label: '商机',
-              icon: 'icon-company',
-              children: [
-                {
-                  label: '信息搜索',
-                  icon: 'icon-search',
-                  children: [
-                    {
-                      label: '我的订单',
-                      available: true,
-                      link: 'http://localhost:8080/jianyu-page/front/swordfish/toMyOrder',
-                      appType: 'iframe',
-                      openType: '_self' || '_blank',
-                    },
-                    {
-                      label: '招标采购搜索',
-                      link: 'https://jybx-webtest.jydev.jianyu360.com/jylab/supsearch/index.html',
-                      appType: 'iframe',
-                      openType: '_self' || '_blank',
-                      available: true
-                    },
-                    {
-                      label: '供应搜索',
-                      available: true
-                    },
-                    {
-                      label: '企业搜索',
-                      link: 'https://jybx-webtest.jydev.jianyu360.com/jylab/entSearch/index.html',
-                      match: [
-                        '/jylab\/.*\/index\.html/'
-                      ],
-                      appType: 'iframe',
-                      available: true
-                    },
-                    {
-                      label: '信息发布',
-                      link: 'https://jybx-webtest.jydev.jianyu360.com/swordfish/page_web_pc/issued/my',
-                      match: [
-                        'page_web_pc'
-                      ],
-                      appType: 'iframe',
-                      available: true
-                    },
-                    {
-                      label: '采购单位搜索'
-                    }
-                  ]
-                },
-                {
-                  label: '订阅监控',
-                  icon: 'icon-hui2',
-                  children: [
-                    {
-                      label: '免费订阅',
-                      available: true
-                    },
-                    {
-                      label: '项目进度监控'
-                    },
-                    {
-                      label: '企业情报监控'
-                    },
-                    {
-                      label: '客户监控'
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              label: '分析',
-              icon: 'icon-hui9',
-              children: [
-                {
-                  label: '信息搜索信',
-                  icon: 'icon-search',
-                  children: [
-                    {
-                      available: true,
-                      label: '潜在竞争对手/合作伙伴挖掘'
-                    },
-                    {
-                      label: '供应新搜索'
-                    },
-                    {
-                      label: '企业搜索'
-                    },
-                    {
-                      label: '采购单位搜索'
-                    }
-                  ]
-                },
-                {
-                  label: '订阅监控',
-                  icon: 'icon-hui2',
-                  children: [
-                    {
-                      label: '免费订阅',
-                      available: true,
-                    },
-                    {
-                      label: '项目进度监控',
-                      available: true,
-                    },
-                    {
-                      label: '企业情报监控'
-                    },
-                    {
-                      label: '客户监控'
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              label: '服务',
-              icon: 'icon-a-Property1fuwuProperty2grey',
-              available: true
-            },
-            {
-              label: '服务商',
-              icon: 'icon-hui10'
-            },
-            {
-              label: '资产',
-              icon: 'icon-hui5',
-              available: true,
-              match: [
-                'test'
-              ]
-            },
-            {
-              label: '设置',
-              icon: 'icon-Setting',
-              available: true
-            }
-          ]
-        }
-      }
-    }
-  })
-
-  Mocks.forEach(m => {
-    Mock.mock(BaseAPI + m.url, m.type, (option) => {
-      return Mock.mock(m.data(option))
-    })
-  })
-}
-
-if (process.env.VUE_APP_API_MOCK) {
-  registeredInterceptor()
-}

+ 0 - 3
src/api/modules/index.js

@@ -1,3 +0,0 @@
-export * from './menu'
-export * from './navbar'
-export * from './user'

+ 0 - 10
src/api/modules/menu.js

@@ -1,10 +0,0 @@
-import request  from '../index'
-
-// 获取菜单数据
-export function ajaxGetMenus (data) {
-  return request({
-    url: '/userCenter/userCenter/work/view',
-    method: 'post',
-    data
-  })
-}

+ 0 - 10
src/api/modules/navbar.js

@@ -1,10 +0,0 @@
-import request  from '../index'
-
-// 获取未读消息条数
-export function ajaxGetMessageCount (data) {
-  return request({
-    url: '/jymessageCenter/isMsgOpen',
-    method: 'get',
-    data
-  })
-}

+ 0 - 28
src/api/modules/user.js

@@ -1,28 +0,0 @@
-import request  from '../index'
-
-// 获取用户权限
-export function ajaxGetPower (data) {
-  return request({
-    url: '/bigmember/use/isAdd',
-    method: 'post',
-    data
-  })
-}
-
-// 获取用户信息
-export function ajaxGetUserInfo (data) {
-  return request({
-    url: '/jypay/user/getSimpleData',
-    method: 'post',
-    data
-  })
-}
-
-// 退出登录
-export function ajaxSetSignOut (data) {
-  return request({
-    url: '/front/signOut',
-    method: 'post',
-    data
-  })
-}

+ 0 - 28
src/main.js

@@ -1,28 +0,0 @@
-import Vue from 'vue'
-import App from './App.vue'
-import router from './router'
-import store from './store'
-import './micro-frame/qiankun'
-import ElementUI from 'element-ui'
-import 'element-ui/lib/theme-chalk/index.css'
-import JianyuIcon from '@jianyu/icon'
-
-Vue.use(ElementUI)
-Vue.use(JianyuIcon)
-Vue.config.productionTip = false
-
-export {
-  Vue,
-  router,
-  store
-}
-
-if (process.env.VUE_APP_TEMPLATE) {
-  new Vue({
-    router,
-    store,
-    render: h => h(App)
-  }).$mount('#app')
-}
-
-console.log('[debug] template:', process.env)

+ 0 - 16
src/micro-frame/iframe/router.js

@@ -1,16 +0,0 @@
-import Layout from './layout'
-
-export default {
-  path: 'page',
-  name: 'page',
-  component: Layout,
-  beforeRouteEnter: (to, from, next) => {
-    console.warn(to.query.link, 'to-link')
-    next()
-  },
-  beforeRouteUpdate: (to, from, next) => {
-    console.warn(to.query.link, 'to-link2')
-    next()
-  }
-}
-

+ 0 - 12
src/micro-frame/qiankun/index.js

@@ -1,12 +0,0 @@
-import { registerMicroApps, start } from 'qiankun'
-
-registerMicroApps([
-  {
-    name: 'bigMemberSubApp',
-    entry: '//localhost:8081',
-    container: '#app-container',
-    activeRule: '/work-bench/app/pc-big-member'
-  }
-])
-
-start()

+ 0 - 18
src/micro-frame/qiankun/layout.vue

@@ -1,18 +0,0 @@
-<template>
-  <div class="micro-app--layout">
-    <div id="app-container"></div>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'QKAppLayout'
-}
-</script>
-
-<style scoped>
-.micro-app--layout {
-  width: 100%;
-  height: 100%;
-}
-</style>

+ 0 - 53
src/router/index.js

@@ -1,53 +0,0 @@
-import Vue from 'vue'
-import VueRouter from 'vue-router'
-
-if (process.env.NODE_DEV !== 'production') {
-  Vue.use(VueRouter)
-}
-
-let routes = [
-  {
-    path: '/',
-    redirect: '/work-bench',
-  },
-  {
-    path: '/404',
-    name: '404',
-    component: () => import('@/views/404.vue')
-  }
-]
-
-const routerContext = require.context('./modules', true, /\.js$/)
-
-routerContext.keys().forEach(route => {
-  if (route.startsWith('./index')) {
-    return
-  }
-  const moduleName = route.replace(/.\/(.*)\.js$/, '$1')
-  const routerModule = routerContext(route).default
-  routerModule.forEach(v => {
-    v.path = `/${moduleName}${v.path}`
-    if (v.name) {
-      v.name = `${moduleName}-${v.name}`
-    }
-    if (v.alias) {
-      v.alias = `/${moduleName}${v.alias}`
-    }
-  })
-  routes = routes.concat(routerModule.default || routerModule)
-})
-
-routes.push({
-  path: '*',
-  redirect: '/404'
-})
-
-const createRouter = () => new VueRouter({
-  mode: 'history',
-  base: process.env.VUE_APP_BASE_URL,
-  scrollBehavior: () => ({ x: 0, y: 0 }),
-  routes
-})
-
-const router = createRouter()
-export default router

+ 0 - 51
src/router/modules/work-bench.js

@@ -1,51 +0,0 @@
-import WorkBench from '@/layout/work-bench'
-import WorkBenchContentLayout from '@/layout/work-bench/content'
-import Navbar from '@/components/Navbar'
-import Menu from '@/components/Menu'
-import TestView from '@/views/Test'
-import appRoute from '@/micro-frame/qiankun/router'
-import pageRoute from '@/micro-frame/iframe/router'
-
-const workBenchContentRoutes = [
-  {
-    path: '',
-    redirect: 'test/home',
-  },
-  {
-    path: 'test/:link',
-    name: 'test',
-    component: TestView,
-    beforeEnter: (to, from, next) => {
-      console.log(to.query.link, 'to-link')
-      next()
-    }
-  },
-  appRoute,
-  pageRoute
-]
-
-const routes =   [{
-  path: '',
-  component: WorkBench,
-  children: [
-    {
-      path: '',
-      components: {
-        default: WorkBenchContentLayout,
-        nav: Navbar,
-        menu: Menu
-      },
-      children: workBenchContentRoutes,
-      beforeRouteEnter: (to, from ,next) => {
-        console.warn(to.query.link, 'to-link')
-        next()
-      }
-    }
-  ],
-  beforeRouteEnter: (to, from ,next) => {
-    console.warn(to.query.link, 'to-link')
-    next()
-  }
-}]
-
-export default routes

+ 0 - 21
src/store/index.js

@@ -1,21 +0,0 @@
-import Vue from 'vue'
-import Vuex from 'vuex'
-import menu from './modules/menu'
-import navbar from './modules/navbar'
-import user from './modules/user'
-
-if (process.env.NODE_DEV !== 'production') {
-  Vue.use(Vuex)
-}
-
-export default new Vuex.Store({
-  state: {},
-  getters: {},
-  mutations: {},
-  actions: {},
-  modules: {
-    menu,
-    navbar,
-    user
-  }
-})

+ 0 - 24
src/store/modules/navbar.js

@@ -1,24 +0,0 @@
-import { ajaxGetMessageCount } from '../../api/modules'
-
-export default {
-  namespaced: true,
-  state: () => ({
-    messageCount: 0
-  }),
-  mutations: {
-    changeCount (state, data) {
-      state.messageCount = data
-    },
-  },
-  actions: {
-    async getMessageCount ({ commit }, payload = {}) {
-      try {
-        const { status: code, data = {} } = await ajaxGetMessageCount(payload)
-        if (code) {
-          commit('changeCount', data?.count || 0)
-        }
-      } catch (error) {}
-    },
-  },
-  getters: {}
-}

+ 0 - 11
src/views/404.vue

@@ -1,11 +0,0 @@
-<template>
-  <div class="404-page">
-    <h1>404 Page</h1>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'NotFindPage'
-}
-</script>

+ 0 - 52
src/views/Test.vue

@@ -1,52 +0,0 @@
-<template>
-  <div class="content-layout">
-    <div class="content-shadow">
-      <router-link to="/work-bench/page/app/big-member">big-member</router-link>
-      |
-      <router-link to="/work-bench/app/pc-big-member">pc-big-member</router-link>|
-      <router-link to="/work-bench/page/h?url=http://localhost:8080/jianyu-page/front/swordfish/toMyOrder"> iframe </router-link>
-      <h2><JyIcon svg name="manyi-cai" size="30"></JyIcon> This Test Route</h2>
-      <div class="menu-info-group">
-        当前 Link: {{ $route.params.link }}
-        <br>
-        <br>
-        <div v-if="$store.getters['menu/activeMenu']._compute">
-          菜单信息:  {{ $store.getters['menu/activeMenu']._compute._key }} {{ $store.getters['menu/activeMenu']._compute._label }}
-          <br>
-          <br>
-          菜单信息原始可用状态: {{ $store.getters['menu/activeMenu'].available }}
-          <br>
-          菜单信息计算后可用状态: {{ $store.getters['menu/activeMenu']._compute._available }}
-          <br>
-          <br>
-          当前菜单类型: {{ $store.state.menu.type }}
-        </div>
-      </div>
-      <router-view></router-view>
-    </div>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'TestView'
-}
-</script>
-<style scoped>
-.content-layout {
-  padding: 24px;
-  box-sizing: border-box;
-}
-.content-shadow {
-  padding: 32px;
-}
-.menu-info-group {
-  display: flex;
-  flex-direction: column;
-  align-items: flex-start;
-
-  margin: 12px 8px;
-  font-size: 16px;
-  color: #1D1D1D;
-}
-</style>

+ 3 - 4
vue.config.js

@@ -1,5 +1,4 @@
 const { defineConfig } = require('@vue/cli-service')
-const proxy = require('./config/dev-proxy')
 const path = require('path')
 
 function resolve (dir) {
@@ -8,18 +7,18 @@ function resolve (dir) {
 
 module.exports = defineConfig({
   transpileDependencies: true,
-  outputDir: 'work',
+  outputDir: 'home',
   publicPath: process.env.VUE_APP_BASE_PUBLIC,
   devServer: {
     historyApiFallback: true,
     allowedHosts: 'all',
     headers: {
       'Access-Control-Allow-Origin': '*'
-    },
-    proxy: proxy
+    }
   },
   chainWebpack: config => {
     config.resolve.alias
       .set('@public', resolve('public'))
+      .set('@packages', resolve('packages'))
   }
 })