批量优化
This commit is contained in:
1 parent
e3db229f41
commit
aa92ca40a2
79 files changed
+7495
-1104
No files matched your search
@@ -59,3 +59,57 @@ export function resolveBaseURL() {
|
||||
export function getBaseURL() {
|
||||
return resolveBaseURL()
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户 Web 端(管理后台)地址。
|
||||
*
|
||||
* 移动端作为 ERP/OA/CRM/CMS 的聚合入口,绝大多数业务功能仍在 Web 端实现,
|
||||
* 端上通过 webview 容器打开对应页面。Web 端已统一认证:首次打开会跳
|
||||
* /auth/login 登录页,在 webview 内登录一次后会话保持。
|
||||
*
|
||||
* 可用环境变量 VITE_WEB_CONSOLE_BASE 覆盖(本地联调指向开发域名)。
|
||||
*/
|
||||
export function getWebConsoleBase() {
|
||||
let base = ''
|
||||
try {
|
||||
base =
|
||||
(typeof import.meta !== 'undefined' &&
|
||||
import.meta.env &&
|
||||
import.meta.env.VITE_WEB_CONSOLE_BASE) ||
|
||||
''
|
||||
} catch (e) {
|
||||
base = ''
|
||||
}
|
||||
if (!base || base === 'undefined' || base === 'null') {
|
||||
base = 'https://back.yunzer.cn'
|
||||
}
|
||||
return String(base).replace(/\/$/, '')
|
||||
}
|
||||
|
||||
/**
|
||||
* 由菜单 path 拼出 Web 端深链。
|
||||
* Web 端是 hash 路由(createWebHashHistory),因此形如 https://back.yunzer.cn/#/apps/crm/clue
|
||||
*/
|
||||
export function resolveWebConsoleURL(path) {
|
||||
const p = String(path || '').trim()
|
||||
if (!p) return ''
|
||||
return `${getWebConsoleBase()}/#${p.startsWith('/') ? p : `/${p}`}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼出「移动端免登录」深链。
|
||||
*
|
||||
* Web 端只认自己 localStorage 里的令牌,移动端登录态传不过去,
|
||||
* 直接跳业务路径会再次弹出统一登录页。因此先跳 /app-login 兑换页,
|
||||
* 由它用票据换发 Web 端令牌后再回跳到 redirect 指定的业务页。
|
||||
*
|
||||
* @param {string} path 菜单 path,如 /apps/oa/dashboard
|
||||
* @param {string} ticket 一次性票据(由 /auth/app-ticket 签发)
|
||||
*/
|
||||
export function resolveWebSSOURL(path, ticket) {
|
||||
const p = String(path || '').trim()
|
||||
if (!p) return ''
|
||||
const target = p.startsWith('/') ? p : `/${p}`
|
||||
if (!ticket) return resolveWebConsoleURL(target)
|
||||
return `${getWebConsoleBase()}/#/app-login?ticket=${encodeURIComponent(ticket)}&redirect=${encodeURIComponent(target)}`
|
||||
}
|
||||
Reference in new issue
Block a user