webman迁移

This commit is contained in:
2026-03-18 11:22:12 +08:00
parent dab3b3148f
commit ea77c7b3a1
623 changed files with 38163 additions and 106 deletions

View File

@@ -56,35 +56,39 @@ const init = () => {
/**
* 后台初始化请求,获取站点配置,动态路由等信息
*/
index().then((res) => {
siteConfig.dataFill(res.data.siteConfig)
terminal.changePackageManager(res.data.terminal.npmPackageManager)
terminal.changePHPDevelopmentServer(res.data.terminal.phpDevelopmentServer)
siteConfig.setInitialize(true)
index()
.then((res) => {
siteConfig.dataFill(res.data.siteConfig)
terminal.changePackageManager(res.data.terminal.npmPackageManager)
terminal.changePHPDevelopmentServer(res.data.terminal.phpDevelopmentServer)
siteConfig.setInitialize(true)
if (!isEmpty(res.data.adminInfo)) {
adminInfo.dataFill(res.data.adminInfo)
siteConfig.setUserInitialize(true)
}
if (res.data.menus) {
handleAdminRoute(res.data.menus)
// 预跳转到上次路径
if (route.params.to) {
const lastRoute = JSON.parse(route.params.to as string)
if (lastRoute.path != adminBaseRoutePath) {
let query = !isEmpty(lastRoute.query) ? lastRoute.query : {}
routePush({ path: lastRoute.path, query: query })
return
}
if (!isEmpty(res.data.adminInfo)) {
adminInfo.dataFill(res.data.adminInfo)
siteConfig.setUserInitialize(true)
}
// 跳转到第一个菜单
let firstRoute = getFirstRoute(navTabs.state.tabsViewRoutes)
if (firstRoute) routePush(firstRoute.path)
}
})
if (res.data.menus) {
handleAdminRoute(res.data.menus)
// 预跳转到上次路径
if (route.params.to) {
const lastRoute = JSON.parse(route.params.to as string)
if (lastRoute.path != adminBaseRoutePath) {
let query = !isEmpty(lastRoute.query) ? lastRoute.query : {}
routePush({ path: lastRoute.path, query: query })
return
}
}
// 跳转到第一个菜单
let firstRoute = getFirstRoute(navTabs.state.tabsViewRoutes)
if (firstRoute) routePush(firstRoute.path)
}
})
.catch(() => {
// 303/401 等由 axios 拦截器处理跳转登录;其他错误由 loading 页 6 秒后显示重试按钮
})
}
const onAdaptiveLayout = () => {

View File

@@ -161,8 +161,17 @@ const onSubmit = (captchaInfo = '') => {
form.captchaInfo = captchaInfo
login('post', form)
.then((res) => {
adminInfo.dataFill(res.data.userInfo, false)
router.push({ path: adminBaseRoutePath })
const userInfo = res?.data?.userInfo
if (!userInfo?.token) {
return
}
adminInfo.dataFill(userInfo, false)
nextTick(() => {
router.push({ path: adminBaseRoutePath })
})
})
.catch(() => {
// 接口错误由 axios 拦截器处理
})
.finally(() => {
state.submitLoading = false