Explorar o código

feat: update utils

zhangyuhan %!s(int64=3) %!d(string=hai) anos
pai
achega
0ad7b83782

+ 1 - 1
package.json

@@ -13,7 +13,7 @@
   },
   },
   "dependencies": {
   "dependencies": {
     "@jianyu/easy-fix-sub-app": "^0.0.1",
     "@jianyu/easy-fix-sub-app": "^0.0.1",
-    "@jianyu/easy-inject-qiankun": "^0.1.7",
+    "@jianyu/easy-inject-qiankun": "^0.1.9",
     "@jianyu/icon": "^0.1.7",
     "@jianyu/icon": "^0.1.7",
     "axios": "^0.21.1",
     "axios": "^0.21.1",
     "core-js": "^3.4.3",
     "core-js": "^3.4.3",

+ 16 - 2
src/store/workspace/common-use.js

@@ -1,4 +1,3 @@
-import { tryCallHooks } from '@jianyu/easy-inject-qiankun'
 import { getWorkspaceMenu, workspaceCommonUse } from '@/api/modules'
 import { getWorkspaceMenu, workspaceCommonUse } from '@/api/modules'
 
 
 // 把菜单接口数据转化成一维数组
 // 把菜单接口数据转化成一维数组
@@ -48,7 +47,22 @@ export default {
     // 获取所有可用功能
     // 获取所有可用功能
     async getAllFunctions ({ commit, dispatch }, payload) {
     async getAllFunctions ({ commit, dispatch }, payload) {
       const { vm } = payload
       const { vm } = payload
-      tryCallHooks(vm.$BraceHooks, 'getStore', {}, async () => {
+      /**
+       * 调用基座钩子,获取信息
+       */
+      if (!vm?.$BRACE?.$promise) {
+        return dispatch('getWorkspaceMenu')
+      }
+      vm.$BRACE.$promise({
+        fKey: 'getStore',
+        all: false
+      }).then(({ type = '', data: store }) => {
+        if (type === 'success') {
+          console.log(store.getters.getMenus, store)
+        } else {
+          dispatch('getWorkspaceMenu')
+        }
+      }).catch(() => {
         dispatch('getWorkspaceMenu')
         dispatch('getWorkspaceMenu')
       })
       })
     },
     },

+ 9 - 3
src/views/SubPush.vue

@@ -84,7 +84,6 @@ import Dialog from '@/components/dialog/Dialog.vue'
 import FollowOfficialAccountDialog from '@/components/dialog/FollowOfficialAccountDialog.vue'
 import FollowOfficialAccountDialog from '@/components/dialog/FollowOfficialAccountDialog.vue'
 import { getFreeUserPushInfo } from '@/api/modules/'
 import { getFreeUserPushInfo } from '@/api/modules/'
 import { mapState, mapGetters, mapActions } from 'vuex'
 import { mapState, mapGetters, mapActions } from 'vuex'
-import { tryCallHooks } from '@jianyu/easy-inject-qiankun'
 
 
 export default {
 export default {
   name: 'SubPush',
   name: 'SubPush',
@@ -317,9 +316,16 @@ export default {
       } else if (this.vt === 's') {
       } else if (this.vt === 's') {
         // 商机管理跳转老页面(框架内打开)
         // 商机管理跳转老页面(框架内打开)
         const url = '/entpc/newBus/set_subscribe'
         const url = '/entpc/newBus/set_subscribe'
-        tryCallHooks(this.$BraceHooks, 'openLink', { url }, () => {
+        if (this?.$BRACE?.methods?.open) {
+          this.$BRACE.methods.open({
+            route: {
+              link: url,
+              appType: 'qiankun'
+            }
+          })
+        } else {
           window.open(url)
           window.open(url)
-        })
+        }
       }
       }
     },
     },
     toBuySvip () {
     toBuySvip () {

+ 4 - 3
src/views/workspace/components/CommonUse.vue

@@ -39,7 +39,6 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { tryCallHooks } from '@jianyu/easy-inject-qiankun'
 import { JyIcon } from '@jianyu/icon'
 import { JyIcon } from '@jianyu/icon'
 import { mapState, mapMutations, mapActions } from 'vuex'
 import { mapState, mapMutations, mapActions } from 'vuex'
 import { Dialog, Image } from 'element-ui'
 import { Dialog, Image } from 'element-ui'
@@ -84,8 +83,10 @@ export default {
       this.transferSave(data)
       this.transferSave(data)
     },
     },
     openLink (url) {
     openLink (url) {
-      tryCallHooks(this.$BraceHooks, 'openLink', { url }, () => {
-        window.open(url)
+      this.$BRACE.methods.open({
+        route: {
+          link: url
+        }
       })
       })
     },
     },
     confirmSaveFn () {
     confirmSaveFn () {