C端所有图片切换

This commit is contained in:
zhangguoping 2024-08-30 14:41:23 +08:00
parent 7a6c27ca33
commit 9be978fb97
9 changed files with 73 additions and 65 deletions

View File

@ -1,94 +1,102 @@
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import {
createRouter,
createWebHashHistory,
createWebHistory,
} from "vue-router";
import { LOGIN, QUERY } from "@/router/api";
// 公共路由
const routePublic = [
{
// 商品中转(空白页)
path: '/proTransfer',
name: 'proTransfer',
component: () => {}
path: "/proTransfer",
name: "proTransfer",
component: () => ({}),
},
{
// 中转失败页
path: '/transferError',
name: 'transferError',
component: () => import('../views/transferError.vue')
path: "/transferError",
name: "transferError",
component: () => import("../views/transferError.vue"),
},
];
// 模版路由 命名cmsXXX
// 需要:类组件开发、样式外部 index.scss 文件引入(禁用 vhfixed 窗口相关样式)
const routeTemplate = [
{
// 商品列表模版
path: '/cmsList',
name: 'cmsList',
component: () => import('@/views/templates/cmsList/index.vue')
path: "/cmsList",
name: "cmsList",
component: () => import("@/views/templates/cmsList/index.vue"),
},
{
// 商品详情模版
path: '/cmsDetail',
name: 'cmsDetail',
component: () => import('@/views/templates/cmsDetail/index.vue')
path: "/cmsDetail",
name: "cmsDetail",
component: () => import("@/views/templates/cmsDetail/index.vue"),
},
{
path: '/cmsCash',
name: 'cmsCash',
component: () => import('@/views/templates/cmsCash/index.vue')
path: "/cmsCash",
name: "cmsCash",
component: () => import("@/views/templates/cmsCash/index.vue"),
},
{
path: '/cmsVoucher',
name: 'cmsVoucher',
component: () => import('@/views/templates/cmsVoucher/index.vue')
}
path: "/cmsVoucher",
name: "cmsVoucher",
component: () => import("@/views/templates/cmsVoucher/index.vue"),
},
];
// H5 路由
const routePage = [
{
// 组合商品页
path: '/comProduct',
name: 'comProduct',
component: () => import('../views/pages/comProduct/index.vue')
path: "/comProduct",
name: "comProduct",
component: () => import("../views/pages/comProduct/index.vue"),
},
]
];
const routes= [ ...routePublic, ...routeTemplate, ...routePage ];
const routes = [...routePublic, ...routeTemplate, ...routePage];
const router = createRouter({
history: createWebHistory(),
routes
})
routes,
});
router.beforeEach(async (to, from, next) => {
if (to.path === '/proTransfer') { // 商品中转
if (to.path === "/proTransfer") {
// 商品中转
// console.log('---proTransfer-router.beforeEach---', to, from);
try {
const key = to.query.key || 'rPBVzOCs0FN4P7jNMqHo5IVfb0oaAyigbfNBmCKnavs=';
const key =
to.query.key || "rPBVzOCs0FN4P7jNMqHo5IVfb0oaAyigbfNBmCKnavs=";
const res = await LOGIN({ key: key }); // 请求 token
if (res && res.code === 200) {
res.data.Token =
"admingL_q2QjDlD_MdeU11q5ILoeLFEqhbGBtcEptfs-OHzI53vbrgX9GFCh-SB4fSJBGwgSTl.uDPUoyiPjJ2O6e7zUBzExUUXhsdnPxtyLwncYc8.vy9ikZRp-wUba2POZJlTERJxnLbK6DzpQFQTxuYfcNM_yl3Avo7hgCjkS-ot5QgzNiO5TE";
if (res.data.Token) {
localStorage.setItem('token', res.data.Token);
const resList = await QUERY({ key: key }) // 根据商品判断 跳转指定路由
localStorage.setItem("token", res.data.Token);
const resList = await QUERY({ key: key }); // 根据商品判断 跳转指定路由
if (resList && resList.code === 200) {
localStorage.setItem('key', String(key));
sessionStorage.removeItem('transferError_page_identify');
localStorage.setItem("key", String(key));
sessionStorage.removeItem("transferError_page_identify");
if (resList.data.length !== 1) {
sessionStorage.setItem('transferProListData', JSON.stringify(resList.data));
sessionStorage.setItem(
"transferProListData",
JSON.stringify(resList.data)
);
return next({
path: '/cmsList',
query: { key: key }
path: "/cmsList",
query: { key: key },
}); // 商品列表
} else {
const pro = resList.data[0]
const pro = resList.data[0];
if (pro.goods.group_id) {
return next({
path: '/comProduct',
query: { group_id: pro.goods.group_id }
path: "/comProduct",
query: { group_id: pro.goods.group_id },
}); // 组合商品
} else {
// todo 3 种商品的详情页
@ -96,24 +104,24 @@ router.beforeEach(async (to, from, next) => {
}
}
} else {
showToast('登录失败');
showToast("登录失败");
}
} else {
showToast(res.message);
}
next({
path: '/transferError',
query: { redirect: to.fullPath }
path: "/transferError",
query: { redirect: to.fullPath },
});
} catch (error) {
next({
path: '/transferError',
query: { redirect: to.fullPath }
path: "/transferError",
query: { redirect: to.fullPath },
});
}
} else {
next(); // 对于非匹配路由,直接放行
}
})
});
export default router;

View File

@ -25,7 +25,7 @@
flex-direction: column;
width: 100%;
height: 100%;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/redPacktes/common_img_main_1.png") no-repeat;
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/common_img_main_1.png") no-repeat;
background-size: 100%;
}
@ -52,7 +52,7 @@
#redPacketsViews .bt {
width: 200px;
height: 46px;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/but_back_img.png");
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/but_back_img.png");
background-size: 100% 100%;
margin: 0 auto;
margin-top: 100px;
@ -127,14 +127,14 @@
#redPacketsViews .instruction-header {
width: 100%;
height: 43px;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/redPacktes/common_img_header.png") no-repeat;
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/common_img_header.png") no-repeat;
background-size: 100%;
margin-bottom: -3px;
}
#redPacketsViews .instruction {
width: 100%;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/redPacktes/common_img_text.png") no-repeat;
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/common_img_text.png") no-repeat;
min-height: 450px;
background-size: 100% 100%;
font-size: 11px;

View File

@ -4,7 +4,7 @@
<img
@click="backGoodsFn"
class="backIcon"
src="https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/backprepageBtn.png"
src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png"
alt=""
/>
@ -54,7 +54,7 @@
<p class="center">
<img
class="notice"
src="https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/redPacktes/common_title_notice.png"
src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/common_title_notice.png"
alt=""
/>
</p>

View File

@ -42,7 +42,7 @@ export default [
url: "#",
listType: "picture-card",
dragFlag: true,
ossPath: "image",
ossPath: "image/front",
fileType: ".png,.jpg,.jpeg",
fieldName: "bottomImg",
removeFunc: true,

View File

@ -25,7 +25,7 @@
<div v-if="cssData.activityDescType === 3 && cssData.floatText" class="description-3" v-html="cssData.floatText" />
<div v-if="popComStatus" class="popWrapper">
<img @click="changePopComStatus" class="backImg" src="https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img @click="changePopComStatus" class="backImg" src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png" alt="">
<p class="title">活动规则</p>
<div v-if="cssData.floatText" class="description-2" v-html="cssData.floatText"></div>
</div>
@ -62,11 +62,11 @@ export default {
activityDescType: 1, //1 2 3
bottomImg: [] as Array<any>,
floatImg: 'https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/acticeTextTip.png',
floatImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/acticeTextTip.png',
floatText: '',
//
carouselImg: 'https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/detailtop.png',
carouselImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/detailtop.png',
defaultList: ['', ''],
defaultListImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/uploads/2024-08-22/91D7DF7C-663C-4379-9BE1-E911B53D0801.png',
},

View File

@ -63,7 +63,7 @@ export default [
listType: "picture-card",
dragFlag: true,
fileSize: 10,
ossPath: "image",
ossPath: "image/front",
fileType: ".png,.jpg,.jpeg",
fieldName: "bannerTop",
removeFunc: true,
@ -109,7 +109,7 @@ export default [
listType: "picture-card",
dragFlag: true,
fileSize: 10,
ossPath: "image",
ossPath: "image/front",
fileType: ".png,.jpg,.jpeg",
fieldName: "bottomImg",
removeFunc: true,

View File

@ -35,7 +35,7 @@
<div v-if="cssData.activityDescType === 3 && cssData.floatText" class="description-3" v-html="cssData.floatText" />
<div v-if="popComStatus" class="popWrapper">
<img @click="changePopComStatus" class="backImg" src="https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt="">
<img @click="changePopComStatus" class="backImg" src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png" alt="">
<p class="title">活动规则</p>
<div v-if="cssData.floatText" class="description-2" v-html="cssData.floatText"></div>
</div>
@ -97,16 +97,16 @@ export default {
pageData: null,
cssData: {
bannerUrl: '',
bannerTop: [{ name: '', url: 'https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/goodstop.png'}],
bannerTop: [{ name: '', url: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/goodstop.png'}],
btnColor: 'rgb(255, 255, 255)',
btnBgc: 'rgb(250, 205, 106)',
contentType: 1, // 1 2 3
activityDescType: 1, //1 2 3
bottomImg: [] as Array<any>,
floatImg: 'https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/acticeTextTip.png',
floatImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/acticeTextTip.png',
floatText: '',
carouselImg: 'https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/swiper.png',
carouselImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/swiper.png',
defaultList: [1, 2, 3, 4, 5],
defaultListImg: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/uploads/2024-08-20/A89BB503-00DC-456e-B757-CA04ADFA9C06.png',
defaultMatrix: [1, 2, 3, 4, 5, 6],

View File

@ -28,7 +28,7 @@
min-height: 90px;
display: flex;
justify-content: space-between;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/reduce/coupon.png");
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/coupon.png");
background-size: 100% 100%;
}
@ -115,7 +115,7 @@
#reduce .receiveBtn {
width: 178px;
height: 46px;
background: url("https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/reduce/btnbg.png") no-repeat 100% 100% / cover;
background: url("https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/btnbg.png") no-repeat 100% 100% / cover;
display: flex;
justify-content: center;
align-items: center;

View File

@ -51,7 +51,7 @@
@click="backgoodsFn"
v-if="backAble"
class="backIcon"
src="https://lsxdemall.oss-cn-chengdu.aliyuncs.com/MarketingSystem/img/backprepageBtn.png"
src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png"
alt=""
/>
</span>