fix: 购物车修改

This commit is contained in:
kaizheng(郑凯) 2025-02-22 21:34:45 +08:00
parent 10748f97f1
commit d8a77526d7
7 changed files with 57 additions and 65 deletions

View File

@ -4,6 +4,21 @@ window.config = {
VConsole: true, VConsole: true,
userIdList: [], userIdList: [],
shareEnv: "production", shareEnv: "production",
testReactionId: "21023", getCarProductLink: ({
testReactionUserId: "csht003", token,
refreshToken,
departmentId = 36,
eId = 0,
activityId,
}) => {
return `https://web.ceniu.sztg.com/setTokenAndRedirect.html?token=${encodeURIComponent(
token
)}&refreshToken=${encodeURIComponent(
refreshToken
)}&redirect=${encodeURIComponent(
`https://web.ceniu.sztg.com/#/index/shopping?departmentId=${departmentId}&eId=${eId}&activityId=${activityId}`
)}`;
}, // 购物车产品地址
mobileRegister:
"https://web.ceniu.sztg.com/#/login?pageType=mobileRegister&redirect=", // 用户注册地址
}; };

View File

@ -144,12 +144,6 @@ const routes = [
/* webpackChunkName: "about" */ "../views/ShotVideoPlay/index.vue" /* webpackChunkName: "about" */ "../views/ShotVideoPlay/index.vue"
), ),
}, },
{
path: "/test",
name: "test",
component: () =>
import(/* webpackChunkName: "about" */ "../views/test.vue"),
},
{ {
path: "/VideoList", path: "/VideoList",
name: "VideoList", name: "VideoList",
@ -193,7 +187,6 @@ router.beforeEach(async (to, from, next) => {
if (to.meta.noLogin || (to.path === "/page" && to.query.preview)) { if (to.meta.noLogin || (to.path === "/page" && to.query.preview)) {
return next(); return next();
} }
debugger;
console.log("store.state.token", store.state.token); console.log("store.state.token", store.state.token);
if (!store.state.token && !to.meta.noLogin) { if (!store.state.token && !to.meta.noLogin) {
next({ next({

View File

@ -37,9 +37,8 @@ service.interceptors.request.use(
// response 拦截器 // response 拦截器
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (response) => {
if ( if ([2000].includes(response.data.code)) {
[2007, 2000, 6007, 6014, 200, 2008, 2009].includes(response.data.code) // 需要重新登录的code
) {
// router.push(`/login?redirect=${router.currentRoute.value.fullPath}`); // router.push(`/login?redirect=${router.currentRoute.value.fullPath}`);
if (["App", "PcClient"].includes(terminalType)) { if (["App", "PcClient"].includes(terminalType)) {
showDialog({ showDialog({
@ -53,12 +52,7 @@ service.interceptors.response.use(
userLogin(); userLogin();
return response.data; return response.data;
} }
} else if ( } else {
response.data.code !== 0 &&
response.data.code !== 6013 &&
response.data.code !== 2010
) {
// code 2010 为禁止登陆
showToast(response.data.message); showToast(response.data.message);
} }
return response.data; return response.data;

View File

@ -18,6 +18,9 @@
<i v-else>{{ time }}S后重试</i> <i v-else>{{ time }}S后重试</i>
</div> --> </div> -->
<button @click="login" :disabled="disabled">登录</button> <button @click="login" :disabled="disabled">登录</button>
<div class="opt">
<span @click="toMobileRegister">去注册</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -30,6 +33,7 @@ import Nav from "@/components/NavBar.vue";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { showToast } from "vant"; import { showToast } from "vant";
import { getUserInfo } from "@/api/index"; import { getUserInfo } from "@/api/index";
import location from "sockjs-client/lib/location";
const store = useStore(); const store = useStore();
const route = useRoute(); const route = useRoute();
@ -69,6 +73,12 @@ const login = async () => {
} }
}; };
const toMobileRegister = () => {
location.href = `${window.config.mobileRegister}${encodeURIComponent(
location.href
)}`;
};
// const time = ref(59); // const time = ref(59);
// const getCode = async () => { // const getCode = async () => {
// showTime.value = true; // showTime.value = true;
@ -141,7 +151,7 @@ h2 {
} }
button { button {
display: block; display: block;
width: 686px; width: 100%;
padding: 24px 48px; padding: 24px 48px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -149,10 +159,19 @@ h2 {
background: #e83030; background: #e83030;
font-size: 32px; font-size: 32px;
color: #fff; color: #fff;
margin: 112px auto; margin: 112px auto 40px;
&:disabled { &:disabled {
opacity: 0.5; opacity: 0.5;
} }
} }
.opt {
display: flex;
justify-content: flex-end;
span {
font-size: 32px;
color: cornflowerblue;
cursor: pointer;
}
}
} }
</style> </style>

View File

@ -14,6 +14,7 @@
import { defineProps } from "vue"; import { defineProps } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { queryCartRead } from "@/api/video"; import { queryCartRead } from "@/api/video";
import { useStore } from "vuex";
const props = defineProps({ const props = defineProps({
item: { item: {
required: true, required: true,
@ -42,6 +43,7 @@ const props = defineProps({
}, },
}); });
const route = useRoute(); const route = useRoute();
const store = useStore();
const toDetail = async () => { const toDetail = async () => {
if (props.isShopCar) { if (props.isShopCar) {
await queryCartRead({ await queryCartRead({
@ -51,14 +53,19 @@ const toDetail = async () => {
saleUserId: route.query.saleUserId, saleUserId: route.query.saleUserId,
}); });
} }
if (props.item.productType === 111) { if (props.item.productType === 21) {
let bvideo = `${ // let bvideo = `${
props.item.url.indexOf("?") === -1 ? "?" : "&" // props.item.url.indexOf("?") === -1 ? "?" : "&"
}bvideo=videoId_${route.query.id},type_${props.type}`; // }bvideo=videoId_${route.query.id},type_${props.type}`;
if (route.query.saleUserId) { // if (route.query.saleUserId) {
bvideo = `${bvideo},saleUserId_${route.query.saleUserId}`; // bvideo = `${bvideo},saleUserId_${route.query.saleUserId}`;
} // }
location.href = `${props.item.url}${bvideo}`; // location.href = `${props.item.url}${bvideo}`;
location.href = window.config.getCarProductLink({
token: store.state.userInfo.token,
refreshToken: store.state.userInfo.refreshToken,
activityId: props.item.productId,
});
} else { } else {
if (props.liveProductId) { if (props.liveProductId) {
location.href = `${location.origin}/tgh5/viewpackageDetail/${ location.href = `${location.origin}/tgh5/viewpackageDetail/${

View File

@ -4,7 +4,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,

View File

@ -1,36 +0,0 @@
<template>
<div @click="clear">定时器暂停</div>
</template>
<script setup>
import { useStore } from "vuex";
import { liveMsgSend } from "@/api/video";
const store = useStore();
let msgIndex = 0;
let time;
if (
store.state.userInfo.userId === window.config.testReactionUserId &&
window.config.testReactionId
) {
console.log(time);
time = setInterval(() => {
msgIndex++;
if (msgIndex === 10000) clearInterval(time);
liveMsgSend({
from: window.config.testReactionUserId,
groupId: window.config.testReactionId,
text: "消息" + msgIndex,
type: 1,
}).catch(() => {
// errorBack && errorBack();
});
}, 20);
}
const clear = () => {
clearInterval(time);
};
</script>
<style scoped lang="scss"></style>