提交 8de81e57 authored 作者: lidongxu's avatar lidongxu

fix(login): 修复:保存积木回跳地址问题

上级 e27b4745
...@@ -61,7 +61,7 @@ router.beforeEach((to, from, next) => { ...@@ -61,7 +61,7 @@ router.beforeEach((to, from, next) => {
if (isWhiteList(to.path)) { if (isWhiteList(to.path)) {
next() next()
} else { } else {
cache.set('redirect_uri', to.fullPath) cache.session.set('redirect_uri', to.fullPath)
next(`/login?redirect=${to.fullPath}`) next(`/login?redirect=${to.fullPath}`)
NProgress.done() NProgress.done()
} }
......
...@@ -17,7 +17,7 @@ export function getQueryString(name) { ...@@ -17,7 +17,7 @@ export function getQueryString(name) {
* @param {string} url * @param {string} url
* @returns {Object} * @returns {Object}
*/ */
export function param2Obj(url) { export function param2Obj(url = '?') {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) { if (!search) {
return {} return {}
......
...@@ -164,9 +164,9 @@ async function loginByType(type, data) { ...@@ -164,9 +164,9 @@ async function loginByType(type, data) {
const state = getQueryString('state') const state = getQueryString('state')
// 飞书回跳 // 飞书回跳
if (state.includes('fs')) { if (state.includes('fs')) {
const redirectUri = cache.get('redirect_uri') // 未遂地址 const redirectUri = cache.session.get('redirect_uri') // 未遂地址
if (redirectUri) { if (redirectUri) {
cache.remove('redirect_uri') cache.session.remove('redirect_uri')
router.push({ path: redirectUri || "/", query: param2Obj(redirect.value) }); router.push({ path: redirectUri || "/", query: param2Obj(redirect.value) });
} else { } else {
router.push({ path: "/" }); // 正常飞书客户端里登录 router.push({ path: "/" }); // 正常飞书客户端里登录
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论