fix: 修复license页面无法访问问题

This commit is contained in:
XieYongHong 2023-05-08 14:59:56 +08:00 committed by GitHub
parent 8933b9498d
commit 4392dda0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 76 deletions

View File

@ -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",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 232 KiB

View File

@ -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 切换路由取消请求

View File

@ -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')) {

View File

@ -14,7 +14,7 @@
<j-col :span="12"><DeviceCountCard /></j-col>
<j-col :span="12"><BasicCountCard /></j-col>
<j-col :span="24" style="margin-top: 24px">
<PlatformPicCard image="/images/home/content.png" />
<PlatformPicCard image="/images/home/content1.svg" />
</j-col>
</j-row>
</j-col>

View File

@ -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,
// },
// ],
// },
],
},
//物联卡

View File

@ -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),
);

View File

@ -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"