fix: bug修复
This commit is contained in:
parent
3d0aebb025
commit
eca87cef25
@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build && sh ./build/deploy.sh",
|
||||
"build:pro": "vue-cli-service build && sh ./build/deploy_prod.sh",
|
||||
"build:pro": "sh ./build/deploy_prod.sh",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
34
setTokenAndRedirect.html
Normal file
34
setTokenAndRedirect.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function getUrlParams() {
|
||||
let url = "";
|
||||
let paramsObj = {};
|
||||
const queryString = window.location.search;
|
||||
const params = new URLSearchParams(queryString);
|
||||
for (const [key, value] of params.entries()) {
|
||||
if (key === "redirect") {
|
||||
url = value;
|
||||
} else {
|
||||
paramsObj[key] = value;
|
||||
}
|
||||
}
|
||||
for (const key in paramsObj) {
|
||||
if (url.includes("?")) {
|
||||
url += `&${key}=${paramsObj[key]}`;
|
||||
} else {
|
||||
url += `?${key}=${paramsObj[key]}`;
|
||||
}
|
||||
}
|
||||
location.replace(url);
|
||||
}
|
||||
getUrlParams();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -189,21 +189,13 @@ router.beforeEach(async (to, from, next) => {
|
||||
return next();
|
||||
}
|
||||
if (to.query.refreshToken) {
|
||||
location.replace(
|
||||
`${to.query.redirect}${
|
||||
to.query.redirect.includes("?") ? "&" : "?"
|
||||
}redirectToken=${to.query.token}&redirectRefreshToken=${
|
||||
to.query.refreshToken
|
||||
}`
|
||||
);
|
||||
} else if (to.query.redirectRefreshToken) {
|
||||
let ret = await store.dispatch("Login", {
|
||||
token: to.query.redirectToken,
|
||||
refreshToken: to.query.redirectRefreshToken,
|
||||
token: to.query.token,
|
||||
refreshToken: to.query.refreshToken,
|
||||
});
|
||||
if (ret && ret.code === 0) {
|
||||
delete to.query.redirectToken;
|
||||
delete to.query.redirectRefreshToken;
|
||||
delete to.query.token;
|
||||
delete to.query.refreshToken;
|
||||
return next({ path: to.path, query: to.query, replace: true });
|
||||
} else {
|
||||
userLogin();
|
||||
|
||||
@ -13,7 +13,7 @@ export async function userLogin() {
|
||||
const isWeixin = ua.indexOf("micromessenger") !== -1;
|
||||
console.log(isWeixin, terminalType);
|
||||
// console.log("router", router);
|
||||
location.href = `${window.config.loginUrl}?needWx=${
|
||||
isWeixin ? true : false
|
||||
}&redirect=${encodeURIComponent(location.href)}`;
|
||||
location.href = `${
|
||||
window.config.loginUrl
|
||||
}?needWx=false&redirect=${encodeURIComponent(location.href)}`;
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ import { queryColumnDetail } from "@/api/column";
|
||||
import { liveColumn } from "@/api/column";
|
||||
import { showConfirmDialog } from "vant";
|
||||
import { showToast } from "vant";
|
||||
import { userLogin } from "@/utils/login";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@ -77,7 +78,7 @@ getColumnDetail();
|
||||
|
||||
const sendLiveColumn = async () => {
|
||||
if (!store.state.token) {
|
||||
return router.push(`/login?redirect=${route.fullPath}`);
|
||||
return userLogin();
|
||||
}
|
||||
if (columnDetail.value.isSub === 1) {
|
||||
showConfirmDialog({
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, watch, defineEmits } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useStore } from "vuex";
|
||||
import { showToast } from "vant";
|
||||
import BScroll from "@better-scroll/core";
|
||||
@ -74,13 +73,11 @@ import { likeVideo } from "@/api/video";
|
||||
import emitter from "@/utils/emitter";
|
||||
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj";
|
||||
import ChatFrame from "./ChatFrame.vue";
|
||||
import { userLogin } from "@/utils/login";
|
||||
const $liveStatusObj = useGetLiveStatusObj();
|
||||
|
||||
BScroll.use(PullDown);
|
||||
const store = useStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const props = defineProps({
|
||||
detail: {
|
||||
// 视频详情
|
||||
@ -159,7 +156,7 @@ const sendMsg = (type, params = {}) => {
|
||||
|
||||
function inputMsg() {
|
||||
if (!store.state.token) {
|
||||
router.push(`/login?redirect=${route.fullPath}`);
|
||||
userLogin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ import emitter from "@/utils/emitter";
|
||||
import HScreen from "./HScreen.vue";
|
||||
import SScreen from "./SScreen.vue";
|
||||
import NoLookTip from "@/components/NoLookTip.vue";
|
||||
import { userLogin } from "@/utils/login";
|
||||
// import { checkAuthIds } from "@/hooks/useHasAuth";
|
||||
|
||||
const route = useRoute();
|
||||
@ -127,12 +128,7 @@ const getVideoDetail = async () => {
|
||||
} else if (ret.data.limitType === 5) {
|
||||
getLiveLimit();
|
||||
} else if (ret.data.limitType === 2 && !store.state.token) {
|
||||
router.push({
|
||||
path: "/login",
|
||||
query: {
|
||||
redirect: route.fullPath,
|
||||
},
|
||||
});
|
||||
userLogin();
|
||||
}
|
||||
videoDetail.value = ret.data;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user