From b87f44cd680923442b5e6c695268d38fdbc59451 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 24 Feb 2022 18:50:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B7=B7=E5=85=A5=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/main.js | 3 +++ frontend/src/mixin/index.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 frontend/src/mixin/index.js diff --git a/frontend/src/business/main.js b/frontend/src/business/main.js index d07ba3265d..e4b5f30278 100644 --- a/frontend/src/business/main.js +++ b/frontend/src/business/main.js @@ -29,6 +29,7 @@ import formCreate from "@form-create/element-ui" import mavonEditor from 'mavon-editor' import 'mavon-editor/dist/css/index.css' import 'element-ui/lib/theme-chalk/display.css'; +import mixin from '../mixin' Vue.use(mavonEditor) Vue.use(vueMinderEditor) @@ -56,6 +57,8 @@ Vue.use(VueFab); Vue.use(JSONPathPicker); Vue.use(VueClipboard) +Vue.mixin(mixin) + // v-permission Vue.directive('permission', permission); diff --git a/frontend/src/mixin/index.js b/frontend/src/mixin/index.js new file mode 100644 index 0000000000..2b6955f72b --- /dev/null +++ b/frontend/src/mixin/index.js @@ -0,0 +1,14 @@ +import {PROJECT_ID, TokenKey, WORKSPACE_ID} from "@/common/js/constants"; + +const mixin = { + data() { + return { + msCurrentProjectId: sessionStorage.getItem(PROJECT_ID), + msCurrentWorkspaceId: sessionStorage.getItem(WORKSPACE_ID), + msCurrentUser: JSON.parse(localStorage.getItem(TokenKey)), + msCurrentUserId: JSON.parse(localStorage.getItem(TokenKey)).id + } + } +} + +export default mixin