diff --git a/src/router/index.ts b/src/router/index.ts index 5aea280..dee64d6 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -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 文件引入(禁用 vh,fixed 窗口相关样式) 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; diff --git a/src/views/templates/cmsCash/index.scss b/src/views/templates/cmsCash/index.scss index 7a7011a..4183e58 100644 --- a/src/views/templates/cmsCash/index.scss +++ b/src/views/templates/cmsCash/index.scss @@ -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; diff --git a/src/views/templates/cmsCash/index.vue b/src/views/templates/cmsCash/index.vue index 8dfbc2a..2caa4bb 100644 --- a/src/views/templates/cmsCash/index.vue +++ b/src/views/templates/cmsCash/index.vue @@ -4,7 +4,7 @@ @@ -54,7 +54,7 @@
diff --git a/src/views/templates/cmsDetail/config.ts b/src/views/templates/cmsDetail/config.ts index 9d44a1d..9071fdb 100644 --- a/src/views/templates/cmsDetail/config.ts +++ b/src/views/templates/cmsDetail/config.ts @@ -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, diff --git a/src/views/templates/cmsDetail/index.vue b/src/views/templates/cmsDetail/index.vue index e428bcd..19f3e0c 100644 --- a/src/views/templates/cmsDetail/index.vue +++ b/src/views/templates/cmsDetail/index.vue @@ -25,7 +25,7 @@
活动规则
活动规则