From ebfe1651751f964bf211c648ab15b67be6ebe29a Mon Sep 17 00:00:00 2001 From: huangzhen Date: Mon, 2 Sep 2024 18:28:27 +0800 Subject: [PATCH] =?UTF-8?q?update=20@c=E7=AB=AF=E6=8E=A5=E5=8F=A3=E8=81=94?= =?UTF-8?q?=E8=B0=83=EF=BC=8C=E5=AD=97=E6=AE=B5=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/webpack.base.js | 1 + src/{global.css => global.scss} | 7 ++ src/main.ts | 2 +- src/router/api.ts | 10 +-- src/router/index.ts | 75 ++-------------- src/views/home.vue | 110 +++++++++++++++++++++++ src/views/pages/comProduct/index.vue | 73 +++++++++++---- src/views/templates/cmsDetail/index.scss | 2 + src/views/templates/cmsDetail/index.ts | 2 +- src/views/templates/cmsDetail/index.vue | 31 +++++-- src/views/templates/cmsList/index.scss | 9 ++ src/views/templates/cmsList/index.ts | 2 +- src/views/templates/cmsList/index.vue | 32 +++++-- src/views/templates/cmsVoucher/index.vue | 4 +- src/views/transferError.vue | 24 ----- 15 files changed, 251 insertions(+), 133 deletions(-) rename src/{global.css => global.scss} (97%) create mode 100644 src/views/home.vue delete mode 100644 src/views/transferError.vue diff --git a/build/webpack.base.js b/build/webpack.base.js index 3105ecd..606553e 100644 --- a/build/webpack.base.js +++ b/build/webpack.base.js @@ -50,6 +50,7 @@ module.exports = { plugins: [ new VueLoaderPlugin(), // vue-loader 插件 new MiniCssExtractPlugin({ + ignoreOrder: true, // 解决css引入顺序不一导致冲突的警告问题 filename: 'css/[name].[contenthash].content.css', }), new HtmlWebpackPlugin({ diff --git a/src/global.css b/src/global.scss similarity index 97% rename from src/global.css rename to src/global.scss index cab8aec..501989d 100644 --- a/src/global.css +++ b/src/global.scss @@ -114,3 +114,10 @@ html { justify-content: center; } } + +// 按钮置灰 +.btnPlacingAshes { + background: #e8eaec !important; +} + + diff --git a/src/main.ts b/src/main.ts index 6d9dad9..67f4489 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import './scripts/flexible.js' -import './global.css' // 添加全局样式 +import './global.scss' // 添加全局样式 import App from './App.vue' import router from './router' diff --git a/src/router/api.ts b/src/router/api.ts index 15c035c..d0e4e58 100644 --- a/src/router/api.ts +++ b/src/router/api.ts @@ -5,14 +5,14 @@ export enum Api { LOGIN = "/v1/user/login", // 商品查询 QUERY = "/v1/goods/list/key", - // 商品详情 - DETAIL = "/v1/goods/detail", // 模板查询 GET_THEME = "/v1/theme", // 兑换 EXCHANGE = "/v1/order/exchange", // 商品详情查询 DETAIL_QUERY = "/v1/goods/detail", + // 订单状态查询 + ORDER_QUERY = "/v1/order/query", } @@ -20,10 +20,10 @@ export const LOGIN = (data?: any) => request.post(Api.LOGIN, data); export const QUERY = (data?: any) => request.get(Api.QUERY, data); -export const DETAIL = (data?: any) => request.get(Api.DETAIL, data); - export const GET_THEME = (data?: any) => request.get(Api.GET_THEME, data); export const EXCHANGE = (data?: any) => request.post(Api.EXCHANGE, data); -export const getGoodsDetail = (data?: any) => request.get(Api.DETAIL_QUERY, data); +export const DETAIL_QUERY = (data?: any) => request.get(Api.DETAIL_QUERY, data); + +export const ORDER_QUERY = (data?: any) => request.post(Api.ORDER_QUERY, data); diff --git a/src/router/index.ts b/src/router/index.ts index 363ad25..3b94955 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -3,21 +3,18 @@ import { createWebHashHistory, createWebHistory, } from "vue-router"; -import { LOGIN, QUERY } from "@/router/api"; // 公共路由 const routePublic = [ { - // 商品中转(空白页) - path: "/proTransfer", - name: "proTransfer", - component: () => ({}), + path: "/", + redirect: "/home" }, { - // 中转失败页 - path: "/transferError", - name: "transferError", - component: () => import("../views/transferError.vue"), + // 首页(中转处理逻辑) + path: "/home", + name: "home", + component: () => import("../views/home.vue"), }, ]; @@ -67,64 +64,4 @@ const router = createRouter({ routes, }); -router.beforeEach(async (to, from, next) => { - if (to.path === "/proTransfer") { - // 商品中转 - // console.log('---proTransfer-router.beforeEach---', to, from); - try { - const key = - to.query.key || "rPBVzOCs0FN4P7jNMqHo5IVfb0oaAyigbfNBmCKnavs="; - // const res = await LOGIN({ key: key }); // 请求 token - const res = { data: { Token: "" }, code: 200, message: "" }; // 请求 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 }); // 根据商品判断 跳转指定路由 - if (resList && resList.code === 200) { - localStorage.setItem("key", String(key)); - sessionStorage.removeItem("transferError_page_identify"); - if (resList.data.length !== 1) { - sessionStorage.setItem( - "transferProListData", - JSON.stringify(resList.data) - ); - return next({ - path: "/cmsList", - query: { key: key }, - }); // 商品列表 - } else { - const pro = resList.data[0]; - if (pro.goods.group_id) { - return next({ - path: "/comProduct", - query: { group_id: pro.goods.group_id }, - }); // 组合商品 - } else { - // todo 3 种商品的详情页 - } - } - } - } else { - showToast("登录失败"); - } - } else { - showToast(res?.message || '接口请求失败'); - } - next({ - path: "/transferError", - query: { redirect: to.fullPath }, - }); - } catch (error) { - next({ - path: "/transferError", - query: { redirect: to.fullPath }, - }); - } - } else { - next(); // 对于非匹配路由,直接放行 - } -}); - export default router; diff --git a/src/views/home.vue b/src/views/home.vue new file mode 100644 index 0000000..5739f84 --- /dev/null +++ b/src/views/home.vue @@ -0,0 +1,110 @@ + + + + + \ No newline at end of file diff --git a/src/views/pages/comProduct/index.vue b/src/views/pages/comProduct/index.vue index 88652dd..39aec5c 100644 --- a/src/views/pages/comProduct/index.vue +++ b/src/views/pages/comProduct/index.vue @@ -14,27 +14,32 @@

一键领取 >

@@ -49,6 +54,19 @@ + +

标题

+ + + + +
@@ -132,6 +150,9 @@ export default { btnImg: require('./img/btnImg3_3.png'), }], ]), + inputModalShow: false, + inputVal: '', + inputValAgain: '', } }, async created() { @@ -286,6 +307,10 @@ export default { position: relative; margin: 0 11px; border-radius: 4px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; .infoIcon { position: absolute; width: 35px; @@ -302,13 +327,16 @@ export default { line-height: 16px; } .amountInfo { - height: 26px; - font-family: D-DIN, D-DIN; - font-weight: 400; - font-size: 14px; - line-height: 26px; - margin-top: 7px; text-align: center; + span { + font-family: D-DIN, D-DIN; + font-weight: 400; + font-size: 14px; + width: 100%; + } + .bigMount { + font-size: 24px; + } } .amountTip { height: 12px; @@ -317,7 +345,7 @@ export default { font-size: 8px; color: #6F727A; line-height: 12px; - text-align: center; + margin-top: 2px; } } .listProImg { @@ -351,7 +379,7 @@ export default { } } .contentBtn { - width: 76px; + padding: 0 10px; height: 29px; border-radius: 15px; font-family: Source Han Sans, Source Han Sans; @@ -363,7 +391,7 @@ export default { margin-right: 8px; } .contentBtnDisable { - opacity: 0.8; + opacity: 0.5; } } } @@ -436,4 +464,13 @@ export default { } } } +.inputModal { + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + .inputModalContent { + margin-bottom: 20px; + } +} \ No newline at end of file diff --git a/src/views/templates/cmsDetail/index.scss b/src/views/templates/cmsDetail/index.scss index 69711c6..fe68969 100644 --- a/src/views/templates/cmsDetail/index.scss +++ b/src/views/templates/cmsDetail/index.scss @@ -16,6 +16,8 @@ height: 100%; } .detailCarousel { + width: 100%; + height: 373px; overflow: hidden; img { display: block; diff --git a/src/views/templates/cmsDetail/index.ts b/src/views/templates/cmsDetail/index.ts index d9e07f0..9ba6c68 100644 --- a/src/views/templates/cmsDetail/index.ts +++ b/src/views/templates/cmsDetail/index.ts @@ -1,5 +1,5 @@ // 仅在单独打包时候使用 -import '../../../global.css'; // 添加全局样式 +import '../../../global.scss'; // 添加全局样式 import cmsDetail from './index.vue'; export default cmsDetail; \ No newline at end of file diff --git a/src/views/templates/cmsDetail/index.vue b/src/views/templates/cmsDetail/index.vue index f8d708b..8155b89 100644 --- a/src/views/templates/cmsDetail/index.vue +++ b/src/views/templates/cmsDetail/index.vue @@ -18,7 +18,9 @@

-

立即兑换
+
+ {{ btnText || '立即兑换' }} +
@@ -40,7 +42,7 @@ - - \ No newline at end of file