修复网站导航链接
This commit is contained in:
+7
-10
@@ -10,7 +10,7 @@ import { ChatMessage } from '@/api/system/chat/model';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import CryptoJS from 'crypto-js';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getSiteDomain, getTenantId } from '@/utils/domain';
|
||||
import { getSiteDomain } from '@/utils/domain';
|
||||
import { uuid } from 'ele-admin-pro';
|
||||
|
||||
type Events = {
|
||||
@@ -73,24 +73,18 @@ export function openSpmUrl(path: string, d?: any, id = 0): void {
|
||||
const spm = ref<string>('');
|
||||
const token = ref<string>();
|
||||
const url = ref<string>();
|
||||
const tid = getTenantId() || 0;
|
||||
const tid = d?.tenantId || 0;
|
||||
const pid = d?.parentId || 0;
|
||||
const cid = d?.categoryId || 0;
|
||||
const uid = localStorage.getItem('UserId') || 0;
|
||||
const timestamp = ref(Date.now() / 1000);
|
||||
token.value = `&token=${uuid()}`;
|
||||
|
||||
// TODO 不传data
|
||||
// if (!d) {
|
||||
// window.open(`${domain}${path}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// TODO 封装租户ID和店铺ID
|
||||
spm.value = `?spm=c.${uid}.${tid}.${pid}.${cid}.${id}.${timestamp.value}`;
|
||||
|
||||
// TODO 含http直接跳转
|
||||
if (path.slice(0, 4) == 'http') {
|
||||
if (path.startsWith('http')) {
|
||||
window.open(`${path}${spm.value}`);
|
||||
return;
|
||||
}
|
||||
@@ -413,5 +407,8 @@ export const getIdBySpm = (index: number) => {
|
||||
* 提取传参中的token
|
||||
*/
|
||||
export const getTokenBySpm = () => {
|
||||
return JSON.parse(router.currentRoute.value.query.token);
|
||||
const token = router.currentRoute.value.query.token;
|
||||
if (token) {
|
||||
return JSON.parse(`${token}`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user