Commit 1a97ebc4 authored by nick zheng's avatar nick zheng

build: 基础路由路径调整

parent 1bb56c56
......@@ -4,6 +4,6 @@ VITE_APP_NAME = 'POC'
VITE_APP_THEME_COLOR = '#2468f2'
VITE_PORT = 8848
VITE_PUBLIC_PATH = /fe
VITE_ROUTER_MODE = 'hash'
VITE_ROUTER_MODE = 'h5'
VITE_VITEST = true
VITE_HIDE_HOME = false
......@@ -3,5 +3,5 @@ VITE_APP_NAME = 'POC'
VITE_APP_THEME_COLOR = '#2468f2'
VITE_PUBLIC_PATH = /fe
VITE_ROUTER_MODE = 'hash'
VITE_ROUTER_MODE = 'h5'
......@@ -4,6 +4,6 @@ export const BASE_URLS: Record<'DEV' | 'PROD', string> = {
}
export const INDEX_URLS: Record<'DEV' | 'PROD', string> = {
DEV: 'https://poc-sit.gsstcloud.com/fe#/',
PROD: 'https://poc.gsstcloud.com/fe#/',
DEV: 'https://poc-sit.gsstcloud.com/fe/',
PROD: 'https://poc.gsstcloud.com/fe/',
}
......@@ -11,11 +11,13 @@ export interface MenuOption {
}
export function getHistoryMode(modeString: ViteEnv['VITE_ROUTER_MODE']): RouterHistory {
const PUBLIC_PATH = import.meta.env.VITE_PUBLIC_PATH
if (modeString === 'h5') {
return createWebHistory()
return createWebHistory(PUBLIC_PATH)
}
return createWebHashHistory()
return createWebHashHistory(PUBLIC_PATH)
}
function menuSort(routes: RouteRecordRaw[]) {
......
......@@ -16,15 +16,18 @@ export interface Response<T> {
pagingInfo?: PagingInfoParams & { totalPages: number; totalRows: number }
}
const ENV = import.meta.env.VITE_APP_ENV
function handleLogout() {
const currentRoute = router.currentRoute.value
router.replace({ name: 'Login', query: { redirect: encodeURIComponent(currentRoute.fullPath) } })
useUserStore().logout()
window.$message.warning('身份已过期,请重新登录')
}
const service = axios.create({
baseURL: `${BASE_URLS[window.ENV || 'DEV']}/api/rest`,
baseURL: `${BASE_URLS[ENV]}/api/rest`,
timeout: 7000,
headers: {
'Content-Type': 'application/json',
......
......@@ -10,6 +10,8 @@ const { pageContentWrapRef, tableContentY } = useTableScrollY()
const router = useRouter()
const ENV = import.meta.env.VITE_APP_ENV
const channelPublishList = reactive([
{
type: 'web',
......@@ -30,13 +32,13 @@ function handleClickChannelPublishTableAction(actionType: string) {
}
function handleAccessPage() {
const channleUrl = `${INDEX_URLS[window.ENV || 'DEV']}share/web_source/${router.currentRoute.value.params.agentId}`
location.href = channleUrl
const channelUrl = `${INDEX_URLS[ENV]}share/web_source/${router.currentRoute.value.params.agentId}`
location.href = channelUrl
}
function handleCopyShareLink() {
const channleUrl = `${INDEX_URLS[window.ENV || 'DEV']}share/web_source/${router.currentRoute.value.params.agentId}`
copyToClip(channleUrl)
const channelUrl = `${INDEX_URLS[ENV]}share/web_source/${router.currentRoute.value.params.agentId}`
copyToClip(channelUrl)
window.$message.success('链接复制成功,快分享给你的好友吧!')
}
</script>
......
......@@ -32,6 +32,7 @@ export default defineConfig(({ command, mode }) => {
preprocessorOptions: {
scss: {
additionalData: '@use "@/styles/index.scss" as *;',
api: 'modern-compiler',
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment