注册页面对接
This commit is contained in:
parent
d8a77526d7
commit
df854b12c5
@ -184,19 +184,33 @@ const router = createRouter({
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
if (to.meta.noLogin || (to.path === "/page" && to.query.preview)) {
|
if (
|
||||||
|
(to.path !== "/login" && to.meta.noLogin) ||
|
||||||
|
(to.path === "/page" && to.query.preview)
|
||||||
|
) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
console.log("store.state.token", store.state.token);
|
|
||||||
if (!store.state.token && !to.meta.noLogin) {
|
if (!store.state.token && !to.meta.noLogin) {
|
||||||
next({
|
if (to.query.refreshToken) {
|
||||||
path: "/login",
|
location.replace(
|
||||||
query: {
|
`${to.query.redirect}${
|
||||||
redirect: to.fullPath,
|
to.query.redirect.includes("?") ? "&" : "?"
|
||||||
},
|
}token=${to.query.token}&refreshToken=${to.query.refreshToken}`
|
||||||
});
|
);
|
||||||
|
} else {
|
||||||
|
next({
|
||||||
|
path: "/login",
|
||||||
|
query: {
|
||||||
|
redirect: to.fullPath,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
next();
|
if (to.path === "/login" && store.state.token) {
|
||||||
|
next("/");
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ service.interceptors.response.use(
|
|||||||
userLogin();
|
userLogin();
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (response.data.code !== 0) {
|
||||||
showToast(response.data.message);
|
showToast(response.data.message);
|
||||||
}
|
}
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|||||||
@ -44,7 +44,9 @@ const disabled = ref(true);
|
|||||||
const fromData = reactive({
|
const fromData = reactive({
|
||||||
userName: "",
|
userName: "",
|
||||||
password: "",
|
password: "",
|
||||||
loginType: 1,
|
token: route.query.token,
|
||||||
|
refreshToken: route.query.refreshToken,
|
||||||
|
loginType: route.query.refreshToken ? 2 : 1, // 1:账号密码登录 2:token登录
|
||||||
clientType: 1,
|
clientType: 1,
|
||||||
});
|
});
|
||||||
watch(fromData, (val) => {
|
watch(fromData, (val) => {
|
||||||
@ -57,10 +59,12 @@ watch(fromData, (val) => {
|
|||||||
|
|
||||||
// const reg = /^1[34578]\d{9}$/;
|
// const reg = /^1[34578]\d{9}$/;
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
if (!fromData.userName) {
|
if (fromData.loginType === 1) {
|
||||||
return showToast("请输入账号!");
|
if (!fromData.userName) {
|
||||||
} else if (!fromData.password) {
|
return showToast("请输入账号!");
|
||||||
return showToast("请输入密码!");
|
} else if (!fromData.password) {
|
||||||
|
return showToast("请输入密码!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let ret = await getUserInfo({ ...fromData });
|
let ret = await getUserInfo({ ...fromData });
|
||||||
if (ret.code === 0) {
|
if (ret.code === 0) {
|
||||||
@ -73,6 +77,10 @@ const login = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (route.query.refreshToken) {
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
|
||||||
const toMobileRegister = () => {
|
const toMobileRegister = () => {
|
||||||
location.href = `${window.config.mobileRegister}${encodeURIComponent(
|
location.href = `${window.config.mobileRegister}${encodeURIComponent(
|
||||||
location.href
|
location.href
|
||||||
|
|||||||
@ -63,10 +63,7 @@ import { querySerialDetail, querySerialContentDetail } from "@/api/serial";
|
|||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import useShieldConfig from "@/hooks/useShieldConfig";
|
import useShieldConfig from "@/hooks/useShieldConfig";
|
||||||
import NoLookTip from "@/components/NoLookTip.vue";
|
import NoLookTip from "@/components/NoLookTip.vue";
|
||||||
import emitter from "@/utils/emitter";
|
|
||||||
import { useStore } from "vuex";
|
|
||||||
|
|
||||||
const store = useStore();
|
|
||||||
const serial = ref({});
|
const serial = ref({});
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@ -97,26 +94,6 @@ const getSerialDetailFn = async () => {
|
|||||||
|
|
||||||
auth.value = authResultVo.auth;
|
auth.value = authResultVo.auth;
|
||||||
|
|
||||||
window.shareApi.initWxH5({
|
|
||||||
env: window.config.shareEnv,
|
|
||||||
shareusername: store.state.userInfo.userId,
|
|
||||||
title: serial.value.name,
|
|
||||||
summary: serial.value.remark,
|
|
||||||
linkurl: location.href,
|
|
||||||
img: serial.value.coverImage,
|
|
||||||
business: "wzfxgkd",
|
|
||||||
type: "wechat",
|
|
||||||
id: serial.value.id,
|
|
||||||
source: "40156",
|
|
||||||
authorname: serial.value.advisorName,
|
|
||||||
authornickname: "h5分享",
|
|
||||||
successFun: function (res) {
|
|
||||||
// option.url = res.shorturl;
|
|
||||||
// window.shareApi.init(option);
|
|
||||||
console.log("合集分享成功", res);
|
|
||||||
emitter.emit("onShareInform");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (authResultVo.auth) {
|
if (authResultVo.auth) {
|
||||||
if (authResultVo.riskUrl) {
|
if (authResultVo.riskUrl) {
|
||||||
showDialog({
|
showDialog({
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
<div v-for="(item, index) in cartVOList || []" :key="index">
|
<div v-for="(item, index) in cartVOList || []" :key="index">
|
||||||
<ProductItem
|
<ProductItem
|
||||||
class="mb20"
|
class="mb20"
|
||||||
v-if="item.productType === 111"
|
v-if="item.productType === 21"
|
||||||
:item="{
|
:item="{
|
||||||
productId: item.productId,
|
productId: item.productId,
|
||||||
name: item.productName,
|
name: item.productName,
|
||||||
|
|||||||
@ -135,26 +135,6 @@ const getVideoDetail = async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
videoDetail.value = ret.data;
|
videoDetail.value = ret.data;
|
||||||
window.shareApi.initWxH5({
|
|
||||||
env: window.config.shareEnv,
|
|
||||||
shareusername: store.state.userInfo.userId,
|
|
||||||
title: videoDetail.value.title,
|
|
||||||
summary: videoDetail.value.viewPoint,
|
|
||||||
linkurl: location.href,
|
|
||||||
img: videoDetail.value.imgUrl,
|
|
||||||
business: "wzfxgkd",
|
|
||||||
type: "wechat",
|
|
||||||
id: videoDetail.value.id,
|
|
||||||
source: "40156",
|
|
||||||
authorname: videoDetail.value.advisorBasic?.showName,
|
|
||||||
authornickname: "h5分享",
|
|
||||||
successFun: function (res) {
|
|
||||||
// option.url = res.shorturl;
|
|
||||||
// window.shareApi.init(option);
|
|
||||||
console.log("分享成功", res);
|
|
||||||
emitter.emit("onShareInform");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// let extRet = await queryVideoExt({
|
// let extRet = await queryVideoExt({
|
||||||
// videoId: route.query.id,
|
// videoId: route.query.id,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user