From 6137c69034fb5dfbc479f2b65aab39b92c864b86 Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Thu, 21 May 2026 12:00:38 +0800 Subject: [PATCH] f --- pages.config.js | 8 +- src/config/toolboxRegistry.js | 74 ++- src/pages.json | 20 +- src/pages/index.vue | 874 ++++++++++++++------------- src/pages/inquire/index.vue | 115 ++-- src/pages/inquire/list.vue | 190 ++++++ src/pages/mine.vue | 840 +++++++++++++------------ src/pages/toolbox/category.vue | 418 +++++++++++-- src/pages/toolbox/index.vue | 431 +++++++++---- src/pages/toolbox/query.vue | 143 ++++- src/static/tabbar/toolbox-active.png | Bin 0 -> 468 bytes src/static/tabbar/toolbox.png | Bin 0 -> 464 bytes uni-pages.d.ts | 3 +- 13 files changed, 2080 insertions(+), 1036 deletions(-) create mode 100644 src/pages/inquire/list.vue create mode 100644 src/static/tabbar/toolbox-active.png create mode 100644 src/static/tabbar/toolbox.png diff --git a/pages.config.js b/pages.config.js index c36673a..b70c6de 100644 --- a/pages.config.js +++ b/pages.config.js @@ -26,10 +26,10 @@ export default defineUniPages({ selectedIconPath: 'static/tabbar/home-active.png', }, { - pagePath: 'pages/report', - text: '报告', - iconPath: 'static/tabbar/report.png', - selectedIconPath: 'static/tabbar/report-active.png', + pagePath: 'pages/toolbox/index', + text: '工具', + iconPath: 'static/tabbar/toolbox.png', + selectedIconPath: 'static/tabbar/toolbox-active.png', }, { pagePath: 'pages/mine', diff --git a/src/config/toolboxRegistry.js b/src/config/toolboxRegistry.js index 03bdb40..1b48bcb 100644 --- a/src/config/toolboxRegistry.js +++ b/src/config/toolboxRegistry.js @@ -1087,6 +1087,63 @@ export const toolboxItems = [ index: '热度', }, }, + { + key: 'star', + name: '星座运势', + desc: '查询十二星座今日运势(娱乐)', + icon: 'i-carbon-star', + fields: [ + { key: 'astro', label: '星座', type: 'select', mode: 'selector', options: [ + { label: '白羊座', value: '白羊座' }, + { label: '金牛座', value: '金牛座' }, + { label: '双子座', value: '双子座' }, + { label: '巨蟹座', value: '巨蟹座' }, + { label: '狮子座', value: '狮子座' }, + { label: '处女座', value: '处女座' }, + { label: '天秤座', value: '天秤座' }, + { label: '天蝎座', value: '天蝎座' }, + { label: '射手座', value: '射手座' }, + { label: '摩羯座', value: '摩羯座' }, + { label: '水瓶座', value: '水瓶座' }, + { label: '双鱼座', value: '双鱼座' }, + ], placeholder: '请选择星座' }, + ], + validate: (form) => (form.astro || '').length > 0, + validateMsg: '请选择星座', + resultType: 'list', + resultLabels: { + type: '运势类型', + content: '运势内容', + }, + }, + { + key: 'tianqishiju', + name: '天气诗句', + desc: '根据天气类型随机返回经典诗句', + icon: 'i-carbon-cloud', + fields: [ + { key: 'tqtype', label: '天气类型', type: 'select', mode: 'selector', options: [ + { label: '风', value: 1 }, + { label: '云', value: 2 }, + { label: '雨', value: 3 }, + { label: '雪', value: 4 }, + { label: '霜', value: 5 }, + { label: '露', value: 6 }, + { label: '雾', value: 7 }, + { label: '雷', value: 8 }, + { label: '晴', value: 9 }, + { label: '阴', value: 10 }, + ], placeholder: '可选,选择天气类型' }, + ], + validate: () => true, + validateMsg: '', + resultLabels: { + content: '诗句', + author: '作者', + source: '出处', + weather: '天气', + }, + }, { key: 'verse', name: '诗词名句', @@ -1457,7 +1514,9 @@ export const toolboxItems = [ resultLabels: { name: '名称', type_name: '分类', - explain: '说明', + explain: '分类说明', + contain: '包含类型', + tip: '投放提示', }, }, { @@ -2214,17 +2273,19 @@ export const toolboxItems = [ }, { key: 'anslajifenlei', - name: '按师垃圾分类', - desc: '按垃圾分类指南', + name: '垃圾分类问答', + desc: '随机出现一个物品,选出它属于哪种垃圾分类,考考你的环保知识', icon: 'i-carbon-recycle', autoQuery: true, + isGame: true, fields: [], validate: () => true, validateMsg: '', - resultType: 'list', resultLabels: { - name: '名称', - type_name: '分类', + name: { label: '物品名称' }, + type: { label: '正确分类', hidden: true }, + type_name: { label: '分类名称', hidden: true }, + explain: { label: '分类说明', hidden: true }, }, }, { @@ -2268,6 +2329,7 @@ export const toolboxItems = [ content: '问候语', }, }, + { key: 'story', name: '故事大全', diff --git a/src/pages.json b/src/pages.json index c93e317..0955eac 100644 --- a/src/pages.json +++ b/src/pages.json @@ -74,6 +74,16 @@ "navigationBarTextStyle": "black" } }, + { + "path": "pages/inquire/list", + "type": "page", + "style": { + "navigationBarTitleText": "车辆查询服务", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" + } + }, { "path": "pages/legal/authorization", "type": "page", @@ -128,7 +138,7 @@ "path": "pages/toolbox/index", "type": "page", "style": { - "navigationBarTitleText": "实用工具", + "navigationBarTitleText": "工具分类", "navigationStyle": "default", "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black" @@ -161,10 +171,10 @@ "selectedIconPath": "static/tabbar/home-active.png" }, { - "pagePath": "pages/report", - "text": "报告", - "iconPath": "static/tabbar/report.png", - "selectedIconPath": "static/tabbar/report-active.png" + "pagePath": "pages/toolbox/index", + "text": "工具", + "iconPath": "static/tabbar/toolbox.png", + "selectedIconPath": "static/tabbar/toolbox-active.png" }, { "pagePath": "pages/mine", diff --git a/src/pages/index.vue b/src/pages/index.vue index e0a7daf..ff48e54 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -1,7 +1,7 @@ + \ No newline at end of file diff --git a/src/pages/inquire/index.vue b/src/pages/inquire/index.vue index 5033501..33ace92 100644 --- a/src/pages/inquire/index.vue +++ b/src/pages/inquire/index.vue @@ -1,4 +1,4 @@ - + + + + diff --git a/src/pages/mine.vue b/src/pages/mine.vue index f71ce3e..d50dbea 100644 --- a/src/pages/mine.vue +++ b/src/pages/mine.vue @@ -329,120 +329,160 @@ onUnmounted(() => { - @@ -531,7 +571,7 @@ onUnmounted(() => { height: 100vh; display: flex; flex-direction: column; - background: linear-gradient(180deg, #f8faff 0%, #f3f5fb 100%); + background: linear-gradient(180deg, #f0f5ff 0%, #f5f7fa 30%, #f3f5fb 100%); } .scrollarea { @@ -541,143 +581,355 @@ onUnmounted(() => { } .page { - padding: 24rpx 24rpx 40rpx; + padding: 0 24rpx 40rpx; box-sizing: border-box; } -.banner { - display: flex; - padding: 32rpx 28rpx; +/* ═══ 区块1: 个人信息栏 ═══ */ +.profile-card { + position: relative; + border-radius: 0 0 32rpx 32rpx; + overflow: hidden; margin-bottom: 24rpx; - background: linear-gradient(135deg, #fff7f0 0%, #ffffff 100%); - border-radius: 24rpx; - box-shadow: - 0 18rpx 40rpx rgba(15, 35, 52, 0.05), - 0 0 0 1rpx rgba(226, 229, 239, 0.9); } -.banner-text { - flex: 1; +.profile-bg { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: linear-gradient(135deg, #1768ff 0%, #4d94ff 60%, #7bb8ff 100%); } -.banner-title { - font-size: 32rpx; - font-weight: 600; - color: #1d2129; - margin-bottom: 8rpx; -} - -.banner-sub { - font-size: 24rpx; - color: #4e5969; -} - -.banner-illustration { - width: 180rpx; +.profile-content { + position: relative; display: flex; align-items: center; - justify-content: center; + padding: 48rpx 32rpx 32rpx; + gap: 20rpx; } -.car-illus { - width: 160rpx; - height: 120rpx; - border-radius: 16rpx; - background: linear-gradient(145deg, #ffe8dc 0%, #ffc9a8 100%); - opacity: 0.95; -} - -.card { - background: linear-gradient(145deg, #ffffff 0%, #f7f8ff 100%); - border-radius: 24rpx; - padding: 24rpx 24rpx 20rpx; - margin-bottom: 24rpx; - border: 1rpx solid #e5e6f0; - box-shadow: - 0 16rpx 40rpx rgba(15, 35, 52, 0.04), - 0 0 0 1rpx rgba(255, 255, 255, 0.5) inset; -} - -.mine-user { - display: flex; - flex-direction: column; - align-items: stretch; -} - -.mine-user-main { - display: flex; - align-items: center; -} - -.mine-avatar-placeholder { - width: 80rpx; - height: 80rpx; - border-radius: 50%; - background-color: #f2f3f5; - margin-right: 20rpx; +.profile-avatar { flex-shrink: 0; } -.mine-user-text { +.avatar-inner { + width: 96rpx; + height: 96rpx; + border-radius: 50%; + background: rgba(255, 255, 255, 0.2); + display: flex; + align-items: center; + justify-content: center; + border: 3rpx solid rgba(255, 255, 255, 0.4); +} + +.avatar-icon { + font-size: 44rpx; + color: #fff; +} + +.profile-info { flex: 1; min-width: 0; } -.mine-user-name { +.profile-name { + display: block; + font-size: 32rpx; + font-weight: 600; + color: #fff; + margin-bottom: 6rpx; +} + +.profile-desc { + display: block; + font-size: 22rpx; + color: rgba(255, 255, 255, 0.8); +} + +.profile-arrow { + flex-shrink: 0; + color: rgba(255, 255, 255, 0.6); font-size: 28rpx; +} + +.profile-actions { + position: relative; + display: flex; + gap: 24rpx; + padding: 0 32rpx 28rpx; +} + +.action-btn { + display: flex; + align-items: center; + gap: 8rpx; + padding: 10rpx 24rpx; + border-radius: 24rpx; + background: rgba(255, 255, 255, 0.18); +} + +.action-icon { + font-size: 24rpx; + color: #fff; +} + +.action-text { + font-size: 22rpx; + color: #fff; +} + +/* ═══ 区块通用 ═══ */ +.section { + background: #fff; + border-radius: 24rpx; + padding: 28rpx 24rpx 8rpx; + margin-bottom: 24rpx; + box-shadow: 0 4rpx 16rpx rgba(15, 35, 52, 0.03); +} + +.section-title { + font-size: 26rpx; + font-weight: 600; color: #1d2129; - margin-bottom: 4rpx; + margin-bottom: 20rpx; + padding-left: 4rpx; } -.mine-user-desc { - font-size: 22rpx; - color: #86909c; -} - -.mine-user-extra { - margin-top: 16rpx; - padding-top: 16rpx; - border-top: 1rpx solid #f0f0f0; - font-size: 22rpx; - color: #86909c; +/* ═══ 区块2: 快捷功能(4宫格) ═══ */ +.quick-grid { display: flex; flex-wrap: wrap; + padding-bottom: 16rpx; +} + +.quick-item { + width: 25%; + display: flex; + flex-direction: column; align-items: center; + padding: 12rpx 0; } -.extra-link { - color: #1768ff; +.quick-item-btn { + margin: 0; + padding: 12rpx 0; + border: none; + background: transparent; + line-height: normal; + font-size: inherit; + color: inherit; + box-sizing: border-box; } -.extra-dot { - margin: 0 8rpx; +.quick-item-btn::after { + display: none; +} + +.quick-item-hover { + opacity: 0.7; +} + +.quick-icon-wrap { + width: 80rpx; + height: 80rpx; + border-radius: 24rpx; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 10rpx; +} + +.quick-icon { + font-size: 36rpx; +} + +.quick-name { + font-size: 22rpx; + color: #4e5969; + text-align: center; +} + +/* ═══ 区块3/4/5: 列表行 ═══ */ +.tool-list { + padding-bottom: 8rpx; +} + +.tool-row { + display: flex; + align-items: center; + padding: 20rpx 4rpx; + border-bottom: 1rpx solid #f5f5f5; +} + +.tool-row:last-child { + border-bottom: none; +} + +.tool-row:active { + background: #fafbfc; + border-radius: 12rpx; +} + +.tool-row-btn { + margin: 0; + padding: 20rpx 4rpx; + border: none; + border-radius: 0; + background: transparent; + text-align: left; + line-height: inherit; + font-size: inherit; + color: inherit; + box-sizing: border-box; + width: 100%; + border-bottom: 1rpx solid #f5f5f5; +} + +.tool-row-btn::after { + display: none; +} + +.tool-row-hover { + background: rgba(23, 104, 255, 0.04); +} + +.tool-row-icon-wrap { + width: 56rpx; + height: 56rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin-right: 16rpx; + flex-shrink: 0; +} + +.tool-row-icon { + font-size: 28rpx; +} + +.tool-row-text { + flex: 1; + min-width: 0; +} + +.tool-row-name { + flex: 1; + font-size: 26rpx; + color: #1d2129; +} + +.tool-row-sub { + display: block; + font-size: 20rpx; + color: #ffb020; + margin-top: 2rpx; +} + +.tool-row-arrow { + font-size: 28rpx; + color: #c9cdd4; + flex-shrink: 0; + margin-left: 8rpx; +} + +.no-border { + border-bottom: none !important; +} + +/* ═══ 弹窗样式 ═══ */ +.coop-mask { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 1001; + display: flex; + align-items: center; + justify-content: center; + padding: 48rpx; + box-sizing: border-box; +} + +.coop-dialog { + width: 100%; + max-width: 600rpx; + background: #fff; + border-radius: 24rpx; + padding: 36rpx 32rpx 28rpx; + box-sizing: border-box; +} + +.coop-title { + font-size: 32rpx; + font-weight: 600; + color: #1d2129; + text-align: center; + margin-bottom: 12rpx; +} + +.coop-hint { + font-size: 24rpx; + color: #86909c; + text-align: center; + margin-bottom: 28rpx; + line-height: 1.5; +} + +.coop-qr { + display: block; + width: 360rpx; + height: 360rpx; + margin: 0 auto 28rpx; + border-radius: 12rpx; + background: #f7f8fa; +} + +.coop-qr-placeholder { + width: 360rpx; + height: 360rpx; + margin: 0 auto 28rpx; + border-radius: 12rpx; + border: 2rpx dashed #dcdfe6; + background: #fafbfc; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 24rpx; + box-sizing: border-box; + gap: 12rpx; +} + +.coop-qr-placeholder-text { + font-size: 22rpx; + color: #86909c; + line-height: 1.6; + text-align: center; +} + +.coop-qr-placeholder-sub { + font-size: 20rpx; color: #c9cdd4; } -.extra-hint { - color: #86909c; -} - -.mine-bind-row { - margin-top: 12rpx; - padding: 16rpx 0 4rpx; - display: flex; - align-items: center; - justify-content: space-between; -} - -.mine-bind-text { - font-size: 26rpx; - color: #1768ff; - font-weight: 500; -} - -.mine-bind-arrow { - font-size: 36rpx; - color: #1768ff; - line-height: 1; +.coop-close { + height: 80rpx; + line-height: 80rpx; + text-align: center; + background: linear-gradient(90deg, #1768ff 0%, #4d94ff 100%); + color: #fff; + font-size: 28rpx; + font-weight: 600; + border-radius: 40rpx; } +/* ═══ 绑定手机弹窗 ═══ */ .bind-mask { position: fixed; left: 0; @@ -785,198 +1037,4 @@ onUnmounted(() => { color: #86909c; padding: 12rpx; } - -.grid-4 { - display: flex; - justify-content: space-between; -} - -.grid-item { - width: 25%; - display: flex; - flex-direction: column; - align-items: center; - padding-top: 8rpx; -} - -.grid-item-btn { - margin: 0; - padding: 8rpx 0 0; - border: none; - background: transparent; - line-height: normal; - font-size: inherit; - color: inherit; - box-sizing: border-box; -} - -.grid-item-btn::after { - display: none; -} - -.grid-item-hover { - opacity: 0.88; -} - -.coop-mask { - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.5); - z-index: 1001; - display: flex; - align-items: center; - justify-content: center; - padding: 48rpx; - box-sizing: border-box; -} - -.coop-dialog { - width: 100%; - max-width: 600rpx; - background: #fff; - border-radius: 24rpx; - padding: 36rpx 32rpx 28rpx; - box-sizing: border-box; -} - -.coop-title { - font-size: 32rpx; - font-weight: 600; - color: #1d2129; - text-align: center; - margin-bottom: 12rpx; -} - -.coop-hint { - font-size: 24rpx; - color: #86909c; - text-align: center; - margin-bottom: 28rpx; - line-height: 1.5; -} - -.coop-qr { - display: block; - width: 360rpx; - height: 360rpx; - margin: 0 auto 28rpx; - border-radius: 12rpx; - background: #f7f8fa; -} - -.coop-qr-placeholder { - width: 360rpx; - height: 360rpx; - margin: 0 auto 28rpx; - border-radius: 12rpx; - border: 2rpx dashed #dcdfe6; - background: #fafbfc; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 24rpx; - box-sizing: border-box; - gap: 12rpx; -} - -.coop-qr-placeholder-text { - font-size: 22rpx; - color: #86909c; - line-height: 1.6; - text-align: center; -} - -.coop-qr-placeholder-sub { - font-size: 20rpx; - color: #c9cdd4; -} - -.coop-close { - height: 80rpx; - line-height: 80rpx; - text-align: center; - background: linear-gradient(90deg, #1768ff 0%, #4d94ff 100%); - color: #fff; - font-size: 28rpx; - font-weight: 600; - border-radius: 40rpx; -} - -.icon-tool { - width: 48rpx; - height: 48rpx; - margin-bottom: 8rpx; - color: #1768ff; -} - -.grid-text { - font-size: 24rpx; - color: #4e5969; -} - -.list-card { - padding: 0 24rpx; -} - -.list-item { - height: 96rpx; - display: flex; - align-items: center; - border-bottom: 1rpx solid #f0f0f0; -} - -.list-item-contact { - width: 100%; - margin: 0; - padding: 0; - border: none; - border-radius: 0; - background: transparent; - text-align: left; - line-height: inherit; - font-size: inherit; - color: inherit; - box-sizing: border-box; -} - -.list-item-contact::after { - display: none; -} - -.list-item-contact-hover { - background: rgba(23, 104, 255, 0.06); -} - -.list-icon { - width: 40rpx; - height: 40rpx; - margin-right: 20rpx; - flex-shrink: 0; - color: #1768ff; -} - -.no-border { - border-bottom-width: 0; -} - -.list-text { - font-size: 26rpx; - color: #1d2129; -} - -.service-row { - width: 100%; - display: flex; - justify-content: space-between; - align-items: center; -} - -.service-time { - font-size: 22rpx; - color: #ffb020; -} diff --git a/src/pages/toolbox/category.vue b/src/pages/toolbox/category.vue index 52ebe5b..4bb4fea 100644 --- a/src/pages/toolbox/category.vue +++ b/src/pages/toolbox/category.vue @@ -1,7 +1,7 @@ @@ -71,101 +188,201 @@ function goCategory(categoryKey: string) { height: 100vh; display: flex; flex-direction: column; - background: linear-gradient(180deg, #f8faff 0%, #f3f5fb 100%); + background: #f5f6fa; } -.scrollarea { +/* ============ 双栏布局 ============ */ +.layout { flex: 1; - min-height: 0; - height: 0; -} - -.page { - padding: 24rpx 24rpx 40rpx; - box-sizing: border-box; -} - -.card { - background: linear-gradient(145deg, #ffffff 0%, #f7f8ff 100%); - border-radius: 24rpx; - padding: 24rpx 24rpx 20rpx; - margin-bottom: 24rpx; - border: 1rpx solid #e5e6f0; - box-shadow: - 0 16rpx 40rpx rgba(15, 35, 52, 0.04), - 0 0 0 1rpx rgba(255, 255, 255, 0.5) inset; -} - -.card-header { display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 20rpx; + min-height: 0; } -.card-header-left { +/* 左侧分类导航 */ +.sidebar { + width: 180rpx; + height: 100%; + background: #f0f1f5; + flex-shrink: 0; +} + +.sidebar-item { + position: relative; + display: flex; + align-items: center; + justify-content: center; + height: 104rpx; + padding: 0 8rpx; +} + +.sidebar-item:active { + background: #e8e9ed; +} + +.sidebar-item--active { + background: #fff; +} + +.sidebar-indicator { + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + width: 8rpx; + height: 40rpx; + border-radius: 0 4rpx 4rpx 0; + background: #1768ff; +} + +.sidebar-text { + font-size: 24rpx; + color: #86909c; + text-align: center; + line-height: 1.3; +} + +.sidebar-text--active { + color: #1d2129; + font-weight: 600; +} + +/* 右侧内容区 */ +.content { + flex: 1; + height: 100%; + background: #fff; +} + +.content-header { display: flex; align-items: center; gap: 16rpx; + padding: 28rpx 28rpx 16rpx; } -.cat-icon-wrap { - width: 56rpx; - height: 56rpx; +.content-icon-wrap { + width: 52rpx; + height: 52rpx; + border-radius: 14rpx; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.content-icon { + font-size: 28rpx; +} + +.content-info { + flex: 1; +} + +.content-title { + display: block; + font-size: 28rpx; + font-weight: 600; + color: #1d2129; + margin-bottom: 4rpx; +} + +.content-count { + display: block; + font-size: 20rpx; + color: #86909c; +} + +/* ============ 热门推荐:分类卡片网格 ============ */ +.cat-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 14rpx; + padding: 8rpx 20rpx; +} + +.cat-card { + display: flex; + flex-direction: row; + align-items: center; + gap: 14rpx; + padding: 20rpx 16rpx; border-radius: 16rpx; + background: #f7f8fa; +} + +.cat-card:active { + background: #eef1f5; +} + +/* 车辆查询单图标 */ +.cat-card-single-icon { + width: 48rpx; + height: 48rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +/* 四宫格图标 */ +.cat-card-grid-icon { + width: 48rpx; + height: 48rpx; + border-radius: 12rpx; + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr 1fr; + overflow: hidden; + flex-shrink: 0; +} + +.mini-icon-cell { display: flex; align-items: center; justify-content: center; } -.cat-icon { - font-size: 32rpx; +.mini-icon { + font-size: 16rpx; } -.card-title { - font-size: 30rpx; - font-weight: 600; - color: #1d2129; +.cat-card-text { + flex: 1; + min-width: 0; } -.card-more { - display: flex; - align-items: center; - gap: 4rpx; - padding: 8rpx 16rpx; - border-radius: 20rpx; - background: #f2f3f5; -} - -.more-text { +.cat-card-name { + display: block; font-size: 22rpx; + font-weight: 500; + color: #1d2129; + margin-bottom: 2rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.cat-card-count { + display: block; + font-size: 18rpx; color: #86909c; } -.more-arrow { - font-size: 22rpx; - color: #c9cdd4; -} - -.card-more:active { - opacity: 0.7; -} - +/* ============ 工具网格 ============ */ .tool-grid { display: flex; flex-wrap: wrap; - margin: 0 -6rpx; + padding: 0 16rpx; } .tool-cell { - width: 33.333%; - padding: 6rpx; - box-sizing: border-box; + width: 25%; display: flex; flex-direction: column; align-items: center; - padding-top: 12rpx; - padding-bottom: 12rpx; + padding: 16rpx 0; + box-sizing: border-box; } .tool-cell:active { @@ -173,27 +390,33 @@ function goCategory(categoryKey: string) { } .tool-icon-wrap { - width: 76rpx; - height: 76rpx; - border-radius: 20rpx; + width: 68rpx; + height: 68rpx; + border-radius: 18rpx; display: flex; align-items: center; justify-content: center; - margin-bottom: 10rpx; + margin-bottom: 8rpx; } -.tool-icon { - font-size: 36rpx; +.tool-icon-grid { + font-size: 34rpx; +} + +.tool-icon-img { + width: 38rpx; + height: 38rpx; } .tool-name { - font-size: 24rpx; - font-weight: 500; - color: #1d2129; + font-size: 20rpx; + color: #333; text-align: center; + line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + padding: 0 4rpx; } diff --git a/src/pages/toolbox/query.vue b/src/pages/toolbox/query.vue index 39ffa3b..f84ee44 100644 --- a/src/pages/toolbox/query.vue +++ b/src/pages/toolbox/query.vue @@ -253,6 +253,14 @@ async function handleQuery() { if (toolKey.value === 'idiom-quiz' || toolKey.value === 'poem-fill') { prepareGameOptions() } + // 百科题库:准备选项 + if (toolKey.value === 'baiketiku') { + prepareBaiKeOptions() + } + // 垃圾分类问答:准备选项 + if (toolKey.value === 'anslajifenlei') { + prepareGarbageOptions() + } // 成语接龙:记录系统返回的成语 if (toolKey.value === 'chengyujielong') { if (result.value?.word) { @@ -354,6 +362,59 @@ const prepareGameOptions = () => { answered.value = false } +// 百科题库:准备选项(A/B/C/D 四个选项,标记正确答案) +const prepareBaiKeOptions = () => { + if (!result.value) + return + + // answer 可能是选项字母标识(如 "A"),也可能是选项文本内容 + const correctAnswer = String(result.value.answer || '').trim() + const optionKeys = ['answerA', 'answerB', 'answerC', 'answerD'] as const + const optionLabels = ['A', 'B', 'C', 'D'] as const + const options = optionKeys + .map((key, i) => { + const val = String(result.value[key] || '').trim() + if (!val) return null + // answer 可能是字母标识 "A"/"B"/...,也可能是选项文本本身 + const isCorrect = correctAnswer === optionLabels[i] || correctAnswer === val + return { label: `${optionLabels[i]}. ${val}`, value: val, isCorrect } + }) + .filter(Boolean) as Array<{ label: string; value: string; isCorrect: boolean }> + + gameOptions.value = options + selectedOption.value = null + answered.value = false +} + +// 垃圾分类问答:准备选项(四个分类,标记正确答案) +const prepareGarbageOptions = () => { + if (!result.value) + return + + const correctType = result.value.type + const typeNames: Record = { + 0: '可回收物', + 1: '有害垃圾', + 2: '厨余垃圾', + 3: '其他垃圾', + } + const options = Object.entries(typeNames).map(([typeKey, typeName]) => ({ + label: typeName, + value: typeName, + isCorrect: Number(typeKey) === Number(correctType), + })) + + // 打乱顺序 + for (let i = options.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)) + ;[options[i], options[j]] = [options[j], options[i]] + } + + gameOptions.value = options + selectedOption.value = null + answered.value = false +} + // 点击选项 function handleOptionClick(option: { label: string; value: string; isCorrect: boolean }) { if (answered.value) @@ -538,11 +599,15 @@ function handleRestart() { - {{ result.question }} + + {{ result.name }} + 属于什么垃圾? + + {{ result.title || result.question }} - + @@ -610,6 +679,30 @@ function handleRestart() { {{ result.note }} + + + + + + @@ -1473,4 +1566,50 @@ function handleRestart() { .chain-empty-text { font-size: 24rpx; } + +/* 垃圾分类游戏样式 */ +.game-question-garbage { + display: flex; + flex-direction: column; + gap: 16rpx; + align-items: center; +} + +.garbage-name { + font-size: 56rpx; + font-weight: 700; + color: #1d2129; +} + +.garbage-prompt { + font-size: 30rpx; + color: #86909c; + font-weight: 400; +} + +.garbage-answer-type { + color: #00b42a; +} + +/* 垃圾分类选项布局 - 单列 */ +.game-options-col { + grid-template-columns: 1fr; +} + +/* 垃圾分类四个类别的默认色 */ +.game-option-recyclable { + border-left: 6rpx solid #1768ff; +} + +.game-option-hazardous { + border-left: 6rpx solid #f53f3f; +} + +.game-option-kitchen { + border-left: 6rpx solid #00b42a; +} + +.game-option-other { + border-left: 6rpx solid #86909c; +} diff --git a/src/static/tabbar/toolbox-active.png b/src/static/tabbar/toolbox-active.png new file mode 100644 index 0000000000000000000000000000000000000000..6afe81b6d2a4bee9d45763d4df9b5e11834a1ad5 GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^fgsGm1|(PYdzk?##^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!hD=Wv$B>G+w>LJfJnSIC8d(0Y>`rf;-Cx)ok$jae zsW;TR!!+!z!nKI4#0adHy?RdKaon1E_pQxu8?4G^A4{rCDtj(u7ACC@h!>Z9>Zf(|1zKXp?{z$!lvI6;>1s;*b3=DjSL74G){)!Z!hEz`%$B>G+w>NCPSRF-JA8t3Cv*-W96T{D>wOg;nf8#!u#w@VS TWhEal78pET{an^LB{Ts5RB+Lj literal 0 HcmV?d00001 diff --git a/uni-pages.d.ts b/uni-pages.d.ts index 46dd4fd..010fa62 100644 --- a/uni-pages.d.ts +++ b/uni-pages.d.ts @@ -10,6 +10,7 @@ type _LocationUrl = "/pages/report" | "/pages/inquire/example" | "/pages/inquire/index" | + "/pages/inquire/list" | "/pages/legal/authorization" | "/pages/legal/privacy-policy" | "/pages/legal/user-agreement" | @@ -24,7 +25,7 @@ interface NavigateToOptions { interface RedirectToOptions extends NavigateToOptions {} interface SwitchTabOptions { - url: "/pages/index" | "/pages/report" | "/pages/mine" + url: "/pages/index" | "/pages/toolbox/index" | "/pages/mine" } type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;