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,
userIdList: [],
shareEnv: "production",
testReactionId: "21023",
testReactionUserId: "csht003",
getCarProductLink: ({
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"
),
},
{
path: "/test",
name: "test",
component: () =>
import(/* webpackChunkName: "about" */ "../views/test.vue"),
},
{
path: "/VideoList",
name: "VideoList",
@ -193,7 +187,6 @@ router.beforeEach(async (to, from, next) => {
if (to.meta.noLogin || (to.path === "/page" && to.query.preview)) {
return next();
}
debugger;
console.log("store.state.token", store.state.token);
if (!store.state.token && !to.meta.noLogin) {
next({

View File

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

View File

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

View File

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

View File

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

@ -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>