This commit is contained in:
unknown 2020-11-30 13:53:06 +08:00
parent 03d4d1ea15
commit 220f005bc7
3 changed files with 27 additions and 4 deletions

View File

@ -11,7 +11,7 @@
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import { getValue } from "./utils/common"; import { getValue, toindex } from "./utils/common";
import { provideI18n } from "@/utils/i18n"; import { provideI18n } from "@/utils/i18n";
import i18ninit from "@/i18n/init"; import i18ninit from "@/i18n/init";
import enUS from "ant-design-vue/es/locale/en_US"; import enUS from "ant-design-vue/es/locale/en_US";
@ -54,7 +54,7 @@ export default defineComponent({
console.log("ip"); console.log("ip");
store.dispatch("getip"); store.dispatch("getip");
store.commit("setWlan"); store.commit("setWlan");
router.push("/"); toindex()
} }
const zh = zhCN; const zh = zhCN;
const en = enUS; const en = enUS;

View File

@ -1,7 +1,7 @@
import router from '@/router'; import router from '@/router';
import store from '@/store'; import store from '@/store';
import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types'; 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 { message } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { del, get, post, put, setToken } from './base' import { del, get, post, put, setToken } from './base'
@ -47,7 +47,7 @@ export async function userinfo(){
// console.log(user.data.img) // console.log(user.data.img)
if(user.code == 1001){ if(user.code == 1001){
saveValue("token","") saveValue("token","")
router.push("/") toindex()
return '未登录'; return '未登录';
} }

View File

@ -1,3 +1,4 @@
import router from '@/router';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { geti18n } from './i18n'; import { geti18n } from './i18n';
@ -112,4 +113,26 @@ export function provenvideo(file: any, isvideo?: boolean): boolean{
} }
message.error(lan.$t("leixingcuowu")) message.error(lan.$t("leixingcuowu"))
return false; 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("/")
} }