跳转
This commit is contained in:
parent
03d4d1ea15
commit
220f005bc7
@ -11,7 +11,7 @@
|
||||
import { defineComponent } from "vue";
|
||||
import router from "./router";
|
||||
import store from "./store";
|
||||
import { getValue } from "./utils/common";
|
||||
import { getValue, toindex } from "./utils/common";
|
||||
import { provideI18n } from "@/utils/i18n";
|
||||
import i18ninit from "@/i18n/init";
|
||||
import enUS from "ant-design-vue/es/locale/en_US";
|
||||
@ -54,7 +54,7 @@ export default defineComponent({
|
||||
console.log("ip");
|
||||
store.dispatch("getip");
|
||||
store.commit("setWlan");
|
||||
router.push("/");
|
||||
toindex()
|
||||
}
|
||||
const zh = zhCN;
|
||||
const en = enUS;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import router from '@/router';
|
||||
import store from '@/store';
|
||||
import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types';
|
||||
import { getValue, saveValue } from '@/utils/common';
|
||||
import { getValue, saveValue, toindex } from '@/utils/common';
|
||||
import { message } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { del, get, post, put, setToken } from './base'
|
||||
@ -47,7 +47,7 @@ export async function userinfo(){
|
||||
// console.log(user.data.img)
|
||||
if(user.code == 1001){
|
||||
saveValue("token","")
|
||||
router.push("/")
|
||||
toindex()
|
||||
|
||||
return '未登录';
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import router from '@/router';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { geti18n } from './i18n';
|
||||
|
||||
@ -112,4 +113,26 @@ export function provenvideo(file: any, isvideo?: boolean): boolean{
|
||||
}
|
||||
message.error(lan.$t("leixingcuowu"))
|
||||
return false;
|
||||
}
|
||||
export function toindex(){
|
||||
function GetUrlRelativePath() {
|
||||
const url = document.location.toString();
|
||||
const arrUrl = url.split("//");
|
||||
|
||||
const start = arrUrl[1].indexOf("/");
|
||||
let relUrl = arrUrl[1].substring(start); //stop省略,截取从start开始到结尾的所有字符
|
||||
|
||||
if (relUrl.indexOf("?") != -1) {
|
||||
relUrl = relUrl.split("?")[0];
|
||||
}
|
||||
return relUrl;
|
||||
}
|
||||
const url = GetUrlRelativePath()
|
||||
const list = ['/wblogin','/wbloginerr','/fblogin','/fbloginerr']
|
||||
for(let i in list){
|
||||
if(list[i] == url){
|
||||
return ;
|
||||
}
|
||||
}
|
||||
router.push("/")
|
||||
}
|
Loading…
Reference in New Issue
Block a user