From 0bc8a2036cee001cd455ac4101ea3731903c2de7 Mon Sep 17 00:00:00 2001 From: wikiboss Date: Thu, 17 Sep 2026 16:13:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(commission):=20=E9=87=8D=E5=86=99=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=A9=AC=E8=B1=86=E9=A1=B5=E9=9D=A2=E4=B8=BA=E9=BB=91?= =?UTF-8?q?=E9=87=91=E9=AB=98=E7=AB=AF=E8=B5=84=E4=BA=A7=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E6=B1=87=E7=8E=87=E5=8D=87=E7=BA=A7=E4=B8=BA=E9=A9=AC?= =?UTF-8?q?=E5=B8=81=E5=B8=82=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/verify_madow_ui_upgrade_spec.js | 86 ++++ uniapp/pages/commission/madow.vue | 568 +++++++++++++++++++++----- 2 files changed, 553 insertions(+), 101 deletions(-) create mode 100644 tests/verify_madow_ui_upgrade_spec.js diff --git a/tests/verify_madow_ui_upgrade_spec.js b/tests/verify_madow_ui_upgrade_spec.js new file mode 100644 index 0000000..bfbfe23 --- /dev/null +++ b/tests/verify_madow_ui_upgrade_spec.js @@ -0,0 +1,86 @@ +const fs = require('fs'); +const path = require('path'); + +let passed = 0; +let failed = 0; + +function assert(condition, testName, detail = '') { + if (condition) { + console.log(` [PASS] ${testName}`); + passed++; + } else { + console.error(` [FAIL] ${testName} - ${detail}`); + failed++; + } +} + +console.log("========================================================"); +console.log(" 我的马豆页面高端重构与「马币市值」规范 TDD 自动化测试"); +console.log("========================================================\n"); + +const madowPagePath = path.resolve(__dirname, '../uniapp/pages/commission/madow.vue'); +assert(fs.existsSync(madowPagePath), 'madow.vue 页面文件存在'); + +const content = fs.readFileSync(madowPagePath, 'utf-8'); + +// 1. 文案升级契约:原“汇率”升级为“马币市值” +assert( + content.includes('马币市值'), + '页面包含核心文案「马币市值」' +); +assert( + !content.includes('当前汇率'), + '旧文案「当前汇率」已被完全替换移除' +); + +// 2. 资产卡片结构与指标展示 +assert( + content.includes('formatInt') && content.includes('state.info.madow'), + '卡片核心指标正确绑定持仓马豆且保留整数格式化 formatInt' +); +assert( + content.includes('state.info.madow_rate'), + '卡片正确展示马币市值单价 state.info.madow_rate' +); +assert( + content.includes('state.info.madow_value'), + '卡片正确展示折合市值/预估市值 state.info.madow_value' +); + +// 3. 高端交互与规则弹窗 +assert( + content.includes('su-popup') && (content.includes('showHelp') || content.includes('showRule')), + '规则说明升级为 su-popup 优雅弹窗结构' +); +assert( + content.includes('马币市值') && (content.includes('随全平台订单') || content.includes('增值') || content.includes('核算')), + '规则说明文字中涵盖马币市值与增值核算说明' +); + +// 4. 每日明细流水卡片与数据标签 +assert( + content.includes('v-for="') && content.includes('state.list'), + '每日明细流水正确遍历 state.list' +); +assert( + content.includes('user_count') && content.includes('gmv'), + '明细卡片保留当日参与人数与 GMV 展示' +); +assert( + content.includes('s-empty') && content.includes('uni-load-more'), + '保留优雅空状态 s-empty 与加载更多 uni-load-more' +); + +// 5. 数据交互方法 +assert( + content.includes('getMadow') && content.includes('onPullDownRefresh') && content.includes('onReachBottom'), + '包含完整的下拉刷新与触底分页加载逻辑' +); + +console.log("\n--------------------------------------------------------"); +console.log(`测试执行结果: 通过 ${passed} 项, 失败 ${failed} 项`); +console.log("========================================================\n"); + +if (failed > 0) { + process.exit(1); +} diff --git a/uniapp/pages/commission/madow.vue b/uniapp/pages/commission/madow.vue index 80b1b34..bc3fa90 100644 --- a/uniapp/pages/commission/madow.vue +++ b/uniapp/pages/commission/madow.vue @@ -1,50 +1,114 @@ @@ -61,8 +171,6 @@ import sheep from '@/sheep'; import _ from 'lodash'; - const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/wallet_card_bg.png'); - const state = reactive({ info: { madow: sheep.$store('user').userInfo?.madow || '0', @@ -134,100 +242,358 @@