From 0128a52a48e497aa4ed14e3acac69b48356a3a01 Mon Sep 17 00:00:00 2001 From: yxf15732625262 Date: Sat, 8 Feb 2025 17:19:00 +0800 Subject: [PATCH] Sat Feb 8 17:19:00 CST 2025 inscode --- package.json | 4 + src/App.vue | 4 +- src/components/VoucherNormal.vue | 73 ------ src/mockData/activeList.js | 2 +- src/router/index.js | 4 +- src/utils/constant.js | 6 - src/{components => views}/Home.vue | 3 +- src/views/VoucherNormal/assets/constant.js | 86 ++++++ src/views/VoucherNormal/assets/utils.js | 19 ++ .../components/StairNewUserBanner.vue | 244 ++++++++++++++++++ src/views/VoucherNormal/index.vue | 41 +++ 11 files changed, 399 insertions(+), 87 deletions(-) delete mode 100644 src/components/VoucherNormal.vue delete mode 100644 src/utils/constant.js rename src/{components => views}/Home.vue (79%) create mode 100644 src/views/VoucherNormal/assets/constant.js create mode 100644 src/views/VoucherNormal/assets/utils.js create mode 100644 src/views/VoucherNormal/components/StairNewUserBanner.vue create mode 100644 src/views/VoucherNormal/index.vue diff --git a/package.json b/package.json index 201994e..4f02b73 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,16 @@ }, "dependencies": { "guess": "^1.0.2", + "lodash-es": "^4.17.21", "vant": "^3.6.12", "vue": "^3.2.37", "vue-router": "^4.5.0" }, "devDependencies": { + "@types/lodash-es": "^4.17.12", "@vitejs/plugin-vue": "^3.0.1", + "less": "^4.2.2", + "less-loader": "^12.2.0", "vite": "^5.0.1" } } diff --git a/src/App.vue b/src/App.vue index 1bc1d9d..362b125 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,3 @@ - - diff --git a/src/mockData/activeList.js b/src/mockData/activeList.js index 1abfb09..820017d 100644 --- a/src/mockData/activeList.js +++ b/src/mockData/activeList.js @@ -24,7 +24,7 @@ export const activeArray = [ } ], bottomTitle: '请完成1单任务', - endTime: 1731467085000, + endTime: 1754952000000, staircaseTaskScheduleVOS: [ { taskType: 15, diff --git a/src/router/index.js b/src/router/index.js index f933d26..f6096da 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,6 +1,6 @@ import { createRouter, createWebHistory } from 'vue-router'; -import Home from '../components/Home.vue'; -import VoucherNormal from '../components/VoucherNormal.vue'; +import Home from '../views/Home.vue'; +import VoucherNormal from '../views/VoucherNormal/index.vue'; const routes = [ { diff --git a/src/utils/constant.js b/src/utils/constant.js deleted file mode 100644 index f233354..0000000 --- a/src/utils/constant.js +++ /dev/null @@ -1,6 +0,0 @@ -export const SCENE = { - // OLD: 0, // 暂时没用,本阶梯任务只涉及 新客与重逢场景 - // 区分新客与重逢场景(流失召回场景) - NEWUSER: 1, - REUNION: 2 - } \ No newline at end of file diff --git a/src/components/Home.vue b/src/views/Home.vue similarity index 79% rename from src/components/Home.vue rename to src/views/Home.vue index 87b0665..64efda7 100644 --- a/src/components/Home.vue +++ b/src/views/Home.vue @@ -3,5 +3,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/VoucherNormal/assets/constant.js b/src/views/VoucherNormal/assets/constant.js new file mode 100644 index 0000000..7964eb6 --- /dev/null +++ b/src/views/VoucherNormal/assets/constant.js @@ -0,0 +1,86 @@ +export const SCENE = { + NEWUSER: 1, + REUNION: 2 +} + +// 对应服务端 activityScene ,7货运 9快送 10全品类 +export const CATEGORY = { + PLATFORM: 10, + FREIGHT: 7, + EXPRESS: 9 +} + +// 任务状态 0-起点;1-未开始;2-待完成;3-已完成 +export const TASK_STATUS = { + ORIGIN: 0, + UNSTART: 1, + UNCOMPLETE: 2, + COMPLETED: 3 +} + +export const CARD_CATEGORY = { + COUPON: 612307, + RIGHT: 'right' +} + +// 前端用于渲染的 券/权益卡片状态 枚举 +export const CARD_STATUS = { + CANUSE: 'canuse', + USED: 'used', + // 未解锁或已失效或过期 + UNAVAILABLE: 'unavailable' +} + +// 服务端存储的 券/权益卡片状态 枚举 +export const CARD_STATUS_BACKEND = { + LOCKED: 0, + VALID: 1, + USED: 2, + NOT_VALID: 3, + EXPIRED: 4 +} + +export const BANNER_JSON = { + topBgs: { + [SCENE.NEWUSER]: 'https://dpubstatic.udache.com/static/dpubimg/0H6iMSXcp4FIoVEMEsZfb.webp', + [SCENE.REUNION]: 'https://dpubstatic.udache.com/static/dpubimg/0H6iMSXcp4FIoVEMEsZfb.webp' + }, + topTitle: { + [SCENE.NEWUSER]: { + [CATEGORY.PLATFORM]: '新人专享礼', + [CATEGORY.FREIGHT]: '送货新人专享礼', + [CATEGORY.EXPRESS]: '快送新人专享礼' + }, + [SCENE.REUNION]: { + [CATEGORY.PLATFORM]: '重逢回馈礼', + [CATEGORY.FREIGHT]: '送货重逢回馈礼', + [CATEGORY.EXPRESS]: '快送重逢回馈礼' + } + }, + flagBgs: { + [TASK_STATUS.UNSTART]: 'https://dpubstatic.udache.com/static/dpubimg/EuDAy81WZJLFIghJRIkn7.webp', + [TASK_STATUS.UNCOMPLETE]: 'https://dpubstatic.udache.com/static/dpubimg/EuDAy81WZJLFIghJRIkn7.webp', + [TASK_STATUS.COMPLETED]: 'https://dpubstatic.udache.com/static/dpubimg/vIq9M3c4GRnHO9VkJDW63.webp' + }, + card: { + statusImgs: { + [CARD_CATEGORY.COUPON]: { + [CARD_STATUS.CANUSE]: 'https://dpubstatic.udache.com/static/dpubimg/urWtipI5yJBI9T3pizKO1.webp', + [CARD_STATUS.USED]: 'https://dpubstatic.udache.com/static/dpubimg/urWtipI5yJBI9T3pizKO1.webp', + [CARD_STATUS.UNAVAILABLE]: 'https://dpubstatic.udache.com/static/dpubimg/CrZMNglK_Upwq4ckzc8Us.webp' + }, + [CARD_CATEGORY.RIGHT]: { + [CARD_STATUS.CANUSE]: 'https://dpubstatic.udache.com/static/dpubimg/i3HBM_GeLaSfQLjlIOM2T.webp', + [CARD_STATUS.USED]: 'https://dpubstatic.udache.com/static/dpubimg/i3HBM_GeLaSfQLjlIOM2T.webp', + [CARD_STATUS.UNAVAILABLE]: 'https://dpubstatic.udache.com/static/dpubimg/CrZMNglK_Upwq4ckzc8Us.webp' + } + }, + statusTexts: { + [CARD_STATUS_BACKEND.LOCKED]: '待解锁', + [CARD_STATUS_BACKEND.VALID]: '待使用', + [CARD_STATUS_BACKEND.USED]: '已使用', + [CARD_STATUS_BACKEND.NOT_VALID]: '已失效', + [CARD_STATUS_BACKEND.EXPIRED]: '已过期' + } + } +} diff --git a/src/views/VoucherNormal/assets/utils.js b/src/views/VoucherNormal/assets/utils.js new file mode 100644 index 0000000..4be4676 --- /dev/null +++ b/src/views/VoucherNormal/assets/utils.js @@ -0,0 +1,19 @@ +export const getTimes = (durationStr) => { + const duration = durationStr ? parseInt(durationStr, 10) : 0 + const seconds = duration % 60 + const totalMinutes = Math.floor(duration / 60) + const minutes = totalMinutes % 60 + const hours = Math.floor(totalMinutes / 60) + + const padS2 = (num) => String(num).padStart(2, '0') + let days = 0 + if (hours > 24 || (hours === 24 && (minutes > 0 || seconds > 0))) { + days = Math.floor(hours / 24) + } + return { + days: padS2(days), + hours: padS2(hours - days * 24), + minutes: padS2(minutes), + seconds: padS2(seconds) + } +} \ No newline at end of file diff --git a/src/views/VoucherNormal/components/StairNewUserBanner.vue b/src/views/VoucherNormal/components/StairNewUserBanner.vue new file mode 100644 index 0000000..6096354 --- /dev/null +++ b/src/views/VoucherNormal/components/StairNewUserBanner.vue @@ -0,0 +1,244 @@ + + + \ No newline at end of file diff --git a/src/views/VoucherNormal/index.vue b/src/views/VoucherNormal/index.vue new file mode 100644 index 0000000..6e80c90 --- /dev/null +++ b/src/views/VoucherNormal/index.vue @@ -0,0 +1,41 @@ + + + + + -- GitLab