注册页面对接

This commit is contained in:
kaizheng(郑凯) 2025-02-22 23:11:02 +08:00
parent d8a77526d7
commit df854b12c5
6 changed files with 38 additions and 59 deletions

View File

@ -184,19 +184,33 @@ const router = createRouter({
});
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();
}
console.log("store.state.token", store.state.token);
if (!store.state.token && !to.meta.noLogin) {
next({
path: "/login",
query: {
redirect: to.fullPath,
},
});
if (to.query.refreshToken) {
location.replace(
`${to.query.redirect}${
to.query.redirect.includes("?") ? "&" : "?"
}token=${to.query.token}&refreshToken=${to.query.refreshToken}`
);
} else {
next({
path: "/login",
query: {
redirect: to.fullPath,
},
});
}
} else {
next();
if (to.path === "/login" && store.state.token) {
next("/");
} else {
next();
}
}
});

View File

@ -52,7 +52,7 @@ service.interceptors.response.use(
userLogin();
return response.data;
}
} else {
} else if (response.data.code !== 0) {
showToast(response.data.message);
}
return response.data;

View File

@ -44,7 +44,9 @@ const disabled = ref(true);
const fromData = reactive({
userName: "",
password: "",
loginType: 1,
token: route.query.token,
refreshToken: route.query.refreshToken,
loginType: route.query.refreshToken ? 2 : 1, // 1 2token
clientType: 1,
});
watch(fromData, (val) => {
@ -57,10 +59,12 @@ watch(fromData, (val) => {
// const reg = /^1[34578]\d{9}$/;
const login = async () => {
if (!fromData.userName) {
return showToast("请输入账号!");
} else if (!fromData.password) {
return showToast("请输入密码!");
if (fromData.loginType === 1) {
if (!fromData.userName) {
return showToast("请输入账号!");
} else if (!fromData.password) {
return showToast("请输入密码!");
}
}
let ret = await getUserInfo({ ...fromData });
if (ret.code === 0) {
@ -73,6 +77,10 @@ const login = async () => {
}
};
if (route.query.refreshToken) {
login();
}
const toMobileRegister = () => {
location.href = `${window.config.mobileRegister}${encodeURIComponent(
location.href

View File

@ -63,10 +63,7 @@ import { querySerialDetail, querySerialContentDetail } from "@/api/serial";
import Container from "@/components/Container.vue";
import useShieldConfig from "@/hooks/useShieldConfig";
import NoLookTip from "@/components/NoLookTip.vue";
import emitter from "@/utils/emitter";
import { useStore } from "vuex";
const store = useStore();
const serial = ref({});
const list = ref([]);
const loading = ref(false);
@ -97,26 +94,6 @@ const getSerialDetailFn = async () => {
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.riskUrl) {
showDialog({

View File

@ -32,7 +32,7 @@
<div v-for="(item, index) in cartVOList || []" :key="index">
<ProductItem
class="mb20"
v-if="item.productType === 111"
v-if="item.productType === 21"
:item="{
productId: item.productId,
name: item.productName,

View File

@ -135,26 +135,6 @@ const getVideoDetail = async () => {
});
}
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({
// videoId: route.query.id,