diff --git a/src/router/routes.ts b/src/router/routes.ts index 5154265..98cdaa8 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -15,6 +15,11 @@ export const routes = [ component: () => import('@/views/passport/login/index.vue'), meta: { title: '登录' } }, + { + path: '/token-login', + component: () => import('@/views/passport/loginToken/index.vue'), + meta: { title: 'token登录' } + }, // { // path: '/forget', // component: () => import('@/views/passport/forget/index.vue'), diff --git a/src/utils/common.ts b/src/utils/common.ts index 7756eaf..a49c7e9 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -97,7 +97,7 @@ export function openSpmUrl(path: string, d?: any, id = 0): void { // 跳转页面 url.value = `${domain}${path}${spm.value}${token.value}`; - console.log(url.value,'domain>>>>'); + console.log(url.value, 'domain>>>>'); window.open(`${url.value}`); } @@ -396,3 +396,23 @@ export const getPageTitle = () => { const { title } = meta; return title; }; + +/** + * 提取传参中的ID + * param 12334.html + * return 1234 + * @param index + */ +export const getIdBySpm = (index: number) => { + console.log('split', router.currentRoute.value.query.spm); + const split = String(router.currentRoute.value.query.spm).split('.'); + console.log(split); + return split[index]; +}; + +/** + * 提取传参中的token + */ +export const getTokenBySpm = () => { + return JSON.parse(router.currentRoute.value.query.token); +}; diff --git a/src/views/passport/loginToken/index.vue b/src/views/passport/loginToken/index.vue new file mode 100644 index 0000000..2ae6752 --- /dev/null +++ b/src/views/passport/loginToken/index.vue @@ -0,0 +1,16 @@ + + + +