从拖挂式房车到四季帐篷,从露营柴火炉到户外电源站,从车载冰箱到营地折叠车——本文以一套完整的ArkTS旷野驿站应用为例,深度解析HarmonyOS 6.1.1在荒野大地方风二手交易场景下的双Tab嵌套架构、14粒子漂浮动效、S/A/B/C四级稀有度分级、荒野棕户外绿详情头、以装换装交换帖等核心技术实现。

一、引言

房车、帐篷、炊具、露营灯、户外椅、电源站——这些承载着户外人自由梦想的装备,在露营热潮下焕发了新的生机。从拖挂式房车到四季帐篷,从露营柴火炉到户外电源站,从车载冰箱到营地折叠车,户外装备二手交易已经成为一个庞大的收藏市场。然而户外装备交易长期依赖闲鱼、转转等泛平台,缺乏针对户外人的专业化功能——装备稀有度评级、规格尺寸区分(7米/3-4人/1000Wh/45L等)、以装换装交换、露营入门指南等核心需求无法得到满足。

本应用(旷野驿站)以"荒野棕+户外绿"荒野大地方风为视觉基调,打造集装备交易、换件交换、图鉴收藏、个人中心四大模块于一体的荒野露营风二手交易与收藏社区。18款装备覆盖房车/帐篷/炊具/露营灯/户外椅/电源全品类,8条交换帖覆盖以装换装场景,5套教程覆盖入门/房车/烹饪/电源/帐篷,9款配件覆盖户外周边,6套图鉴收藏记录收藏进度,3条圈友点评提供真实评价。

本文将从架构设计、色彩系统、数据模型、四大Tab页面、弹框体系、核心技术特性等维度,完整解析这套应用的ArkTS实现。

二、整体架构

本应用采用单组件双Tab嵌套架构——@Entry @Component struct Index作为唯一入口组件,通过@State currentBottomTab控制四大底部Tab(装备/换件/图鉴/我的),装备Tab内部再通过@State currentTopTab控制六大顶部分类Tab(全部/房车/帐篷/炊具/露营灯/户外椅),形成双层Tab嵌套。

架构层次:

  • 入口层:Index,负责双层Tab切换、头部、底部导航、粒子动效、弹框管理
  • 页面层:4个底部Tab对应的Builder方法(bazaarContent/swapContent/collectionContent/mineContent),装备Tab内含6个顶部Tab对应的Builder方法(cityContent/retiredContent/mocContent/figContent/techContent/streetContent)
  • 数据层:8个全局const数组(18装备+8交换帖+5教程+9配件+6图鉴+3点评+2图表数据+2弹框选项)+1个配色常量PALETTE
  • 工具函数层:10+全局纯函数(catColor/catLabel/rarityLabel/rarityColor/tradeBarHeight/rateColor/6个分类筛选函数/swapBadge)
  • 弹框层:4种弹框(发布出售/发起交换/下架/装备详情),均通过@State布尔值控制显隐

单组件架构的优势在于状态集中管理、数据共享方便、弹框统一调度,适合中等复杂度的应用。双层Tab嵌套是本应用的架构特色——装备作为主品类,内部再按房车/帐篷/炊具/露营灯/户外椅细分,户外人可以快速切换品类浏览。

三、色彩系统:荒野棕+户外绿荒野大地方风

荒野大地方风的视觉语言应该是"粗犷、自然、有户外的野性"。本应用采用荒野棕+户外绿配色:

主色体系:

  • #F5F2EC 米白:应用根背景、浅色卡片背景——代表大地的质朴
  • #FFFFFF 纯白:卡片背景、弹框背景、底部Tab背景——代表层次
  • #8D6E63 荒野棕:主高亮色、Tab选中态、按钮、标签、渐变——代表大地的粗犷
  • #2E2E2E 深炭:头部渐变终点、最深背景——代表深邃
  • #D32F2F 砖红:删除按钮、价格、警告——代表热情与警告
  • #F9A825 金黄:价格、等级标签、统计数字、交换弹框头部、Banner渐变——代表闪耀的金色
  • #558B2F 户外绿:辅助色、Tab下划线、稀有度C级色——代表自然的生机
  • #8D8D8D 烟灰:辅助文字、未选中Tab、说明文字——代表素雅
  • #E5E0D8 浅米:分割线、进度条背景——代表层次

浅色背景层次(浅色主题下的层次):

  • #F5F2EC 米白:应用根背景
  • #FFFFFF 纯白:卡片背景、弹框背景
  • #F0EAD8 浅米:高亮卡片背景、选中态背景、标签背景
  • #E8F5E9 浅绿:高亮卡片背景、教程步骤背景、选中态背景
  • #E5E0D8 浅米:分割线、进度条背景

渐变设计:

  • 头部:linearGradient angle 135 从#8D6E63到#2E2E2E——荒野棕到深炭的粗犷渐变
  • 全部Tab Banner:linearGradient angle 120 从#F9A825到#FFD54F——金黄到浅金的闪耀渐变
  • 房车Tab横滑大卡:linearGradient angle 160 从#8D6E63到#2E2E2E——荒野棕到深炭
  • 露营灯Tab对决卡:linearGradient angle 150 从#8D6E63到#2E2E2E——荒野棕到深炭
  • 我的页会员卡:linearGradient angle 120 从#8D6E63到#2E2E2E——荒野棕到深炭
  • 发布出售弹框头部:linearGradient angle 120 从#8D6E63到#2E2E2E——荒野棕到深炭
  • 装备详情弹框头部:linearGradient angle 135 从#FFD54F到#F0EAD8——金黄到浅米的闪耀渐变

荒野棕+户外绿的配色通过米白根背景+纯白卡片+浅米/浅绿高亮背景营造荒野风格的粗犷自然感,荒野棕#8D6E63作为主高亮和按钮色,户外绿#558B2F作为Tab下划线和稀有度C级色,金黄#F9A825作为价格和等级色,砖红#D32F2F作为删除和价格色,确保视觉一致性和荒野大地方风韵味。本应用是所有主题中渐变使用最多的(7处渐变),营造出丰富的视觉层次。

四、数据模型

应用定义了7个接口,覆盖户外装备二手交易全链路:

  • EquipItem装备(id/name/eng/cat/price/rarity/year/rating/starStr/seller/tag/desc/want/sales/emoji/size)——18款,含中英文名称、分类、稀有度0-100、发布年份、规格尺寸(7米/3-4人/1000Wh/45L等)、卖家想换等二手交易特色字段
  • SwapItem交换帖(id/user/avatar/offer/want/time/likes/content/place)——8条交换帖,含我提供/我想换/地点/点赞数
  • GuideItem户外教程(id/name/type/pages/author/likes/downloads/emoji/steps)——5套教程,含步骤数组
  • AccessoryItem配件周边(id/name/series/price/condition/seller/emoji/desc)——9款配件
  • CollectionItem图鉴收藏(id/name/series/owned/total/rate/emoji)——6套图鉴,含已收/总数/进度百分比
  • EquipReview圈友点评(id/user/setName/starStr/content)——3条点评
  • ColorPalette配色(bg/card/brown/green/deep/red/gold/sub/line)——9色配色常量

rarity稀有度字段是户外装备的特色设计——0-100数值,通过rarityLabel函数映射为四级(S级≥95/A级≥80/B级≥60/C级<60),通过rarityColor函数映射为四色(砖红/橙/亮蓝/户外绿),在柱状图和装备详情中直接渲染。size规格字段区分7米/3-4人/1000Wh/45L等不同尺寸,want卖家想换字段支持以装换装交易场景。

五、Tab0 装备交易(双Tab嵌套)

装备页是应用的核心,采用底部Tab+顶部Tab双层嵌套架构。顶部6个分类Tab(全部/房车/帐篷/炊具/露营灯/户外椅),每个Tab有独立的布局风格:

全部Tab:Banner+双列瀑布

  • 金黄渐变Banner:野外装备节春季专场+顶级装备3天限时卖家免服务费+顶级装备/房车专区标签
  • 全城新上架:双列瀑布布局,左列2件(户外炊具套装/户外急救包),右列1件(防水篷布天幕,浅米高亮背景),每件含emoji/中文名/英文名/描述/价格/标签

房车Tab:横滑大卡+稀有度柱状图+捡漏榜

  • 顶级装备专区:3件横滑大卡(拖挂式房车/四季帐篷/露营柴火炉),荒野棕渐变背景160宽,含emoji/名称/英文+年份/价格+稀有度标签
  • 稀有度排行:3根柱状图(90/80/75),第三根柴火炉用砖红高亮,底部说明"拖挂房车以90分稀有度登顶,市面流通极少"
  • 今日捡漏榜:3件排行列表,第1名砖红数字,含排名/emoji/名称+稀有度+卖家想换/价格

帐篷Tab:教程时间轴

  • 5套教程时间轴布局(露营入门指南/房车旅行攻略/户外烹饪技巧/电源站使用指南/帐篷选购指南),左侧emoji+户外绿竖线连接,右侧卡片含名称/下载数/作者+类型+页数/步骤列表(带序号圆点)/点赞+教程可下载

炊具Tab:三列格子+交换建议

  • 配件周边三列网格(9款配件,31%宽度),每件含emoji/名称/系列/价格
  • 配件交换行情:偶数ID配件的交换列表,含emoji/名称+成色/描述/价格(户外绿)

露营灯Tab:对决卡+侧栏统计

  • 装备对决:拖挂房车 VS 四季帐篷,两张荒野棕渐变对决卡中间VS标识
  • 左侧3件进阶装备列表(便携燃气炉/车载冰箱/户外电源站),右侧3格统计(12本周装备成交荒野棕/3.2万装备总交易额金黄/96%好评率户外绿)

户外椅Tab:标签云+紧凑列表

  • 配件周边标签云:6套图鉴(房车/帐篷/炊具/露营灯/户外椅/电源设备),浅米背景chip
  • 3件紧凑列表(营地折叠车/防潮垫/露营吊床),第3件浅米高亮背景,含稀有度彩色标签
  • 底部提示:集齐三大装备可召唤隐藏福利:房车+帐篷+炊具

双层Tab嵌套让户外人可以在装备主Tab内快速切换6大品类,每个品类有独立的视觉布局和数据展示方式,避免单一布局的单调感。

六、Tab1 换件交换

换件页是户外装备二手交易的特色功能——以装换装。由两个层次构成:

1. 统计条+发交换按钮:四格统计(156在交换中荒野棕/42今日成交金黄/98%面交好评户外绿)+右侧发交换按钮(荒野棕底,触发发起交换弹框)。

2. 交换帖列表:8条交换帖卡片,每帖含:

  • 头部:头像emoji+用户名+热度标签(🔥热门≥50/👍热度≥30/🌱新帖<30,通过swapBadge函数动态生成)+时间+地点+右侧⋯菜单(触发下架弹框)
  • 交换区:我提供(浅米背景,荒野棕标题)⇄我想换(浅米背景,砖红标题),左右对称布局
  • 内容:帖文描述
  • 底部:📍地点标签(荒野棕底米白背景)+❤️点赞数(砖红)

换件页解决了户外装备二手交易中"以装换装"的核心需求——户外人可以用自己的闲置装备(拖挂房车/四季帐篷/柴火炉/露营入门指南/车顶帐篷/折叠椅/户外电源站/吊床)交换心仪的装备,通过地点标签支持木兰营地面交和线上交换,通过热度标签筛选热门交换帖。

七、Tab2 图鉴收藏

图鉴页是户外装备收藏进度管理功能。由三个层次构成:

1. 标题+登记按钮:我的户外图鉴标题+记录每一件装备的收藏进度+右侧✚登记按钮(荒野棕底,触发发布出售弹框复用)。

2. 图鉴进度列表:6套图鉴(房车/帐篷/炊具/露营灯/户外椅/电源设备),每套含:

  • 头部:emoji+名称+英文系列名+已收X/总数+右侧进度百分比(通过rateColor函数动态着色:≥55户外绿/≥40金黄/<40砖红)
  • 进度条:双色进度条(已收部分rateColor色+未收部分浅米),宽度通过百分比动态计算

3. 图鉴成就墙:4个成就标签(🎖️野外达人/🏆房车旅居者/⛺帐篷收藏家/🍳野炊专家),不同颜色文字。

图鉴页让户外人可以系统化管理自己的收藏进度,通过进度条和百分比直观看到每套图鉴的完成度,通过成就墙增加收藏的趣味性和成就感。

八、Tab3 个人中心

我的页是户外人个人信息管理。由三个层次构成:

1. 会员信息卡:荒野棕渐变背景,含🚐头像+户外收藏家老野+LV.10资深户外人·信用分990+右侧>箭头+三格统计(38在售装备金黄/12求购中金黄/¥5.8万累计成交额金黄)。

2. 我的求购清单:3件求购装备(营地折叠车/防水篷布天幕/户外急救包),每件含emoji/名称+预算+卖家想换/右侧出价中标签(金黄底浅金背景)。

3. 常去面交点:5个地点列表(木兰营地/江汉路站/洪山广场站/楚河汉街站/线上互换),每个含不同emoji(🚇/🏬/🚌/🏪/📦)+地点名+右侧站点说明(木兰营地/江汉路天桥/洪山转盘/楚河入口/顺丰网点)。

我的页通过求购清单和常去面交点两个特色功能,将户外装备二手交易的线下场景融入个人中心,让户外人可以管理自己的求购装备和常去面交地点。

九、弹框体系

本应用有4种弹框,均通过@State布尔值控制显隐,zIndex通过Stack层叠实现:

1. 发布出售弹框(新增):88%宽76%高,荒野棕渐变头部(🏕️发布出售+闲置回血神装不愁卖),滚动内容含:要出售的装备(8个装备chip选择,选中荒野棕底白字)+成色说明(5档chip:全新未拆/仅使用1次/9成新/8成新/有磨损,选中金黄底白字)+出售价格(−/¥价格/+步进器,步进10元,价格>20000显示"高价好物建议包邮"否则"实惠价更容易出手")+宝贝描述(TextInput输入)+取消/上架出售双按钮。

2. 发起交换弹框(新增):88%宽72%高,户外绿头部(🤝发起交换+用闲置换心头好驴友互助),滚动内容含:我提供(5个装备chip选择,选中深炭底白字)+我想换可多选(5个装备chip,选中砖红底白字带✓)+面交地点(5个地点chip,选中荒野棕底白字)+安全提示(💡交换双方可自行协商补差价,面交请选择人流密集的公共场所,注意安全)+再想想/发布交换帖双按钮。

3. 下架弹框(删除):72%宽居中,🗑️图标+下架这件装备?+说明文字(下架后买家将无法搜索到这条信息,收藏和留言会一并清空,可重新上架)+留着(荒野棕底浅米背景)/确认下架(砖红底白字)双按钮。

4. 装备详情弹框:88%宽78%高,金黄到浅米渐变头部(emoji+中文名+英文名+标签+稀有度标签),滚动内容含:四格数据(售价砖红/规格荒野棕/稀有度动态色/年份金黄)+宝贝描述(描述文字+卖家+星级评分)+卖家想换(🤝+卖家想换,浅米背景)+圈友点评(3条点评卡片)+留言问问(荒野棕底浅米背景)/立即购买(砖红底白字)双按钮。

所有弹框均通过Stack层叠+半透明黑色背景(99000000)+居中布局实现,点击背景区域关闭弹框。

十、核心技术特性

1. 双Tab嵌套架构:底部4Tab+装备Tab内部顶部6Tab,通过两个@State(currentBottomTab/currentTopTab)独立控制,if-else链分发到对应的Builder方法,实现双层分类浏览。

2. 14粒子漂浮动效:aboutToAppear生命周期中buildParticles生成14个粒子(🚐/⛺/🍳/💡/🪑五种emoji随机,大小12-22px,速度0.6-2.0,透明度0.2-0.6),setInterval每80ms调用driftParticles更新x坐标(超出360重置为-20),通过position绝对定位漂浮在页面上,营造荒野露营氛围。aboutToDisappear中clearInterval清理定时器避免内存泄漏。

3. S/A/B/C四级稀有度分级:rarity字段0-100数值,通过rarityLabel映射为四级标签(S级≥95/A级≥80/B级≥60/C级<60),通过rarityColor映射为四色(砖红/橙/亮蓝/户外绿),在柱状图、装备详情、紧凑列表中统一渲染,数据驱动UI。

4. 荒野棕户外绿头部设计:头部使用荒野棕#8D6E63到深炭#2E2E2E的linearGradient渐变,白色文字和标签在深色背景上形成鲜明对比,营造荒野风格的粗犷自然感。

5. 以装换装交换帖:换件页每条帖子采用我提供(浅米背景,荒野棕标题)⇄我想换(浅米背景,砖红标题)的对称布局,通过swapBadge函数根据点赞数动态生成热度标签(🔥热门/👍热度/🌱新帖),支持木兰营地面交和线上交换,解决户外装备二手交易中的以装换装需求。

6. 全局纯函数工具集:10+全局纯函数(catColor/catLabel/rarityLabel/rarityColor/tradeBarHeight/rateColor/6个分类筛选函数/swapBadge),将数据到UI的映射逻辑抽离为纯函数,便于复用和维护,符合函数式编程思想。

7. 分类筛选函数:6个函数(retiredSets/mocSets/figSets/techSets/streetSets/classicSets)通过数组切片返回对应分类的3件装备,cityLeft/cityRight返回全部Tab的双列数据,hotSets返回热门装备,数据筛选逻辑清晰。

8. 详情数据取值方法:14个detailXxx方法(detailName/detailEng/detailEmoji/detailPrice/detailSize/detailRarity/detailYear/detailSeller/detailTag/detailStar/detailRating/detailDesc/detailWant)通过遍历EQUIPS数组查找selectedEquipId对应的装备字段,在详情弹框中调用,避免在Builder中写复杂的查找逻辑。

9. 步进器价格输入:发布出售弹框的价格采用−/¥价格/+步进器设计,步进10元,通过@State sellPrice控制,价格>20000时动态显示"高价好物建议包邮"提示,交互友好。

10. Stack层叠弹框管理:4种弹框通过Stack层叠+@State布尔值控制,半透明黑色背景99000000,点击背景关闭,弹框内容居中,zIndex自动由Stack层叠顺序决定,无需手动管理zIndex。

11. 7处渐变设计:本应用是所有主题中渐变使用最多的,头部、全部Tab Banner、房车Tab横滑大卡、露营灯Tab对决卡、我的页会员卡、发布出售弹框头部、装备详情弹框头部均使用linearGradient渐变,营造出丰富的视觉层次和荒野大地方风韵味。

十一、同类对比

维度 通用二手平台 本应用(旷野驿站)
主题 浅色/蓝色为主 荒野棕+户外绿荒野大地方风
架构 单Tab或简单分类 双Tab嵌套(底部4+顶部6)
动效 无或简单 14个粒子漂浮动效
稀有度 无或简单星级 0-100数值+S/A/B/C四级+四色映射
以装换装 无或简单留言 交换帖+我提供⇄我想换对称布局
户外教程 无或外部链接 5套时间轴布局教程+步骤列表
装备图鉴 无或简单收藏 6套图鉴+进度条+成就墙
求购清单 3件求购装备+预算+出价中
常去面交点 5个地点+站点说明
弹框 2-3种 4种(发布出售/发起交换/下架/详情)
渐变 无或1处 7处渐变设计

十二、完整代码结构总览

1317.ets
├── 数据结构(7个interface)
├── 静态配置(PALETTE配色 + 2个Tab配置 + 2个弹框选项 + 2个图表数据)
├── 静态数据(8个数组:18装备+8交换帖+5教程+9配件+6图鉴+3点评)
├── 全局纯函数(10+个:catColor/catLabel/rarityLabel/rarityColor/rateColor/6分类筛选/swapBadge)
├── Index入口组件(@Entry @Component)
│   ├── 状态(currentBottomTab/currentTopTab/selectedEquipId/4个弹框显隐/发布出售表单/发起交换表单/particles粒子)
│   ├── 生命周期(aboutToAppear生成粒子+启动定时器/aboutToDisappear清理定时器)
│   ├── 粒子方法(buildParticles/driftParticles)
│   ├── 详情取值方法(14个detailXxx)
│   ├── 头部Builder
│   ├── 顶部Tab Builder
│   ├── 6个顶部Tab内容Builder(city/retired/moc/fig/tech/street)
│   ├── 装备首页Builder(bazaarContent)
│   ├── 换件页Builder(swapContent)
│   ├── 图鉴页Builder(collectionContent)
│   ├── 我的页Builder(mineContent)
│   ├── 底部Tab Builder
│   ├── 4种弹框Builder(sellModal/swapModal/deleteModal/detailModal)
│   ├── 交换多选辅助方法(pickedWant/toggleWant)
│   └── build主布局(Stack层叠+Column内容+粒子+4弹框)

十三、开发环境搭建

13.1 环境要求

DevEco Studio 5.0+(支持HarmonyOS 6.1.1)、HarmonyOS SDK API 24、Node.js 18+、至少8GB内存。

13.2 安装DevEco Studio

DevEco Studio 安装界面

从华为开发者官网下载最新版本,运行安装包,选择安装路径,勾选创建桌面快捷方式,点击安装。

13.3 配置SDK

SDK 配置界面

首次启动后进入File > Settings > HarmonyOS SDK,勾选API 24及以上版本,点击Apply等待下载完成。

13.4 创建项目

创建项目界面

选择Create Project > Empty Ability,配置项目名称、包名、保存路径,选择Compile SDK为API 24,点击Finish。

13.5 运行应用

运行应用界面

将1316.ets代码替换到entry/src/main/ets/pages/Index.ets,连接HarmonyOS设备或启动模拟器,点击运行按钮预览。

13.6 预览调试

预览调试界面

DevEco Studio提供实时预览功能,编辑器右侧打开Previewer面板,支持多设备尺寸预览、深色模式切换、组件树inspect等调试能力。

十四、总结展望

本文完整解析了基于HarmonyOS 6.1.1的旷野驿站应用,从荒野棕+户外绿荒野大地方配色系统、双Tab嵌套架构、装备数据模型(含稀有度0-100/规格尺寸/卖家想换等特色字段)、装备交易六大品类独立布局(全部双列瀑布/房车横滑大卡+稀有度柱状图+捡漏榜/帐篷教程时间轴/炊具三列网格/露营灯对决卡+侧栏统计/户外椅标签云+紧凑列表)、换件以装换装交换帖、图鉴收藏进度条、个人中心求购清单+常去面交点,到4种弹框体系、14粒子漂浮动效、S/A/B/C四级稀有度分级、荒野棕户外绿头部、7处渐变设计、全局纯函数工具集、详情数据取值方法,展现了ArkTS在荒野大地方风二手交易场景下的完整工程实践。

核心价值:

  1. 荒野棕+户外绿荒野大地方配色:荒野风格的粗犷自然感,荒野棕高亮营造户外氛围
  2. 双Tab嵌套架构:底部4Tab+顶部6Tab,双层分类浏览体验
  3. 14粒子漂浮动效:setInterval驱动emoji粒子漂浮,aboutToDisappear清理定时器
  4. S/A/B/C四级稀有度分级:0-100数值→四级标签→四色映射,数据驱动UI
  5. 以装换装交换帖:我提供⇄我想换对称布局+热度标签动态生成+木兰营地面交
  6. 装备图鉴进度管理:6套图鉴+双色进度条+成就墙,收藏系统化
  7. 7处渐变设计:所有主题中渐变使用最多,营造丰富视觉层次
  8. 全局纯函数工具集:10+纯函数抽离数据到UI映射逻辑,代码可维护

未来可扩展:

  • 接入真实户外装备数据库,自动识别装备类型和规格,替代手动分类
  • 粒子动效接入设备陀螺仪,随手机倾斜方向漂移,增强沉浸感
  • 稀有度接入真实成交数据和市场行情,动态更新装备稀有度评分
  • 以装换装接入智能匹配算法,根据装备类型和价值推荐交换对象
  • 装备图鉴接入装备扫码识别,自动更新装备收藏记录
  • 接入户外营地推荐功能,根据装备类型推荐适合的露营地点
  • 求购清单接入推送通知,有匹配装备时自动提醒户外人

旷野驿站,让每一件装备都找到懂它的户外人,让荒野棕流转、户外绿生香。


附录:完整源码

// ============================================================
// 1317.ets - 旷野驿站
// 场景:露营/房车/帐篷/炊具/露营灯/户外椅的二手交易与收藏社区(荒野大地方风)
// 风格:荒野棕 #8D6E63 + 户外绿 #558B2F 荒野露营风
// 底部Tab:装备 / 换件 / 图鉴 / 我的
// 顶部Tab:全部 / 房车 / 帐篷 / 炊具 / 露营灯 / 户外椅
// 弹框:发布出售(新增) / 发起交换(新增) / 下架(删除) / 装备详情(详情)
// ============================================================
// ---------------- 配色 ----------------
interface ColorPalette {
bg: string;
card: string;
brown: string;
green: string;
deep: string;
red: string;
gold: string;
sub: string;
line: string;
}
const PALETTE: ColorPalette = {
bg: '#F5F2EC',
card: '#FFFFFF',
brown: '#8D6E63',
green: '#558B2F',
deep: '#2E2E2E',
red: '#D32F2F',
gold: '#F9A825',
sub: '#8D8D8D',
line: '#E5E0D8'
};
// ---------------- 通用结构 ----------------
interface TabItem { label: string; icon: string; }
interface ParticleItem { x: number; emoji: string; size: number; speed: number; opacity: number; }
// ---------------- 装备条目 ----------------
interface EquipItem {
id: number; name: string; eng: string; cat: string; price: number;
rarity: number; year: number; rating: number; starStr: string; seller: string;
tag: string; desc: string; want: string; sales: number; emoji: string; size: string;
}
// ---------------- 交换帖 ----------------
interface SwapItem {
id: number; user: string; avatar: string; offer: string; want: string;
time: string; likes: number; content: string; place: string;
}
// ---------------- 教程/攻略 ----------------
interface GuideItem {
id: number; name: string; type: string; pages: number; author: string;
likes: number; downloads: number; emoji: string; steps: string[];
}
// ---------------- 配件/周边 ----------------
interface AccessoryItem {
id: number; name: string; series: string; price: number; condition: string;
seller: string; emoji: string; desc: string;
}
// ---------------- 图鉴收藏 ----------------
interface CollectionItem {
id: number; name: string; series: string; owned: number; total: number; rate: number; emoji: string;
}
// ---------------- 点评 ----------------
interface EquipReview {
id: number; user: string; setName: string; starStr: string; content: string;
}
// ---------------- Tab 配置 ----------------
const BOTTOM_TABS: TabItem[] = [
{ label: '装备', icon: '🏕️' }, { label: '换件', icon: '🤝' }, { label: '图鉴', icon: '📖' }, { label: '我的', icon: '🚐' }
];
const TOP_TABS: TabItem[] = [
{ label: '全部', icon: '🧿' }, { label: '房车', icon: '🚐' }, { label: '帐篷', icon: '⛺' },
{ label: '炊具', icon: '🍳' }, { label: '露营灯', icon: '💡' }, { label: '户外椅', icon: '🪑' }
];
// ---------------- 装备数据(18款写死) ----------------
const EQUIPS: EquipItem[] = [
{ id: 1, name: '拖挂式房车', eng: 'Travel Trailer', cat: 'retired', price: 128000, rarity: 90, year: 2020, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '房车旅居者', tag: '豪华版', desc: '拖挂式房车,长7米,带独立卫生间、厨房、双人床,超大空间,适合长途旅行,成色极佳。', want: '换 自行式房车', sales: 1, emoji: '🚐', size: '7米' },
{ id: 2, name: '四季帐篷 3-4人', eng: 'Four Season Tent', cat: 'retired', price: 2400, rarity: 80, year: 2021, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '户外老驴', tag: '抗风防雪', desc: '四季帐篷,可抗8级大风,防暴雨防雪,双层结构,透气性好,适合高海拔露营。', want: '换 双人帐篷', sales: 3, emoji: '⛺', size: '3-4人' },
{ id: 3, name: '露营柴火炉', eng: 'Camping Stove', cat: 'retired', price: 680, rarity: 75, year: 2019, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '野炊达人', tag: '折叠便携', desc: '不锈钢柴火炉,折叠设计,自带收纳包,燃烧效率高,野外生火做饭神器。', want: '换 气炉', sales: 8, emoji: '🔥', size: '中型' },
{ id: 4, name: '露营入门指南', eng: 'Camping Guide', cat: 'moc', price: 29, rarity: 30, year: 2025, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '露营教练', tag: '新手必读', desc: '从营地选择到装备搭建,完全图解露营入门指南,让你从零开始享受户外。', want: '可换小配件', sales: 156, emoji: '📖', size: '电子版' },
{ id: 5, name: '房车旅行攻略', eng: 'RV Travel Guide', cat: 'moc', price: 45, rarity: 40, year: 2024, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '房车达人', tag: '路线推荐', desc: '房车旅行攻略,涵盖各热门路线、营地推荐、水电补给,让你的房车之旅更顺畅。', want: '换 车载充电', sales: 98, emoji: '🗺️', size: '电子版' },
{ id: 6, name: '露营车顶帐篷', eng: 'Roof Tent', cat: 'moc', price: 3600, rarity: 70, year: 2022, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '越野玩家', tag: '硬壳自动', desc: '车顶帐篷,硬壳自动升降,防暴雨防风,睡垫舒适,适合SUV和越野车,秒变星空房。', want: '换 侧边帐', sales: 5, emoji: '🛖', size: '双人' },
{ id: 7, name: '户外折叠椅', eng: 'Folding Camp Chair', cat: 'fig', price: 180, rarity: 35, year: 2024, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '休闲露营', tag: '铝合金', desc: '户外折叠椅,铝合金骨架,加厚牛津布,承重150kg,折叠收纳,使用舒适。', want: '换 折叠桌', sales: 30, emoji: '🪑', size: '便携' },
{ id: 8, name: '露营灯 充电式', eng: 'Camping Lantern', cat: 'fig', price: 120, rarity: 30, year: 2025, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '灯具专营', tag: '超长续航', desc: '充电露营灯,多档亮度,超长续航,带挂钩,防水防摔,夜间露营必备。', want: '换 头灯', sales: 25, emoji: '💡', size: '便携' },
{ id: 9, name: '户外折叠桌', eng: 'Folding Table', cat: 'fig', price: 220, rarity: 25, year: 2023, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '户外用品', tag: '轻便结实', desc: '铝合金折叠桌,超轻便携,桌面防滑,承重力强,适合露营野餐。', want: '换 椅子', sales: 20, emoji: '🛋️', size: '60x40' },
{ id: 10, name: '便携燃气炉', eng: 'Gas Stove', cat: 'tech', price: 280, rarity: 40, year: 2024, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '野炊装备', tag: '高效节能', desc: '便携燃气炉,电子打火,火力强劲,适配标准气罐,适合露营和车旅。', want: '换 柴火炉', sales: 15, emoji: '🔥', size: '便携' },
{ id: 11, name: '车载冰箱', eng: 'Car Fridge', cat: 'tech', price: 980, rarity: 55, year: 2022, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '房车配件', tag: '双温区', desc: '车载冰箱,12/24V通用,双温区冷冻冷藏,适合房车和自驾游,出行好帮手。', want: '换 电源', sales: 8, emoji: '🧊', size: '45L' },
{ id: 12, name: '户外电源站', eng: 'Power Station', cat: 'tech', price: 3600, rarity: 60, year: 2023, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '房车电源', tag: '大容量', desc: '户外电源站,容量1000Wh,支持太阳能充电,可给手机、冰箱、照明供电,露营必备。', want: '换 冰箱', sales: 6, emoji: '🔋', size: '1000Wh' },
{ id: 13, name: '营地车 折叠', eng: 'Camping Wagon', cat: 'street', price: 350, rarity: 30, year: 2024, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '营地装备', tag: '越野轮', desc: '营地折叠车,宽大越野轮,承重100kg,可推可拉,搬运装备省力方便。', want: '换 桌椅', sales: 18, emoji: '🛒', size: '大号' },
{ id: 14, name: '防潮垫 自动充气', eng: 'Auto Inflate Pad', cat: 'street', price: 180, rarity: 25, year: 2025, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '睡眠专家', tag: '舒适保暖', desc: '自动充气防潮垫,加厚保暖,表面绒面,舒适度高,收纳体积小,适合户外露营。', want: '换 睡袋', sales: 30, emoji: '🛏️', size: '单人' },
{ id: 15, name: '露营吊床', eng: 'Camping Hammock', cat: 'street', price: 120, rarity: 20, year: 2024, rating: 4.5, starStr: '⭐⭐⭐⭐', seller: '休闲户外', tag: '承重300斤', desc: '露营吊床,加宽加厚,承重300斤,配绑绳,收纳方便,适合树下休息。', want: '换 防潮垫', sales: 25, emoji: '🛝', size: '加宽' },
{ id: 16, name: '防水篷布 天幕', eng: 'Tarp', cat: 'classic', price: 180, rarity: 35, year: 2023, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '户外用品', tag: '防晒防雨', desc: '户外天幕篷布,加厚防水,防晒涂层,带挂绳地钉,适合搭建遮阳避雨区域。', want: '换 帐篷', sales: 12, emoji: '⛱️', size: '3x4m' },
{ id: 17, name: '户外炊具套装', eng: 'Cookware Set', cat: 'classic', price: 380, rarity: 50, year: 2022, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '野炊专家', tag: '含煎锅', desc: '户外炊具套装,含锅、煎锅、碗勺,氧化铝材质,轻便耐用,适合2-3人。', want: '换 炉头', sales: 10, emoji: '🍽️', size: '2-3人' },
{ id: 18, name: '户外急救包', eng: 'First Aid Kit', cat: 'classic', price: 60, rarity: 15, year: 2025, rating: 4.5, starStr: '⭐⭐⭐⭐', seller: '户外安全', tag: '全面配备', desc: '户外急救包,含创可贴、绷带、消毒液、止痛药等常用药品,安全保障。', want: '换 头灯', sales: 30, emoji: '🩹', size: '标准' }
];
// ---------------- 交换帖数据(8条写死) ----------------
const SWAPS: SwapItem[] = [
{ id: 1, user: '房车旅居者', avatar: '🚐', offer: '拖挂房车', want: '自行式房车', time: '今天 13:20', likes: 46, content: '拖挂换自行,可补差价,面交,诚心换。', place: '木兰营地' },
{ id: 2, user: '户外老驴', avatar: '⛺', offer: '四季帐篷', want: '双人帐篷', time: '今天 11:05', likes: 38, content: '四季换双人,都是好帐,可补差价,诚心换。', place: '江汉路站' },
{ id: 3, user: '野炊达人', avatar: '🔥', offer: '柴火炉', want: '气炉', time: '昨天 18:42', likes: 61, content: '柴火炉换气炉,都是炉具,可补差价,多换一好商量。', place: '洪山广场站' },
{ id: 4, user: '露营教练', avatar: '📖', offer: '露营入门指南', want: '任意配件', time: '昨天 15:30', likes: 29, content: '电子版教程免费换,换取任意有缘的露营配件,学生党优先。', place: '线上交换' },
{ id: 5, user: '越野玩家', avatar: '🛖', offer: '车顶帐篷', want: '侧边帐', time: '前天 20:15', likes: 22, content: '车顶帐换侧边帐,都是露营设备,可补差价,诚心换。', place: '楚河汉街站' },
{ id: 6, user: '休闲露营', avatar: '🪑', offer: '折叠椅', want: '折叠桌', time: '前天 09:50', likes: 41, content: '椅子换桌子,都是便携装备,补差价换,可聊聊看。', place: '线上互换' },
{ id: 7, user: '房车电源', avatar: '🔋', offer: '户外电源站', want: '车载冰箱', time: '3天前 22:08', likes: 55, content: '电源换冰箱,都是房车好物,愿补差价,面交优先。', place: '武昌火车站' },
{ id: 8, user: '露营新手', avatar: '🛝', offer: '吊床', want: '防潮垫', time: '4天前 14:26', likes: 17, content: '吊床换防潮垫,都是露营小件,学生党不容易,大家帮帮忙。', place: '线上交换' }
];
// ---------------- 教程/攻略数据(5条写死) ----------------
const GUIDES: GuideItem[] = [
{ id: 1, name: '露营入门指南', type: '入门', pages: 20, author: '露营教练', likes: 342, downloads: 2100, emoji: '📖', steps: ['帐篷搭建 1-8页', '生火技巧 9-15页', '安全事项 16-20页'] },
{ id: 2, name: '房车旅行攻略', type: '房车', pages: 50, author: '房车达人', likes: 276, downloads: 1580, emoji: '🗺️', steps: ['路线规划 1-15页', '营地选择 16-30页', '水电补给 31-50页'] },
{ id: 3, name: '户外烹饪技巧', type: '烹饪', pages: 30, author: '野炊达人', likes: 415, downloads: 3300, emoji: '🍳', steps: ['常见炊具 1-10页', '野外食谱 11-20页', '火候控制 21-30页'] },
{ id: 4, name: '电源站使用指南', type: '电源', pages: 15, author: '房车电源', likes: 198, downloads: 1260, emoji: '🔋', steps: ['基础操作 1-5页', '充电方法 6-10页', '保养维护 11-15页'] },
{ id: 5, name: '帐篷选购指南', type: '帐篷', pages: 25, author: '户外老驴', likes: 233, downloads: 1420, emoji: '⛺', steps: ['材质选择 1-8页', '尺寸参考 9-16页', '季节适用 17-25页'] }
];
// ---------------- 配件/周边数据(9条写死) ----------------
const ACCESSORIES: AccessoryItem[] = [
{ id: 1, name: '地钉套装', series: '钢制', price: 30, condition: '全新', seller: '户外配件', emoji: '📌', desc: '加粗钢钉,稳固抓地' },
{ id: 2, name: '防风绳', series: '反光', price: 20, condition: '全新', seller: '露营配件', emoji: '🪢', desc: '夜间反光,安全防风' },
{ id: 3, name: '折叠水桶', series: '10L', price: 40, condition: '全新', seller: '户外配件', emoji: '🪣', desc: '折叠收纳,易携带' },
{ id: 4, name: '露营灯串', series: 'LED', price: 60, condition: '9成新', seller: '露营灯具', emoji: '💡', desc: '暖光氛围,装饰露营' },
{ id: 5, name: '折叠桌', series: '铝合金', price: 220, condition: '全新', seller: '户外用品', emoji: '🛋️', desc: '轻便防滑,承重力强' },
{ id: 6, name: '炉头挡风板', series: '不锈钢', price: 35, condition: '全新', seller: '野炊配件', emoji: '🌬️', desc: '防风节能,折叠便携' },
{ id: 7, name: '气罐', series: '230g', price: 25, condition: '全新', seller: '户外耗材', emoji: '🫙', desc: '通用接口,高效燃烧' },
{ id: 8, name: '折叠铲', series: '工兵铲', price: 80, condition: '全新', seller: '户外工具', emoji: '⛏️', desc: '多功能,可挖可锯' },
{ id: 9, name: '防潮地席', series: '加厚', price: 50, condition: '全新', seller: '露营配件', emoji: '🧻', desc: '防水防潮,保护帐篷' }
];
// ---------------- 图鉴收藏数据(6条写死) ----------------
const COLLECTIONS: CollectionItem[] = [
{ id: 1, name: '房车', series: 'RV', owned: 2, total: 8, rate: 25, emoji: '🚐' },
{ id: 2, name: '帐篷', series: 'Tents', owned: 5, total: 15, rate: 33, emoji: '⛺' },
{ id: 3, name: '炊具', series: 'Cookware', owned: 6, total: 12, rate: 50, emoji: '🍳' },
{ id: 4, name: '露营灯', series: 'Lanterns', owned: 4, total: 10, rate: 40, emoji: '💡' },
{ id: 5, name: '户外椅', series: 'Chairs', owned: 8, total: 20, rate: 40, emoji: '🪑' },
{ id: 6, name: '电源设备', series: 'Power', owned: 3, total: 8, rate: 38, emoji: '🔋' }
];
// ---------------- 点评数据(3条写死) ----------------
const EQUIP_REVIEWS: EquipReview[] = [
{ id: 1, user: '房车玩家', setName: '拖挂房车', starStr: '⭐⭐⭐⭐⭐', content: '空间超大,设施齐全,旅居生活太舒服了,拖挂稳定性极佳。' },
{ id: 2, user: '露营新手', setName: '露营入门指南', starStr: '⭐⭐⭐⭐✨', content: '内容非常详细,第一次露营全靠它,顺利搭建帐篷,体验很好。' },
{ id: 3, user: '野炊爱好者', setName: '柴火炉', starStr: '⭐⭐⭐⭐⭐', content: '火力十足,折叠便携,野外做饭很有感觉,效率也很高。' }
];
// ---------------- 全城周交易量图表数据 ----------------
const TRADE_LABELS: string[] = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
const TRADE_BARS: number[] = [66, 54, 72, 58, 112, 146, 138];
// ---------------- 弹框选项 ----------------
const CONDITION_OPTIONS: string[] = ['全新未拆', '仅使用1次', '9成新', '8成新', '有磨损'];
const PLACES: string[] = ['木兰营地', '江汉路站', '洪山广场站', '楚河汉街站', '线上互换'];
// ---------------- 全局纯函数 ----------------
function catColor(cat: string): string {
if (cat === 'retired') return '#8D6E63';
if (cat === 'moc') return '#7C4DFF';
if (cat === 'fig') return '#558B2F';
if (cat === 'tech') return '#F9A825';
if (cat === 'street') return '#1E88E5';
return '#8D6E63';
}
function catLabel(cat: string): string {
if (cat === 'retired') return '顶级装备';
if (cat === 'moc') return '露营教程';
if (cat === 'fig') return '热门装备';
if (cat === 'tech') return '进阶装备';
if (cat === 'street') return '实用配件';
return '基础配件';
}
function rarityLabel(r: number): string {
if (r >= 95) return 'S级';
if (r >= 80) return 'A级';
if (r >= 60) return 'B级';
return 'C级';
}
function rarityColor(r: number): string {
if (r >= 95) return '#D32F2F';
if (r >= 80) return '#FF8A00';
if (r >= 60) return '#1E88E5';
return '#558B2F';
}
function tradeBarHeight(v: number): string {
return Math.round(v / 146 * 96).toString() + 'vp';
}
function rateColor(r: number): string {
if (r >= 55) return '#558B2F';
if (r >= 40) return '#F9A825';
return '#D32F2F';
}
function retiredSets(): EquipItem[] { return [EQUIPS[0], EQUIPS[1], EQUIPS[2]]; }
function mocSets(): EquipItem[] { return [EQUIPS[3], EQUIPS[4], EQUIPS[5]]; }
function figSets(): EquipItem[] { return [EQUIPS[6], EQUIPS[7], EQUIPS[8]]; }
function techSets(): EquipItem[] { return [EQUIPS[9], EQUIPS[10], EQUIPS[11]]; }
function streetSets(): EquipItem[] { return [EQUIPS[12], EQUIPS[13], EQUIPS[14]]; }
function classicSets(): EquipItem[] { return [EQUIPS[15], EQUIPS[16], EQUIPS[17]]; }
function cityLeft(): EquipItem[] { return [EQUIPS[16], EQUIPS[17]]; }
function cityRight(): EquipItem[] { return [EQUIPS[15]]; }
function hotSets(): EquipItem[] { return [EQUIPS[3], EQUIPS[5], EQUIPS[16], EQUIPS[17], EQUIPS[9]]; }
function swapBadge(likes: number): string {
if (likes >= 50) return '🔥热门';
if (likes >= 30) return '👍热度';
return '🌱新帖';
}
// ============================================================
// 主页面
// ============================================================
@Entry
@Component
struct Index {
@State currentBottomTab: number = 0;
@State currentTopTab: number = 0;
@State selectedEquipId: number = 1;
@State showSellModal: boolean = false;
@State showSwapModal: boolean = false;
@State showDeleteModal: boolean = false;
@State showDetailModal: boolean = false;
@State sellEquipIdx: number = 0;
@State sellCondIdx: number = 2;
@State sellPrice: number = 100;
@State sellWords: string = '';
@State swapOfferIdx: number = 0;
@State swapWantIdx: number = 1;
@State swapPlaceIdx: number = 0;
@State particles: ParticleItem[] = [];
private timerId: number = -1;
aboutToAppear(): void {
this.buildParticles();
this.timerId = setInterval(() => { this.driftParticles(); }, 80);
}
aboutToDisappear(): void {
if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; }
}
buildParticles(): void {
const emojis: string[] = ['🚐', '⛺', '🍳', '💡', '🪑'];
const list: ParticleItem[] = [];
for (let i = 0; i < 14; i++) {
list.push({ x: Math.random() * 340, emoji: emojis[i % emojis.length], size: 12 + Math.random() * 10, speed: 0.6 + Math.random() * 1.4, opacity: 0.2 + Math.random() * 0.4 });
}
this.particles = list;
}
driftParticles(): void {
for (let i = 0; i < this.particles.length; i++) {
this.particles[i].x += this.particles[i].speed;
if (this.particles[i].x > 360) { this.particles[i].x = -20; }
}
this.particles = this.particles.slice();
}
// 详情弹框数据取值
detailName(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].name; return ''; }
detailEng(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].eng; return ''; }
detailEmoji(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].emoji; return '🚐'; }
detailPrice(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return '¥' + EQUIPS[i].price.toString(); return ''; }
detailSize(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].size; return ''; }
detailRarity(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].rarity.toString(); return ''; }
detailYear(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].year.toString(); return ''; }
detailSeller(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].seller; return ''; }
detailTag(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].tag; return ''; }
detailStar(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].starStr; return ''; }
detailRating(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].rating.toFixed(1) + '分'; return ''; }
detailDesc(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].desc; return ''; }
detailWant(): string { for (let i = 0; i < EQUIPS.length; i++) if (EQUIPS[i].id === this.selectedEquipId) return EQUIPS[i].want; return ''; }
// ---------------- 头部 ----------------
@Builder
headerBuilder() {
Column() {
Row() {
Column() {
Text('🏕️ 旷野驿站').fontSize(22).fontWeight(FontWeight.Bold).fontColor('#FFFFFF')
Text('淘装备 · 换心头好 · 去远方').fontSize(11).fontColor('#E8D5C6').margin({ top: 3 })
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Row({ space: 14 }) {
Text('🔎').fontSize(20)
Text('📦').fontSize(20)
Column() {
Text('🎒').fontSize(20)
Text('3').fontSize(9).fontColor('#8D6E63').backgroundColor('#FFFFFF').borderRadius(6).padding({ left: 4, right: 4 }).margin({ top: -6 })
}.alignItems(HorizontalAlign.End)
}
}.width('100%').padding({ left: 16, right: 16, top: 14, bottom: 10 })
Row({ space: 8 }) {
Text('🔍 搜索:房车 / 帐篷 / 柴火炉').fontSize(12).fontColor('#D9C0B3').layoutWeight(1)
Text('🧰 我的求购').fontSize(11).fontColor('#8D6E63').backgroundColor('#FFFFFF').borderRadius(10).padding({ left: 10, right: 10, top: 4, bottom: 4 })
}.width('100%').padding({ left: 16, right: 16, bottom: 12 })
}
.linearGradient({ angle: 135, colors: [['#8D6E63', 0], ['#2E2E2E', 1]] })
.borderRadius({ bottomLeft: 18, bottomRight: 18 })
}
// ---------------- 顶部Tab ----------------
@Builder
topTabsBuilder() {
Row() {
ForEach(TOP_TABS, (t: TabItem, idx: number) => {
Column() {
Text(t.icon).fontSize(17)
Text(t.label).fontSize(12).fontColor(this.currentTopTab === idx ? '#8D6E63' : '#8D8D8D').fontWeight(this.currentTopTab === idx ? FontWeight.Bold : FontWeight.Normal).margin({ top: 2 })
if (this.currentTopTab === idx) {
Divider().width(16).strokeWidth(3).color('#558B2F').borderRadius(2).margin({ top: 4 })
} else {
Divider().width(16).strokeWidth(3).color('#F5F2EC').borderRadius(2).margin({ top: 4 })
}
}.layoutWeight(1).alignItems(HorizontalAlign.Center).padding({ top: 10, bottom: 6 }).onClick(() => { this.currentTopTab = idx; })
}, (t: TabItem, idx: number) => 'top' + idx.toString() + t.label)
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).margin({ top: 10 })
}
// ---------------- 全部Tab:banner + 双列瀑布 ----------------
@Builder
cityContent() {
Column({ space: 12 }) {
Column() {
Text('🏕️ 野外装备节 · 春季专场').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Text('顶级装备 3天限时 · 卖家免服务费').fontSize(12).fontColor('#8D8D8D').margin({ top: 6 })
Row({ space: 10 }) {
Text('🏆 顶级装备').fontSize(11).fontColor('#8D6E63').backgroundColor('#FFFFFF').borderRadius(12).padding({ left: 10, right: 10, top: 4, bottom: 4 })
Text('🚐 房车专区').fontSize(11).fontColor('#8D6E63').backgroundColor('#FFFFFF').borderRadius(12).padding({ left: 10, right: 10, top: 4, bottom: 4 })
}.margin({ top: 10 })
}.width('100%').padding(18).alignItems(HorizontalAlign.Start).linearGradient({ angle: 120, colors: [['#F9A825', 0], ['#FFD54F', 1]] }).borderRadius(16)
Text('✨ 全城新上架').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(cityLeft(), (t: EquipItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 16 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#8D8D8D').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#8D8D8D').margin({ top: 8 }).maxLines(3).textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(15).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
Text(t.tag).fontSize(9).fontColor('#558B2F').backgroundColor('#E8F5E9').borderRadius(8).padding({ left: 6, right: 6, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 14 })
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).alignItems(HorizontalAlign.Start).padding({ left: 14, right: 14 })
.onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem) => 'cl' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
ForEach(cityRight(), (t: EquipItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 24 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#8D8D8D').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#8D8D8D').margin({ top: 10 }).maxLines(4).textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(15).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
Text(t.starStr).fontSize(10)
}.margin({ top: 12, bottom: 20 })
}.width('100%').backgroundColor('#F0EAD8').borderRadius(14).alignItems(HorizontalAlign.Start).padding({ left: 14, right: 14 })
.onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem) => 'cr' + t.id.toString())
}.layoutWeight(1)
}.width('100%').alignItems(VerticalAlign.Top)
}.width('100%').padding({ left: 14, right: 14, top: 10, bottom: 16 })
}
// ---------------- 房车Tab:横滑大卡 + 稀有度柱状图 + 捡漏榜 ----------------
@Builder
retiredContent() {
Column({ space: 14 }) {
Text('🏆 顶级装备专区').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Scroll() {
Row({ space: 12 }) {
ForEach(retiredSets(), (t: EquipItem) => {
Column() {
Text(t.emoji).fontSize(40).margin({ top: 18 })
Text(t.name).fontSize(15).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 8 })
Text(t.eng + ' · ' + t.year.toString() + '年').fontSize(9).fontColor('#E8D5C6').margin({ top: 4 })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD54F')
Text(rarityLabel(t.rarity)).fontSize(10).fontColor('#8D6E63').backgroundColor('#FFD54F').borderRadius(8).padding({ left: 6, right: 6, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width(160).linearGradient({ angle: 160, colors: [['#8D6E63', 0], ['#2E2E2E', 1]] }).borderRadius(16).alignItems(HorizontalAlign.Center)
.onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem) => 'rt' + t.id.toString())
}.padding({ left: 14, right: 14 })
}.scrollable(ScrollDirection.Horizontal).scrollBar(BarState.Off).width('100%')
Column() {
Text('📈 稀有度排行').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Row({ space: 6 }) {
ForEach(retiredSets(), (t: EquipItem, i: number) => {
Column({ space: 5 }) {
Text(t.rarity.toString()).fontSize(9).fontColor('#8D6E63')
Column().width(34).height((t.rarity).toString() + 'vp').backgroundColor(i === 2 ? '#D32F2F' : '#8D6E63').borderRadius({ topLeft: 5, topRight: 5 })
Text(t.year.toString() + '年').fontSize(9).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Center).layoutWeight(1)
}, (t: EquipItem, i: number) => 'rb' + i.toString() + t.id.toString())
}.width('100%').justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Bottom).padding({ top: 12 })
Text('拖挂房车以90分稀有度登顶,市面流通极少').fontSize(10).fontColor('#8D8D8D').margin({ top: 8 })
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14).margin({ left: 14, right: 14 })
Column() {
Text('🕵️ 今日捡漏榜').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ bottom: 8 })
ForEach(retiredSets(), (t: EquipItem, i: number) => {
Row({ space: 10 }) {
Text((i + 1).toString()).fontSize(14).fontWeight(FontWeight.Bold).fontColor(i === 0 ? '#D32F2F' : '#8D8D8D').width(20)
Text(t.emoji).fontSize(18)
Column() {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(rarityLabel(t.rarity) + ' · ' + t.want).fontSize(10).fontColor('#8D8D8D').margin({ top: 2 })
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
}.width('100%').padding({ top: 8, bottom: 8 }).onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem, i: number) => 'pck' + i.toString() + t.id.toString())
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14).margin({ left: 14, right: 14, bottom: 16 })
}.width('100%').alignItems(HorizontalAlign.Start).padding({ top: 10 })
}
// ---------------- 帐篷Tab:教程时间轴 ----------------
@Builder
mocContent() {
Column({ space: 0 }) {
Text('📖 野外教程 · 干货满满').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ top: 10, bottom: 12 })
ForEach(GUIDES, (m: GuideItem, i: number) => {
Row({ space: 12 }) {
Column({ space: 4 }) {
Text(m.emoji).fontSize(20)
if (i < GUIDES.length - 1) {
Column().width(2).layoutWeight(1).backgroundColor('#558B2F').margin({ top: 4 })
}
}.width(40).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) {
Row({ space: 8 }) {
Text(m.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').layoutWeight(1)
Text('⬇ ' + m.downloads.toString()).fontSize(10).fontColor('#8D6E63')
}.width('100%')
Text('by ' + m.author + ' · ' + m.type + ' · ' + m.pages.toString() + '页').fontSize(10).fontColor('#8D8D8D')
Column({ space: 5 }) {
ForEach(m.steps, (s: string, si: number) => {
Row({ space: 8 }) {
Text((si + 1).toString()).fontSize(9).fontWeight(FontWeight.Bold).fontColor('#558B2F').backgroundColor('#F5F2EC').borderRadius(9).width(18).height(18).textAlign(TextAlign.Center)
Text(s).fontSize(10).fontColor('#4A5A6E').layoutWeight(1)
}.width('100%')
}, (s: string, si: number) => 'ms' + si.toString() + m.id.toString())
}.width('100%').backgroundColor('#F5F2EC').borderRadius(10).padding(10)
Row({ space: 8 }) {
Text('❤️ ' + m.likes.toString()).fontSize(10).fontColor('#D32F2F')
Text(m.emoji + ' 教程可下载').fontSize(10).fontColor('#558B2F').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.layoutWeight(1).backgroundColor(i === 1 ? '#F0EAD8' : '#FFFFFF').borderRadius(14).padding(12).margin({ bottom: 14 })
}.width('100%').alignItems(VerticalAlign.Top)
}, (m: GuideItem, i: number) => 'moc' + i.toString() + m.id.toString())
}.width('100%').padding({ left: 14, right: 14, bottom: 16 })
}
// ---------------- 炊具Tab:三列格子 + 交换建议 ----------------
@Builder
figContent() {
Column({ space: 14 }) {
Text('🍳 配件周边 · 户外必带').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) {
ForEach(ACCESSORIES, (f: AccessoryItem) => {
Column() {
Text(f.emoji).fontSize(26).margin({ top: 12 })
Text(f.name).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').margin({ top: 6 }).maxLines(1)
Text(f.series).fontSize(8).fontColor('#8D8D8D').margin({ top: 2 })
Text('¥' + f.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#D32F2F').margin({ top: 4, bottom: 12 })
}.width('31%').backgroundColor('#FFFFFF').borderRadius(12).alignItems(HorizontalAlign.Center).margin({ bottom: 8 })
.onClick(() => { this.selectedEquipId = 7 + f.id % 3; this.showDetailModal = true; })
}, (f: AccessoryItem) => 'fg' + f.id.toString())
}.width('100%')
Column() {
Text('🤝 配件交换行情').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ bottom: 6 })
ForEach(ACCESSORIES, (f: AccessoryItem) => {
if (f.id % 2 === 0) {
Row({ space: 10 }) {
Text(f.emoji).fontSize(20)
Column({ space: 2 }) {
Text(f.name + ' · ' + f.condition).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(f.desc).fontSize(10).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + f.price.toString()).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#558B2F')
}.width('100%').padding({ top: 8, bottom: 8 })
}
}, (f: AccessoryItem) => 'fgx' + f.id.toString())
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
}.width('100%').padding({ left: 14, right: 14, top: 10, bottom: 16 })
}
// ---------------- 露营灯Tab:对决卡 + 侧栏统计 ----------------
@Builder
techContent() {
Column({ space: 14 }) {
Text('💡 装备对决 · 户外必备').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Row({ space: 10 }) {
Column() {
Text('🚐').fontSize(34).margin({ top: 14 })
Text('拖挂房车').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('2020年 · 现价¥128000').fontSize(10).fontColor('#E8D5C6').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#8D6E63', 0], ['#2E2E2E', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
Column() {
Text('VS').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Text('本周').fontSize(9).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Center)
Column() {
Text('⛺').fontSize(34).margin({ top: 14 })
Text('四季帐篷').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('2021年 · 现价¥2400').fontSize(10).fontColor('#E8D5C6').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#8D8D8D', 0], ['#2E2E2E', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
}.width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(techSets(), (t: EquipItem) => {
Row({ space: 10 }) {
Text(t.emoji).fontSize(22)
Column({ space: 2 }) {
Text(t.name).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(t.tag + ' · ' + t.size).fontSize(10).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
}.width('100%').backgroundColor('#FFFFFF').borderRadius(12).padding(12).onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem) => 'tc' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
Column({ space: 4 }) {
Text('12').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Text('本周装备成交').fontSize(9).fontColor('#8D8D8D')
}.width('100%').backgroundColor('#F0EAD8').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('3.2万').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#F9A825')
Text('装备总交易额').fontSize(9).fontColor('#8D8D8D')
}.width('100%').backgroundColor('#FFF8E1').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('96%').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#558B2F')
Text('好评率').fontSize(9).fontColor('#8D8D8D')
}.width('100%').backgroundColor('#FFFFFF').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
}.width(86)
}.width('100%').alignItems(VerticalAlign.Top)
}.width('100%').padding({ left: 14, right: 14, top: 10, bottom: 16 })
}
// ---------------- 户外椅Tab:标签云 + 紧凑列表 ----------------
@Builder
streetContent() {
Column({ space: 14 }) {
Text('🪑 配件周边 · 享受户外').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
ForEach(COLLECTIONS, (c: CollectionItem) => {
Text(c.emoji + ' ' + c.name + ' ' + c.owned.toString() + '/' + c.total.toString()).fontSize(11).fontColor('#8D6E63').backgroundColor('#F0EAD8').borderRadius(12).padding({ left: 10, right: 10, top: 6, bottom: 6 }).margin(4)
}, (c: CollectionItem) => 'ccoll' + c.id.toString())
}.width('100%')
ForEach(streetSets(), (t: EquipItem) => {
Row({ space: 12 }) {
Text(t.emoji).fontSize(24)
Column({ space: 2 }) {
Row({ space: 6 }) {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(rarityLabel(t.rarity)).fontSize(8).fontColor('#FFFFFF').backgroundColor(rarityColor(t.rarity)).borderRadius(6).padding({ left: 5, right: 5, top: 1, bottom: 1 })
}
Text(t.desc).fontSize(10).fontColor('#8D8D8D').maxLines(1).textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
}.width('100%').backgroundColor(t.id === 15 ? '#F0EAD8' : '#FFFFFF').borderRadius(12).padding(12).onClick(() => { this.selectedEquipId = t.id; this.showDetailModal = true; })
}, (t: EquipItem) => 'st' + t.id.toString())
Text('💬 集齐三大装备可召唤隐藏福利:房车+帐篷+炊具').fontSize(10).fontColor('#8D8D8D').width('100%')
}.width('100%').padding({ left: 14, right: 14, top: 10, bottom: 16 })
}
// ---------------- 装备首页 ----------------
@Builder
bazaarContent() {
Column() {
this.topTabsBuilder()
if (this.currentTopTab === 0) { this.cityContent() }
else if (this.currentTopTab === 1) { this.retiredContent() }
else if (this.currentTopTab === 2) { this.mocContent() }
else if (this.currentTopTab === 3) { this.figContent() }
else if (this.currentTopTab === 4) { this.techContent() }
else { this.streetContent() }
}.width('100%')
}
// ---------------- 换件页 ----------------
@Builder
swapContent() {
Column({ space: 12 }) {
Row({ space: 0 }) {
Column({ space: 4 }) { Text('156').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#8D6E63'); Text('在交换中').fontSize(10).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('42').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#F9A825'); Text('今日成交').fontSize(10).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('98%').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#558B2F'); Text('面交好评').fontSize(10).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) { Text('🤝 发交换').fontSize(12).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius(14).padding({ left: 12, right: 12, top: 6, bottom: 6 }).onClick(() => { this.showSwapModal = true; }) }.alignItems(HorizontalAlign.Center)
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding({ top: 14, bottom: 14 })
ForEach(SWAPS, (s: SwapItem) => {
Column({ space: 8 }) {
Row({ space: 10 }) {
Text(s.avatar).fontSize(26)
Column({ space: 2 }) {
Row({ space: 6 }) {
Text(s.user).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(swapBadge(s.likes)).fontSize(8).fontColor('#F9A825').backgroundColor('#FFF8E1').borderRadius(6).padding({ left: 5, right: 5, top: 1, bottom: 1 })
}
Text(s.time + ' · ' + s.place).fontSize(9).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('⋯').fontSize(16).fontColor('#8D8D8D').onClick(() => { this.showDeleteModal = true; })
}.width('100%')
Row({ space: 10 }) {
Column({ space: 4 }) { Text('我提供').fontSize(9).fontColor('#8D6E63'); Text(s.offer).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#2E2E2E') }.layoutWeight(1).backgroundColor('#F0EAD8').borderRadius(10).padding(8).alignItems(HorizontalAlign.Center)
Text('⇄').fontSize(14).fontColor('#558B2F')
Column({ space: 4 }) { Text('我想换').fontSize(9).fontColor('#D32F2F'); Text(s.want).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#2E2E2E') }.layoutWeight(1).backgroundColor('#F0EAD8').borderRadius(10).padding(8).alignItems(HorizontalAlign.Center)
}.width('100%')
Text(s.content).fontSize(11).fontColor('#4A5A6E').lineHeight(16).width('100%')
Row({ space: 8 }) {
Text('📍 ' + s.place).fontSize(10).fontColor('#8D6E63').backgroundColor('#F5F2EC').borderRadius(10).padding({ left: 8, right: 8, top: 4, bottom: 4 })
Text('❤️ ' + s.likes.toString()).fontSize(10).fontColor('#D32F2F').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
}, (s: SwapItem) => 'sw' + s.id.toString())
}.width('100%').padding({ left: 14, right: 14, top: 10, bottom: 16 })
}
// ---------------- 图鉴页 ----------------
@Builder
collectionContent() {
Column({ space: 12 }) {
Row({ space: 10 }) {
Column({ space: 4 }) {
Text('📖 我的户外图鉴').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Text('记录每一件装备的收藏进度').fontSize(10).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('✚ 登记').fontSize(12).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius(14).padding({ left: 14, right: 14, top: 7, bottom: 7 }).onClick(() => { this.showSellModal = true; })
}.width('100%').margin({ top: 10 })
ForEach(COLLECTIONS, (c: CollectionItem) => {
Column({ space: 8 }) {
Row({ space: 10 }) {
Text(c.emoji).fontSize(28)
Column({ space: 3 }) {
Text(c.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text(c.series + ' · 已收 ' + c.owned.toString() + '/' + c.total.toString()).fontSize(10).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text(c.rate.toString() + '%').fontSize(15).fontWeight(FontWeight.Bold).fontColor(rateColor(c.rate))
}.width('100%')
Row({ space: 0 }) {
Column().width(c.rate.toString() + '%').height(6).backgroundColor(rateColor(c.rate)).borderRadius(3)
Column().width((100 - c.rate).toString() + '%').height(6).backgroundColor('#E5E0D8').borderRadius(3)
}.width('100%')
}.width('100%').backgroundColor(c.id === 5 ? '#FFF8E1' : '#FFFFFF').borderRadius(14).padding(14)
}, (c: CollectionItem) => 'coll' + c.id.toString())
Column() {
Text('🏅 图鉴成就墙').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ bottom: 8 })
Flex({ wrap: FlexWrap.Wrap }) {
Text('🎖️ 野外达人').fontSize(10).fontColor('#8D6E63').backgroundColor('#F0EAD8').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🏆 房车旅居者').fontSize(10).fontColor('#F9A825').backgroundColor('#FFF8E1').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('⛺ 帐篷收藏家').fontSize(10).fontColor('#558B2F').backgroundColor('#E8F5E9').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🍳 野炊专家').fontSize(10).fontColor('#D32F2F').backgroundColor('#FFEBEE').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
}.width('100%')
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
}.width('100%').padding({ left: 14, right: 14, bottom: 16 })
}
// ---------------- 我的页 ----------------
@Builder
mineContent() {
Column({ space: 14 }) {
Column() {
Row({ space: 12 }) {
Text('🚐').fontSize(40)
Column({ space: 4 }) {
Text('户外收藏家老野').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFFFFF')
Text('LV.10 资深户外人 · 信用分 990').fontSize(10).fontColor('#E8D5C6')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('>').fontSize(18).fontColor('#E8D5C6')
}.width('100%')
Row({ space: 0 }) {
Column({ space: 3 }) { Text('38').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD54F'); Text('在售装备').fontSize(9).fontColor('#E8D5C6') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('12').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD54F'); Text('求购中').fontSize(9).fontColor('#E8D5C6') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('¥5.8万').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD54F'); Text('累计成交额').fontSize(9).fontColor('#E8D5C6') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').margin({ top: 16 })
}.width('100%').padding(18).linearGradient({ angle: 120, colors: [['#8D6E63', 0], ['#2E2E2E', 1]] }).borderRadius(16).margin({ top: 10 })
Column() {
Text('🔨 我的求购清单').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ bottom: 6 })
ForEach(EQUIPS, (t: EquipItem) => {
if (t.id === 13 || t.id === 16 || t.id === 18) {
Row({ space: 10 }) {
Text(t.emoji).fontSize(20)
Column({ space: 2 }) {
Text(t.name).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#2E2E2E')
Text('预算 ¥' + t.price.toString() + ' 内 · ' + t.want).fontSize(9).fontColor('#8D8D8D')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('出价中').fontSize(10).fontColor('#F9A825').backgroundColor('#FFF8E1').borderRadius(10).padding({ left: 8, right: 8, top: 3, bottom: 3 })
}.width('100%').padding({ top: 9, bottom: 9 })
}
}, (t: EquipItem) => 'wish' + t.id.toString())
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
Column() {
Text('📍 常去面交点').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%').margin({ bottom: 6 })
ForEach(PLACES, (p: string, i: number) => {
Row({ space: 10 }) {
Text(['🚇', '🏬', '🚌', '🏪', '📦'][i]).fontSize(16)
Text(p).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').layoutWeight(1)
Text(['木兰营地', '江汉路天桥', '洪山转盘', '楚河入口', '顺丰网点'][i]).fontSize(9).fontColor('#8D8D8D')
}.width('100%').padding({ top: 9, bottom: 9 })
}, (p: string, i: number) => 'pl' + i.toString() + p)
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
}.width('100%').padding({ left: 14, right: 14, bottom: 16 })
}
// ---------------- 底部Tab ----------------
@Builder
bottomTabsBuilder() {
Row() {
ForEach(BOTTOM_TABS, (t: TabItem, idx: number) => {
Column({ space: 3 }) {
Text(t.icon).fontSize(20)
Text(t.label).fontSize(10).fontColor(this.currentBottomTab === idx ? '#8D6E63' : '#8D8D8D').fontWeight(this.currentBottomTab === idx ? FontWeight.Bold : FontWeight.Normal)
}.layoutWeight(1).alignItems(HorizontalAlign.Center).padding({ top: 8, bottom: 8 }).onClick(() => { this.currentBottomTab = idx; })
}, (t: TabItem, idx: number) => 'bt' + idx.toString() + t.label)
}.width('100%').backgroundColor('#FFFFFF').borderRadius({ topLeft: 18, topRight: 18 })
}
// ---------------- 弹框1:发布出售(新增·棕渐变头) ----------------
@Builder
sellModalBuilder() {
Column() {
Column() {
Text('🏕️ 发布出售').fontSize(17).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 16 })
Text('闲置回血,神装不愁卖').fontSize(11).fontColor('#E8D5C6').margin({ top: 4, bottom: 16 })
}.width('100%').linearGradient({ angle: 120, colors: [['#8D6E63', 0], ['#2E2E2E', 1]] }).borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('要出售的装备').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(EQUIPS, (t: EquipItem, i: number) => {
if (i < 8) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.sellEquipIdx === i ? '#FFFFFF' : '#8D6E63').backgroundColor(this.sellEquipIdx === i ? '#8D6E63' : '#F0EAD8').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.sellEquipIdx = i; })
}
}, (t: EquipItem, i: number) => 'st' + i.toString() + t.id.toString())
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Column({ space: 8 }) {
Text('成色说明').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(CONDITION_OPTIONS, (c: string, i: number) => {
Text(c).fontSize(10).fontColor(this.sellCondIdx === i ? '#FFFFFF' : '#F9A825').backgroundColor(this.sellCondIdx === i ? '#F9A825' : '#FFF8E1').borderRadius(12).padding({ left: 10, right: 10, top: 5, bottom: 5 }).margin(4).onClick(() => { this.sellCondIdx = i; })
}, (c: string, i: number) => 'sd' + i.toString() + c)
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 12 }) {
Text('出售价格').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Row({ space: 0 }) {
Text('−').fontSize(16).fontColor('#8D6E63').backgroundColor('#F0EAD8').borderRadius({ topLeft: 10, bottomLeft: 10 }).width(34).height(30).textAlign(TextAlign.Center).onClick(() => { if (this.sellPrice > 10) { this.sellPrice -= 10; } })
Text('¥' + this.sellPrice.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').backgroundColor('#FFFFFF').height(30).textAlign(TextAlign.Center).padding({ left: 14, right: 14 })
Text('+').fontSize(16).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius({ topRight: 10, bottomRight: 10 }).width(34).height(30).textAlign(TextAlign.Center).onClick(() => { if (this.sellPrice < 99999) { this.sellPrice += 10; } })
}.borderRadius(10)
Text(this.sellPrice > 20000 ? '💰 高价好物建议包邮' : '实惠价更容易出手').fontSize(9).fontColor(this.sellPrice > 20000 ? '#D32F2F' : '#8D8D8D').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
Column({ space: 8 }) {
Text('宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
TextInput({ placeholder: '成色、瑕疵、配件情况如实描述…', text: this.sellWords }).fontSize(12).fontColor('#2E2E2E').backgroundColor('#F5F2EC').borderRadius(10).height(40).padding({ left: 12, right: 12 }).onChange((v: string) => { this.sellWords = v; })
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 12 }) {
Text('取消').fontSize(13).fontColor('#8D8D8D').backgroundColor('#F5F2EC').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSellModal = false; })
Text('上架出售').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSellModal = false; })
}.width('100%').margin({ top: 4, bottom: 18 })
}.width('100%').padding({ left: 16, right: 16, top: 16 })
}.scrollBar(BarState.Off).layoutWeight(1).align(Alignment.Top)
}.width('88%').height('76%').backgroundColor('#FFFFFF').borderRadius(18).clip(true)
}
// ---------------- 弹框2:发起交换(新增·绿头) ----------------
@Builder
swapModalBuilder() {
Column() {
Column() {
Row({ space: 8 }) { Text('🤝').fontSize(22); Text('发起交换').fontSize(17).fontWeight(FontWeight.Bold).fontColor('#2E2E2E') }.margin({ top: 16 })
Text('用闲置换心头好,驴友互助').fontSize(11).fontColor('#5B6B7F').margin({ top: 4, bottom: 14 })
}.width('100%').backgroundColor('#558B2F').borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('我提供').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(EQUIPS, (t: EquipItem, i: number) => {
if (i % 3 === 0 && i < 15) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.swapOfferIdx === i ? '#FFFFFF' : '#8D6E63').backgroundColor(this.swapOfferIdx === i ? '#2E2E2E' : '#F5F2EC').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.swapOfferIdx = i; })
}
}, (t: EquipItem, i: number) => 'wo' + i.toString() + t.id.toString())
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Column({ space: 8 }) {
Text('我想换(可多选)').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(EQUIPS, (t: EquipItem, i: number) => {
if (i % 3 === 2 && i < 15) {
Text((this.pickedWant(i) ? '✓ ' : '') + t.emoji + ' ' + t.name).fontSize(10).fontColor(this.pickedWant(i) ? '#FFFFFF' : '#D32F2F').backgroundColor(this.pickedWant(i) ? '#D32F2F' : '#F0EAD8').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.toggleWant(i); })
}
}, (t: EquipItem, i: number) => 'ww' + i.toString() + t.id.toString())
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Column({ space: 8 }) {
Text('面交地点').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(PLACES, (p: string, i: number) => {
Text(p).fontSize(10).fontColor(this.swapPlaceIdx === i ? '#FFFFFF' : '#8D6E63').backgroundColor(this.swapPlaceIdx === i ? '#8D6E63' : '#F0EAD8').borderRadius(12).padding({ left: 10, right: 10, top: 5, bottom: 5 }).margin(4).onClick(() => { this.swapPlaceIdx = i; })
}, (p: string, i: number) => 'wp' + i.toString() + p)
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 8 }) {
Text('💡').fontSize(14)
Text('交换双方可自行协商补差价,面交请选择人流密集的公共场所,注意安全。').fontSize(10).fontColor('#8D8D8D').lineHeight(15).layoutWeight(1)
}.width('100%').backgroundColor('#F0EAD8').borderRadius(10).padding(10)
Row({ space: 12 }) {
Text('再想想').fontSize(13).fontColor('#8D8D8D').backgroundColor('#F5F2EC').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSwapModal = false; })
Text('发布交换帖').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSwapModal = false; })
}.width('100%').margin({ top: 4, bottom: 18 })
}.width('100%').padding({ left: 16, right: 16, top: 16 })
}.scrollBar(BarState.Off).layoutWeight(1).align(Alignment.Top)
}.width('88%').height('72%').backgroundColor('#FFFFFF').borderRadius(18).clip(true)
}
// ---------------- 弹框3:下架/删除 ----------------
@Builder
deleteModalBuilder() {
Column({ space: 14 }) {
Text('🗑️').fontSize(36)
Text('下架这件装备?').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#8D6E63')
Text('下架后买家将无法搜索到这条信息,\n收藏和留言会一并清空,可重新上架。').fontSize(11).fontColor('#8D8D8D').textAlign(TextAlign.Center).lineHeight(17)
Row({ space: 12 }) {
Text('留着').fontSize(13).fontColor('#8D6E63').backgroundColor('#F0EAD8').borderRadius(20).layoutWeight(1).height(40).textAlign(TextAlign.Center).onClick(() => { this.showDeleteModal = false; })
Text('确认下架').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#D32F2F').borderRadius(20).layoutWeight(1).height(40).textAlign(TextAlign.Center).onClick(() => { this.showDeleteModal = false; })
}.width('100%').margin({ top: 6 })
}.width('72%').backgroundColor('#FFFFFF').borderRadius(18).padding({ left: 20, right: 20, top: 24, bottom: 22 }).alignItems(HorizontalAlign.Center)
}
// ---------------- 弹框4:装备详情(棕绿渐变头) ----------------
@Builder
detailModalBuilder() {
Column() {
Column() {
Text(this.detailEmoji()).fontSize(40).margin({ top: 18 })
Text(this.detailName()).fontSize(18).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').margin({ top: 8 })
Text(this.detailEng()).fontSize(10).fontColor('#8D8D8D').margin({ top: 2 })
Row({ space: 8 }) {
Text(this.detailTag()).fontSize(9).fontColor('#FFFFFF').backgroundColor('#8D6E63').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
Text(rarityLabel(Number(this.detailRarity()))).fontSize(9).fontColor('#2E2E2E').backgroundColor('#FFD54F').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width('100%').linearGradient({ angle: 135, colors: [['#FFD54F', 0], ['#F0EAD8', 1]] }).borderRadius({ topLeft: 18, topRight: 18 }).alignItems(HorizontalAlign.Center)
Scroll() {
Column({ space: 14 }) {
Row({ space: 0 }) {
Column({ space: 4 }) { Text(this.detailPrice()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#D32F2F'); Text('售价').fontSize(9).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailSize()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#8D6E63'); Text('规格').fontSize(9).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailRarity()).fontSize(17).fontWeight(FontWeight.Bold).fontColor(rarityColor(Number(this.detailRarity()))); Text('稀有度').fontSize(9).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailYear()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#F9A825'); Text('年份').fontSize(9).fontColor('#8D8D8D') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').backgroundColor('#F5F2EC').borderRadius(12).padding({ top: 12, bottom: 12 })
Column({ space: 8 }) {
Text('🧾 宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#2E2E2E').width('100%')
Text(this.detailDesc()).fontSize(11).fontColor('#4A5A6E').lineHeight(18)
Row({ space: 8 }) {
Text('👤 ' + this.detailSeller()).fontSize(10).fontColor('#8D6E63')
Text(this.detailStar() + ' ' + this.detailRating()).fontSize(10).fontColor('#F9A825').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 8 }) {
Text('🤝').fontSize(14)
Text('卖家想换:' + this.detailWant()).fontSize(11).fontColor('#D32F2F').layoutWeight(1)
}.width('100%').backgroundColor('#F0EAD8').borderRadius(10).padding(10)
Column({ space: 10 }) {
Text('💬 圈友点评').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#8D6E63').width('100%')
ForEach(EQUIP_REVIEWS, (r: EquipReview) => {
Column({ space: 5 }) {
Row({ space: 8 }) { Text('👤').fontSize(14); Text(r.user).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#2E2E2E'); Text(r.starStr).fontSize(9).layoutWeight(1).textAlign(TextAlign.End) }.width('100%')
Text(r.content).fontSize(10).fontColor('#8D8D8D').lineHeight(15)
}.width('100%').backgroundColor('#F5F2EC').borderRadius(10).padding(10)
}, (r: EquipReview) => 'rv' + r.id.toString())
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 12 }) {
Text('💬 留言问问').fontSize(13).fontColor('#8D6E63').backgroundColor('#F0EAD8').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showDetailModal = false; })
Text('🛒 立即购买').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#D32F2F').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showDetailModal = false; })
}.width('100%').margin({ top: 2, bottom: 18 })
}.width('100%').padding({ left: 16, right: 16, top: 14 })
}.scrollBar(BarState.Off).layoutWeight(1).align(Alignment.Top)
}.width('88%').height('78%').backgroundColor('#FFFFFF').borderRadius(18).clip(true)
}
// 交换多选辅助
pickedWant(i: number): boolean { return (i % 2) === 0; }
toggleWant(i: number): void { this.swapWantIdx = i; }
// ---------------- 主布局 ----------------
build() {
Stack() {
Column() {
this.headerBuilder()
Scroll() {
Column() {
if (this.currentBottomTab === 0) { this.bazaarContent() }
else if (this.currentBottomTab === 1) { this.swapContent() }
else if (this.currentBottomTab === 2) { this.collectionContent() }
else { this.mineContent() }
}.width('100%')
}.layoutWeight(1).scrollBar(BarState.Off).align(Alignment.Top)
this.bottomTabsBuilder()
}.width('100%').height('100%')
ForEach(this.particles, (p: ParticleItem, i: number) => {
Text(p.emoji).fontSize(p.size).opacity(p.opacity).position({ x: p.x, y: 80 + (i % 5) * 118 })
}, (p: ParticleItem, i: number) => 'pt' + i.toString())
if (this.showDetailModal) {
Column() { this.detailModalBuilder() }.width('100%').height('100%').backgroundColor('99000000').justifyContent(FlexAlign.Center).onClick(() => { this.showDetailModal = false; })
}
if (this.showSellModal) {
Column() { this.sellModalBuilder() }.width('100%').height('100%').backgroundColor('99000000').justifyContent(FlexAlign.Center).onClick(() => { this.showSellModal = false; })
}
if (this.showSwapModal) {
Column() { this.swapModalBuilder() }.width('100%').height('100%').backgroundColor('99000000').justifyContent(FlexAlign.Center).onClick(() => { this.showSwapModal = false; })
}
if (this.showDeleteModal) {
Column() { this.deleteModalBuilder() }.width('100%').height('100%').backgroundColor('99000000').justifyContent(FlexAlign.Center).onClick(() => { this.showDeleteModal = false; })
}
}.width('100%').height('100%').backgroundColor(PALETTE.bg)
}
}
Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐