diff --git a/package.json b/package.json index 283b4a22..e5f20972 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "event-source-polyfill": "^1.0.31", "global": "^4.4.0", "jetlinks-store": "^0.0.3", - "jetlinks-ui-components": "^1.0.9", + "jetlinks-ui-components": "^1.0.12", "js-cookie": "^3.0.1", "less": "^4.1.3", "less-loader": "^11.1.0", diff --git a/public/images/home/content.png b/public/images/home/content.png index 8c8364d3..a16bf4db 100644 Binary files a/public/images/home/content.png and b/public/images/home/content.png differ diff --git a/src/router/index.ts b/src/router/index.ts index 1641803e..09f14d0e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,5 +1,5 @@ import { createRouter, createWebHashHistory } from 'vue-router' -import menus, { AccountCenterBindPath, InitHomePath, LoginPath, OauthPath } from './menu' +import menus, { AccountCenterBindPath, InitHomePath, InitLicense, LoginPath, OauthPath } from './menu' import { cleanToken, getToken } from '@/utils/comm' import { useUserInfo } from '@/store/userInfo' import { useSystem } from '@/store/system' @@ -15,7 +15,7 @@ const router = createRouter({ }) const filterPath = [ InitHomePath ] -const noTokenPath = [ AccountCenterBindPath, OauthPath ] +const noTokenPath = [ AccountCenterBindPath, OauthPath, InitLicense ] router.beforeEach((to, from, next) => { // TODO 切换路由取消请求 diff --git a/src/utils/request.ts b/src/utils/request.ts index 54687a0d..9fa10727 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,6 +1,6 @@ import axios from 'axios' import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable' -import { notification as Notification } from 'jetlinks-ui-components' +import { notification as Notification, Modal } from 'jetlinks-ui-components' import router from '@/router' import { LoginPath } from '@/router/menu' import { cleanToken, getToken, LocalStore } from '@/utils/comm' @@ -21,7 +21,8 @@ const filterApiUrl = [ '/authorize/captcha/image', '/application/sso/bind-code', '/authorize/login', - '/application/' + '/application/', + '/license' ] export const request = axios.create({ @@ -149,7 +150,23 @@ const errorHandler = (error: any) => { if (error.response) { const data = error.response.data const status = error.response.status - if (status === 403) { + if (data?.code === 'license required') { + Modal.error({ + key: 'License', + title: 'License已到期或者错误', + content: h( + 'a', + { + onClick: () => + { + Modal.destroyAll?.(); + window.location.href = '/#/init-license'; + } + }, + '请更新License' + ) + }) + } else if (status === 403) { showNotification('Forbidden', (data.message + '').substr(0, 90), '403') } else if (status === 500) { showNotification('Server Side Error', (data.message + '').substr(0, 90), '500') @@ -158,13 +175,15 @@ const errorHandler = (error: any) => { } else if (status === 401) { showNotification('Unauthorized', '用户未登录', '401') setTimeout(() => { - // cleanToken() - // router.replace({ - // path: LoginPath - // }) + cleanToken() + router.replace({ + path: LoginPath + }) }, 0) } else if (status === 404) { - showNotification(error?.code, error?.response?.data?.message, '404') + const data = error?.response?.data + const message = error?.response?.data?.message || `${data?.error} ${data?.path}` + showNotification(error?.code, message, '404') } } else if (error.response === undefined) { if (error.message.includes('timeout')) { diff --git a/src/views/home/components/ComprehensiveHome/index.vue b/src/views/home/components/ComprehensiveHome/index.vue index 0cf23b9c..9084ccc1 100644 --- a/src/views/home/components/ComprehensiveHome/index.vue +++ b/src/views/home/components/ComprehensiveHome/index.vue @@ -14,7 +14,7 @@ - + diff --git a/src/views/init-home/data/baseMenu.ts b/src/views/init-home/data/baseMenu.ts index 61adef4e..5dbdd6f2 100644 --- a/src/views/init-home/data/baseMenu.ts +++ b/src/views/init-home/data/baseMenu.ts @@ -3922,50 +3922,50 @@ export default [ accessSupport: { text: "不支持", value: "unsupported" }, supportDataAccess: false }, - { - code: 'system/License', - name: 'License管理', - owner: 'iot', - //parentId: '3', - id: '3-12', - sortIndex: 12, - url: '/system/License', - icon: 'icon-zidingyiguize', - showPage: ['license'], - permissions: [ - { - permission: 'license', - actions: ['query', 'save'], - }, - ], - buttons: [ - { - id: 'update', - name: '编辑', - description: null, - permissions: [ - { - permission: 'license', - actions: ['query', 'save'], - }, - ], - options: null, - }, - - { - id: 'view', - name: '查看', - description: null, - permissions: [ - { - permission: 'license"', - actions: ['query'], - }, - ], - options: null, - }, - ], - }, + // { + // code: 'system/License', + // name: 'License管理', + // owner: 'iot', + // //parentId: '3', + // id: '3-12', + // sortIndex: 12, + // url: '/system/License', + // icon: 'icon-zidingyiguize', + // showPage: ['license'], + // permissions: [ + // { + // permission: 'license', + // actions: ['query', 'save'], + // }, + // ], + // buttons: [ + // { + // id: 'update', + // name: '编辑', + // description: null, + // permissions: [ + // { + // permission: 'license', + // actions: ['query', 'save'], + // }, + // ], + // options: null, + // }, + // + // { + // id: 'view', + // name: '查看', + // description: null, + // permissions: [ + // { + // permission: 'license"', + // actions: ['query'], + // }, + // ], + // options: null, + // }, + // ], + // }, ], }, //物联卡 diff --git a/src/views/system/Menu/Setting/index.vue b/src/views/system/Menu/Setting/index.vue index c26096f3..a5f34973 100644 --- a/src/views/system/Menu/Setting/index.vue +++ b/src/views/system/Menu/Setting/index.vue @@ -186,9 +186,13 @@ const onDragend = (info: AntTreeNodeDropEvent) => { onMounted(() => { getSystemPermission_api().then((resp: any) => { + const filterBaseMenu = BaseMenu.filter(item => ![ + USER_CENTER_MENU_CODE, + MESSAGE_SUBSCRIBE_MENU_CODE, + ].includes(item.code)) baseMenu.value = filterMenu( resp.result.map((item: any) => JSON.parse(item).id), - BaseMenu, + filterBaseMenu, ); getMenuTree_api(params).then((resp: any) => { if (resp.status == 200) { @@ -205,7 +209,7 @@ onMounted(() => { selectedKeys.value = systemMenuData.checkedKeys; const AllMenu = mergeArr( - cloneDeep(BaseMenu), + cloneDeep(filterBaseMenu), cloneDeep(systemMenu.value), ); diff --git a/yarn.lock b/yarn.lock index 916777a0..d3cea84b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3823,29 +3823,15 @@ jetlinks-store@^0.0.3: resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz" integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q== -jetlinks-ui-components@1.0.5: - version "1.0.5" - resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#f91a7e1e0c72addcc6f2cadb260039010c481eaf" - integrity sha512-ZcR0ukT9bZn2syyOk9lKjjZ1cHpmMBvdHuTqayZgXwq6+pZSM5nqtVMgdUu0AXQ+pL0KbWes4L0NweYSW7XJOg== +jetlinks-ui-components@^1.0.12: + version "1.0.12" + resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.12.tgz#b3bd976b6ec7f6e45efe011cd3c6234734a064c2" + integrity sha512-P2PMuiOGRNKB58nr13UXbn1z6No3VyLJgyV5YmAtm8qmjU5WGHJDLJbYLY4lSPHbMhjGzisP4OJ4/z9rjlRZKg== dependencies: "@vueuse/core" "^9.12.0" "@vueuse/router" "^9.13.0" ant-design-vue "^3.2.15" colorpicker-v3 "^2.10.2" - jetlinks-ui-components "1.0.5" - lodash-es "^4.17.21" - monaco-editor "^0.35.0" - -jetlinks-ui-components@^1.0.9: - version "1.0.9" - resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.9.tgz#c71e593e65b9e8dd16c746cebf16d45339a0d340" - integrity sha512-NRKA20IYMvaGabJTnt180ahjL6ERJz8rDohAMtaP4bWQeSAq89hBB5s6XMRJK4VexliEEo4+V3E/edK2iNsGWg== - dependencies: - "@vueuse/core" "^9.12.0" - "@vueuse/router" "^9.13.0" - ant-design-vue "^3.2.15" - colorpicker-v3 "^2.10.2" - jetlinks-ui-components "1.0.5" lodash-es "^4.17.21" monaco-editor "^0.35.0"