fix: bug修复
This commit is contained in:
parent
3d0aebb025
commit
eca87cef25
@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build && sh ./build/deploy.sh",
|
"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"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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();
|
return next();
|
||||||
}
|
}
|
||||||
if (to.query.refreshToken) {
|
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", {
|
let ret = await store.dispatch("Login", {
|
||||||
token: to.query.redirectToken,
|
token: to.query.token,
|
||||||
refreshToken: to.query.redirectRefreshToken,
|
refreshToken: to.query.refreshToken,
|
||||||
});
|
});
|
||||||
if (ret && ret.code === 0) {
|
if (ret && ret.code === 0) {
|
||||||
delete to.query.redirectToken;
|
delete to.query.token;
|
||||||
delete to.query.redirectRefreshToken;
|
delete to.query.refreshToken;
|
||||||
return next({ path: to.path, query: to.query, replace: true });
|
return next({ path: to.path, query: to.query, replace: true });
|
||||||
} else {
|
} else {
|
||||||
userLogin();
|
userLogin();
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export async function userLogin() {
|
|||||||
const isWeixin = ua.indexOf("micromessenger") !== -1;
|
const isWeixin = ua.indexOf("micromessenger") !== -1;
|
||||||
console.log(isWeixin, terminalType);
|
console.log(isWeixin, terminalType);
|
||||||
// console.log("router", router);
|
// console.log("router", router);
|
||||||
location.href = `${window.config.loginUrl}?needWx=${
|
location.href = `${
|
||||||
isWeixin ? true : false
|
window.config.loginUrl
|
||||||
}&redirect=${encodeURIComponent(location.href)}`;
|
}?needWx=false&redirect=${encodeURIComponent(location.href)}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@ import { queryColumnDetail } from "@/api/column";
|
|||||||
import { liveColumn } from "@/api/column";
|
import { liveColumn } from "@/api/column";
|
||||||
import { showConfirmDialog } from "vant";
|
import { showConfirmDialog } from "vant";
|
||||||
import { showToast } from "vant";
|
import { showToast } from "vant";
|
||||||
|
import { userLogin } from "@/utils/login";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -77,7 +78,7 @@ getColumnDetail();
|
|||||||
|
|
||||||
const sendLiveColumn = async () => {
|
const sendLiveColumn = async () => {
|
||||||
if (!store.state.token) {
|
if (!store.state.token) {
|
||||||
return router.push(`/login?redirect=${route.fullPath}`);
|
return userLogin();
|
||||||
}
|
}
|
||||||
if (columnDetail.value.isSub === 1) {
|
if (columnDetail.value.isSub === 1) {
|
||||||
showConfirmDialog({
|
showConfirmDialog({
|
||||||
|
|||||||
@ -62,7 +62,6 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps, watch, defineEmits } from "vue";
|
import { ref, defineProps, watch, defineEmits } from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import { showToast } from "vant";
|
import { showToast } from "vant";
|
||||||
import BScroll from "@better-scroll/core";
|
import BScroll from "@better-scroll/core";
|
||||||
@ -74,13 +73,11 @@ import { likeVideo } from "@/api/video";
|
|||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj";
|
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj";
|
||||||
import ChatFrame from "./ChatFrame.vue";
|
import ChatFrame from "./ChatFrame.vue";
|
||||||
|
import { userLogin } from "@/utils/login";
|
||||||
const $liveStatusObj = useGetLiveStatusObj();
|
const $liveStatusObj = useGetLiveStatusObj();
|
||||||
|
|
||||||
BScroll.use(PullDown);
|
BScroll.use(PullDown);
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
detail: {
|
detail: {
|
||||||
// 视频详情
|
// 视频详情
|
||||||
@ -159,7 +156,7 @@ const sendMsg = (type, params = {}) => {
|
|||||||
|
|
||||||
function inputMsg() {
|
function inputMsg() {
|
||||||
if (!store.state.token) {
|
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 HScreen from "./HScreen.vue";
|
||||||
import SScreen from "./SScreen.vue";
|
import SScreen from "./SScreen.vue";
|
||||||
import NoLookTip from "@/components/NoLookTip.vue";
|
import NoLookTip from "@/components/NoLookTip.vue";
|
||||||
|
import { userLogin } from "@/utils/login";
|
||||||
// import { checkAuthIds } from "@/hooks/useHasAuth";
|
// import { checkAuthIds } from "@/hooks/useHasAuth";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -127,12 +128,7 @@ const getVideoDetail = async () => {
|
|||||||
} else if (ret.data.limitType === 5) {
|
} else if (ret.data.limitType === 5) {
|
||||||
getLiveLimit();
|
getLiveLimit();
|
||||||
} else if (ret.data.limitType === 2 && !store.state.token) {
|
} else if (ret.data.limitType === 2 && !store.state.token) {
|
||||||
router.push({
|
userLogin();
|
||||||
path: "/login",
|
|
||||||
query: {
|
|
||||||
redirect: route.fullPath,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
videoDetail.value = ret.data;
|
videoDetail.value = ret.data;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user