feat(router): 添加服务主机路径配置和产品维保查询标题更新
- 引入 `isServiceHost` 函数并根据服务主机设置路由路径 - 更新产品维保查询页面标题 - 在生产环境配置中添加 `VUE_APP_SERVICE_HOST` - 更新权限检查逻辑以支持服务主机路径dev_1.0.2
parent
9b90d44e34
commit
7a7b549de3
|
|
@ -6,3 +6,4 @@ ENV = 'production'
|
|||
|
||||
# 若依管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
VUE_APP_SERVICE_HOST = 'wb.service.unissense.top'
|
||||
|
|
|
|||
|
|
@ -5,12 +5,16 @@ import NProgress from 'nprogress'
|
|||
import 'nprogress/nprogress.css'
|
||||
import { isPathMatch } from '@/utils/validate'
|
||||
import { isRelogin } from '@/utils/request'
|
||||
import { isServiceHost } from '@/utils/serviceHost'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register', '/manage/service','/system/vendor/query','/system/partner/query']
|
||||
|
||||
const isWhiteList = (path) => {
|
||||
if (path === '/' && isServiceHost()) {
|
||||
return true
|
||||
}
|
||||
return whiteList.some(pattern => isPathMatch(pattern, path))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import { isServiceHost } from '@/utils/serviceHost'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
|
|
@ -62,10 +63,10 @@ export const constantRoutes = [
|
|||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
path: isServiceHost() ? '/admin-root' : '',
|
||||
component: Layout,
|
||||
redirect: 'index',
|
||||
children: [
|
||||
redirect: isServiceHost() ? undefined : 'index',
|
||||
children: isServiceHost() ? [] : [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/index'),
|
||||
|
|
@ -152,6 +153,11 @@ export const constantRoutes = [
|
|||
},
|
||||
|
||||
|
||||
{
|
||||
path: isServiceHost() ? '/' : '/service-host-root',
|
||||
component: () => import('@/views/manage/service/index'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/manage/service',
|
||||
component: () => import('@/views/manage/service/index'),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
const serviceHosts = (process.env.VUE_APP_SERVICE_HOST || '')
|
||||
.split(',')
|
||||
.map(host => host.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
|
||||
export function isServiceHost(hostname) {
|
||||
const currentHost = (hostname || (typeof window !== 'undefined' ? window.location.hostname : '') || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
|
||||
return currentHost !== '' && serviceHosts.includes(currentHost)
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="service-container">
|
||||
<div class="top-box">
|
||||
<div class="title">产品维保查询 <span>(不支持第三方信息查询)</span></div>
|
||||
<div class="title">紫光汇智产品维保查询</div>
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<div class="form-group">
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<div class="result-section">
|
||||
<div class="result-title">查询结果</div>
|
||||
|
||||
|
||||
<div class="sub-title">
|
||||
<blockquote style="border-left-color: #1c84c6">产品信息</blockquote>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue