提交 c8199db5 authored 作者: lidongxu's avatar lidongxu

feat(login): 勤策 PC 端也跳转到链路中心_免登录实现

同上
上级 b74ff104
...@@ -20,7 +20,7 @@ import { download } from '@/utils/request' ...@@ -20,7 +20,7 @@ import { download } from '@/utils/request'
import SvgIcon from '@/components/SvgIcon' import SvgIcon from '@/components/SvgIcon'
import elementIcons from '@/components/SvgIcon/svgicon' import elementIcons from '@/components/SvgIcon/svgicon'
import { useDict } from '@/utils/dict' import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils' import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, isMobile } from '@/utils'
/****************** 移动端 ******************/ /****************** 移动端 ******************/
import registerMobile from "@/mobile/main.js" import registerMobile from "@/mobile/main.js"
...@@ -72,6 +72,7 @@ app.config.globalProperties.handleTree = handleTree ...@@ -72,6 +72,7 @@ app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.isMobile = isMobile
// 全局组件 // 全局组件
app.component('svg-icon', SvgIcon) app.component('svg-icon', SvgIcon)
......
...@@ -151,14 +151,16 @@ checkFsLoginAuth() ...@@ -151,14 +151,16 @@ checkFsLoginAuth()
// 检查-是否勤策回跳,并客户端登录 // 检查-是否勤策回跳,并客户端登录
const checkQcLoginAuth = async () => { const checkQcLoginAuth = async () => {
isShowLogin.value = false isShowLogin.value = false
// 勤策的 state 取值比较特殊 // 勤策 App 中移动端跳转 https://sfa-qa.wxl66.cn/link/#/m (会被路由拦截打回到登录页面,变成如下参数的格式)- 正确做法是跳转到登录页面(在登录页面判断当前设备是移动端则跳转到 /m 路由)但是频繁让人家改跳转地址不好,所以自己做判断吧
// ?redirect=/promotion?state=STATE&code=CODE 这个格式 // 移动端:?redirect=/m?state=STATE&code=CODE 这个格式
const url = window.location.href.split('?')[2] // PC 端:?state=STATE&code=CODE
const url = proxy.isMobile() ? window.location.href.split('?')[2] : window.location.href.split('?')[1]
if (url) { if (url) {
const params = new URLSearchParams(url); const params = new URLSearchParams(url);
const state = params.get('state'); const state = params.get('state');
if (state === 'STATE') { if (state === 'STATE') {
loginByType('qc', window.location.href.split('?')[2]) loginByType('qc', url)
} else { } else {
isShowLogin.value = true isShowLogin.value = true
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论