从万智牌老圈到宝可梦初代卡包,从三国杀豪华版到青眼白龙闪卡,从乐高老友记到艾斯手办——本文以一套完整的ArkTS玩乐仓库应用为例,深度解析HarmonyOS ArkTS API 24在潮玩电竞风二手交易场景下的双Tab嵌套架构、14粒子漂浮动效、S/A/B/C四级稀有度分级、荧光紫亮蓝详情头、以卡换卡交换帖等核心技术实现。

一、引言

卡牌、桌游、手办、拼图、周边、盲盒——这些承载着潮玩人收藏梦想的好物,在潮玩热潮下焕发了新的生机。从万智牌老圈到宝可梦初代卡包,从三国杀豪华版到青眼白龙闪卡,从乐高老友记到艾斯手办,潮玩二手交易已经成为一个庞大的收藏市场。然而潮玩交易长期依赖闲鱼、转转等泛平台,缺乏针对潮玩人的专业化功能——装备稀有度评级、规格尺寸区分(9张/1包/豪华版/1000片等)、以卡换卡交换、卡组构筑指南等核心需求无法得到满足。

本应用(玩乐仓库)以"荧光紫+亮蓝"潮玩电竞风为视觉基调,打造集集市交易、换装交换、图鉴收藏、个人中心四大模块于一体的潮玩电竞风二手交易与收藏社区。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嵌套是本应用的架构特色——集市作为主品类,内部再按卡牌/桌游/手办/拼图/周边细分,潮玩人可以快速切换品类浏览。

三、色彩系统:荧光紫+亮蓝潮玩电竞风

潮玩电竞风的视觉语言应该是"炫酷、潮流、有电竞的科技感"。本应用采用荧光紫+亮蓝配色:

主色体系:

  • #F0F4FF 浅蓝:应用根背景、浅色卡片背景——代表电竞的科技感
  • #FFFFFF 纯白:卡片背景、弹框背景、底部Tab背景——代表层次
  • #9C27B0 荧光紫:主高亮色、Tab选中态、按钮、标签、渐变——代表潮玩的炫酷
  • #1E1E2E 深紫黑:头部渐变终点、最深背景——代表深邃
  • #FF5252 亮红:删除按钮、价格、警告——代表热情与警告
  • #FFD740 亮金:价格、等级标签、统计数字、交换弹框头部、Banner渐变——代表闪耀的金色
  • #00B0FF 亮蓝:辅助色、Tab下划线、稀有度B级色——代表电竞的科技蓝
  • #7A8A99 烟灰:辅助文字、未选中Tab、说明文字——代表素雅
  • #E0E6F0 浅蓝:分割线、进度条背景——代表层次

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

  • #F0F4FF 浅蓝:应用根背景
  • #FFFFFF 纯白:卡片背景、弹框背景
  • #F3E5F5 浅紫:高亮卡片背景、选中态背景、标签背景
  • #E0F7FA 浅蓝:高亮卡片背景、教程步骤背景、选中态背景
  • #E0E6F0 浅蓝:分割线、进度条背景

渐变设计:

  • 头部:linearGradient angle 135 从#9C27B0到#1E1E2E——荧光紫到深紫黑的炫酷渐变
  • 全部Tab Banner:linearGradient angle 120 从#FFD740到#FFB300——亮金到深金的闪耀渐变
  • 卡牌Tab横滑大卡:linearGradient angle 160 从#9C27B0到#1E1E2E——荧光紫到深紫黑
  • 拼图Tab对决卡:linearGradient angle 150 从#9C27B0到#1E1E2E——荧光紫到深紫黑
  • 我的页会员卡:linearGradient angle 120 从#9C27B0到#1E1E2E——荧光紫到深紫黑
  • 发布出售弹框头部:linearGradient angle 120 从#9C27B0到#1E1E2E——荧光紫到深紫黑
  • 好物详情弹框头部:linearGradient angle 135 从#FFD740到#E0F7FA——亮金到浅蓝的闪耀渐变

荧光紫+亮蓝的配色通过浅蓝根背景+纯白卡片+浅紫/浅蓝高亮背景营造潮玩风格的炫酷科技感,荧光紫#9C27B0作为主高亮和按钮色,亮蓝#00B0FF作为Tab下划线和稀有度B级色,亮金#FFD740作为价格和等级色,亮红#FF5252作为删除和价格色,确保视觉一致性和潮玩电竞风韵味。本应用是所有主题中渐变使用最多的(7处渐变),营造出丰富的视觉层次。

四、数据模型

应用定义了7个接口,覆盖潮玩二手交易全链路:

  • ToyItem好物(id/name/eng/cat/price/rarity/year/rating/starStr/seller/tag/desc/want/sales/emoji/size)——18款,含中英文名称、分类、稀有度0-100、发布年份、规格尺寸(9张/1包/豪华版/1000片等)、卖家想换等二手交易特色字段
  • 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套图鉴,含已收/总数/进度百分比
  • ToyReview圈友点评(id/user/setName/starStr/content)——3条点评
  • ColorPalette配色(bg/card/purple/blue/deep/red/gold/sub/line)——9色配色常量

rarity稀有度字段是潮玩好物的特色设计——0-100数值,通过rarityLabel函数映射为四级(S级≥95/A级≥80/B级≥60/C级<60),通过rarityColor函数映射为四色(荧光紫/橙/亮蓝/绿),在柱状图和好物详情中直接渲染。size规格字段区分9张/1包/豪华版/1000片等不同尺寸,want卖家想换字段支持以卡换卡交易场景。

五、Tab0 集市交易(双Tab嵌套)

集市页是应用的核心,采用底部Tab+顶部Tab双层嵌套架构。顶部6个分类Tab(全部/卡牌/桌游/手办/拼图/周边),每个Tab有独立的布局风格:

全部Tab:Banner+双列瀑布

  • 亮金渐变Banner:潮玩收藏节春季专场+顶级好物3天限时卖家免服务费+顶级收藏/卡牌专区标签
  • 全城新上架:双列瀑布布局,左列2件(徽章盲盒/剧本杀盒子),右列1件(500片猫拼图,浅蓝高亮背景),每件含emoji/中文名/英文名/描述/价格/标签

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

  • 顶级收藏专区:3件横滑大卡(万智牌老圈/宝可梦初代卡包/三国杀豪华版),荧光紫渐变背景160宽,含emoji/名称/英文+年份/价格+稀有度标签
  • 稀有度排行:3根柱状图(98/90/85),第三根三国杀用亮红高亮,底部说明"万智牌老圈以98分稀有度登顶,市面流通极少"
  • 今日捡漏榜:3件排行列表,第1名亮红数字,含排名/emoji/名称+稀有度+卖家想换/价格

桌游Tab:教程时间轴

  • 5套教程时间轴布局(卡组构筑指南/桌游规则速查/手办收藏保养/拼图技巧大全/桌游聚会指南),左侧emoji+亮蓝竖线连接,右侧卡片含名称/下载数/作者+类型+页数/步骤列表(带序号圆点)/点赞+教程可下载

手办Tab:三列格子+交换建议

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

拼图Tab:对决卡+侧栏统计

  • 好物对决:万智牌老圈 VS 三国杀豪华版,两张荧光紫渐变对决卡中间VS标识
  • 左侧3件进阶装备列表(乐高老友记/3000片城市夜景/黑莲花闪卡),右侧3格统计(12本周好物成交荧光紫/2.6万好物总交易额亮金/95%好评率绿)

周边Tab:标签云+紧凑列表

  • 周边收藏标签云:6套图鉴(TCG卡牌/桌游/手办/拼图/周边/盲盒),浅紫背景chip
  • 3件紧凑列表(高达模型/卡坦岛/鸣人手办),第3件浅紫高亮背景,含稀有度彩色标签
  • 底部提示:集齐三大收藏可召唤隐藏福利:万智牌+宝可梦+游戏王

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

六、Tab1 换装交换

换装页是潮玩二手交易的特色功能——以卡换卡。由两个层次构成:

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

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

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

换装页解决了潮玩二手交易中"以卡换卡"的核心需求——潮玩人可以用自己的闲置好物(万智牌老圈/宝可梦初代卡包/三国杀豪华版/卡组构筑指南/艾斯手办/星空拼图/青眼白龙/徽章盲盒)交换心仪的好物,通过地点标签支持地铁站面交和线上交换,通过热度标签筛选热门交换帖。

七、Tab2 图鉴收藏

图鉴页是潮玩收藏进度管理功能。由三个层次构成:

1. 标题+登记按钮:我的潮玩图鉴标题+记录每一件心头好的收藏进度+右侧✚登记按钮(荧光紫底,触发发布出售弹框复用)。

2. 图鉴进度列表:6套图鉴(TCG卡牌/桌游/手办/拼图/周边/盲盒),每套含:

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

3. 图鉴成就墙:4个成就标签(🎖️卡牌大师/🏆桌游达人/🗿手办收藏家/🧩拼图高手),不同颜色文字。

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

八、Tab3 个人中心

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

1. 会员信息卡:荧光紫渐变背景,含🎮头像+潮玩收藏家阿乐+LV.10资深玩家·信用分990+右侧>箭头+三格统计(38在售好物亮金/12求购中亮金/¥5.8万累计成交额亮金)。

2. 我的求购清单:3件求购好物(高达模型/500片猫拼图/剧本杀盒子),每件含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. 荧光紫亮蓝头部设计:头部使用荧光紫#9C27B0到深紫黑#1E1E2E的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)通过遍历TOYS数组查找selectedToyId对应的好物字段,在详情弹框中调用,避免在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处渐变设计

十二、完整代码结构总览

1316.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/selectedToyId/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 ArkTS API 24的玩乐仓库应用,从荧光紫+亮蓝潮玩电竞配色系统、双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映射逻辑,代码可维护

未来可扩展:

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

玩乐仓库,让每一张卡牌都找到懂它的玩家,让荧光紫流转、亮蓝生香。


附录:完整源码

// ============================================================
// 1316.ets - 玩乐仓库
// 场景:潮玩卡牌/桌游/手办/拼图/周边的二手交易与收藏社区(潮玩电竞风)
// 风格:荧光紫 #9C27B0 + 亮蓝 #00B0FF 潮玩电竞风
// 底部Tab:集市 / 换装 / 图鉴 / 我的
// 顶部Tab:全部 / 卡牌 / 桌游 / 手办 / 拼图 / 周边
// 弹框:发布出售(新增) / 发起交换(新增) / 下架(删除) / 好物详情(详情)
// ============================================================
// ---------------- 配色 ----------------
interface ColorPalette {
bg: string;
card: string;
purple: string;
blue: string;
deep: string;
red: string;
gold: string;
sub: string;
line: string;
}
const PALETTE: ColorPalette = {
bg: '#F0F4FF',
card: '#FFFFFF',
purple: '#9C27B0',
blue: '#00B0FF',
deep: '#1E1E2E',
red: '#FF5252',
gold: '#FFD740',
sub: '#7A8A99',
line: '#E0E6F0'
};
// ---------------- 通用结构 ----------------
interface TabItem { label: string; icon: string; }
interface ParticleItem { x: number; emoji: string; size: number; speed: number; opacity: number; }
// ---------------- 好物条目 ----------------
interface ToyItem {
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 ToyReview {
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 TOYS: ToyItem[] = [
{ id: 1, name: '万智牌 老圈套牌', eng: 'MTG Power Nine', cat: 'retired', price: 120000, rarity: 98, year: 1993, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '牌皇', tag: '传世孤品', desc: '万智牌初代九张神卡(Power Nine),均为英文初版,品相极佳,全球存世量极少,收藏级神物。', want: '面议换房', sales: 1, emoji: '🃏', size: '9张' },
{ id: 2, name: '宝可梦 初代卡包', eng: 'Pokemon Base Set', cat: 'retired', price: 32000, rarity: 90, year: 1999, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '卡牌收藏家', tag: '未开封', desc: '宝可梦初代英文版原封补充包,稀有度极高,内含闪卡,完美未拆,极具收藏价值。', want: '换 闪卡', sales: 2, emoji: '🎴', size: '1包' },
{ id: 3, name: '桌游 三国杀 豪华版', eng: 'Sanguosha Deluxe', cat: 'retired', price: 2800, rarity: 85, year: 2008, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '桌游吧老板', tag: '限量绝版', desc: '三国杀十周年豪华版,含全扩展和闪卡,经典桌游,成色极佳,适合收藏和聚会。', want: '换 狼人杀', sales: 5, emoji: '🎲', size: '豪华版' },
{ id: 4, name: '卡组构筑指南', eng: 'Deck Building Guide', cat: 'moc', price: 29, rarity: 30, year: 2025, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '卡牌大师', tag: '新手必读', desc: '万智牌/宝可梦等TCG卡组构筑指南,从卡牌选择到费用曲线,干货满满,助你赢在起跑线。', want: '可换卡牌', sales: 156, emoji: '📖', size: '电子版' },
{ id: 5, name: '桌游规则速查手册', eng: 'Board Game Rules', cat: 'moc', price: 39, rarity: 35, year: 2024, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '桌游设计师', tag: '官方补丁', desc: '常见桌游规则速查手册,含清晰图文,快速上手热门桌游,聚会必备。', want: '换 桌游', sales: 98, emoji: '📘', size: '电子版' },
{ id: 6, name: '手办 海贼王 艾斯', eng: 'One Piece Ace', cat: 'moc', price: 980, rarity: 75, year: 2019, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '手办控', tag: '涂装精细', desc: '海贼王艾斯手办,造型经典,涂装精细,火焰特效件逼真,细节到位,收藏必入。', want: '换 路飞', sales: 12, emoji: '🔥', size: '1/8' },
{ id: 7, name: '拼图 1000片 星空', eng: 'Starry Night Puzzle', cat: 'fig', price: 180, rarity: 40, year: 2023, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '拼图爱好者', tag: '原创插画', desc: '梵高星空主题拼图,1000片,纸质厚实,印刷清晰,适合静心拼搭,成品超美。', want: '换 拼图', sales: 30, emoji: '🌌', size: '1000片' },
{ id: 8, name: '游戏王 青眼白龙', eng: 'Blue-Eyes White Dragon', cat: 'fig', price: 2600, rarity: 88, year: 1999, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '游戏王迷', tag: '初版闪卡', desc: '游戏王初版青眼白龙UR闪卡,经典卡面,市场罕见,品相完好,收藏级。', want: '换 黑魔导', sales: 3, emoji: '🐉', size: '闪卡' },
{ id: 9, name: '桌游 狼人杀 豪华版', eng: 'Werewolf Deluxe', cat: 'fig', price: 220, rarity: 30, year: 2022, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '桌游店', tag: '含扩展包', desc: '狼人杀豪华版,含狼人/预言家/女巫等全角色,卡牌精美,聚会必玩,成色极佳。', want: '换 剧本杀', sales: 20, emoji: '🐺', size: '标准' },
{ id: 10, name: '乐高 老友记中央公园', eng: 'LEGO Central Perk', cat: 'tech', price: 720, rarity: 65, year: 2019, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '乐高玩家', tag: '绝版套装', desc: '乐高老友记咖啡厅套装,含六人仔,经典场景,拼装简单,摆柜超好看,已绝版。', want: '换 乐高', sales: 10, emoji: '☕', size: '1070片' },
{ id: 11, name: '拼图 3000片 城市夜景', eng: 'City Night Puzzle', cat: 'tech', price: 320, rarity: 45, year: 2024, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '拼图玩家', tag: '高难度', desc: '3000片城市夜景拼图,细节丰富,挑战性强,拼完有巨大成就感,适合资深玩家。', want: '换 1000片', sales: 8, emoji: '🏙️', size: '3000片' },
{ id: 12, name: '万智牌 闪卡 黑莲花', eng: 'Black Lotus Foil', cat: 'tech', price: 68000, rarity: 98, year: 1993, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '牌圈大佬', tag: '顶级收藏', desc: '万智牌黑莲花闪卡,传奇中的传奇,存世量极少,保存完好,无数玩家的梦想。', want: '面议', sales: 1, emoji: '💠', size: '1张' },
{ id: 13, name: '周边 高达模型', eng: 'Gundam Model', cat: 'street', price: 450, rarity: 35, year: 2023, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '机甲迷', tag: 'MG系列', desc: '高达MG拼装模型,未拼装,水贴齐全,造型帅气,适合收藏和制作,成色全新。', want: '换 手办', sales: 15, emoji: '🤖', size: 'MG' },
{ id: 14, name: '桌游 卡坦岛', eng: 'Catan', cat: 'street', price: 260, rarity: 25, year: 2021, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '桌游收藏家', tag: '入门经典', desc: '卡坦岛基础版,经典策略桌游,配件齐全,成色良好,适合新手和老手。', want: '换 棋盘游戏', sales: 18, emoji: '🏝️', size: '基础版' },
{ id: 15, name: '手办 火影 鸣人', eng: 'Naruto Figure', cat: 'street', price: 750, rarity: 55, year: 2022, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '动漫手办', tag: '螺旋丸特效', desc: '火影忍者鸣人手办,包含螺旋丸特效件,造型动感,涂装精细,动漫迷必备。', want: '换 佐助', sales: 8, emoji: '🍥', size: '1/7' },
{ id: 16, name: '拼图 500片 猫', eng: 'Cat Puzzle', cat: 'classic', price: 80, rarity: 20, year: 2025, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '猫迷', tag: '萌趣治愈', desc: '500片猫咪拼图,色彩治愈,软萌可爱,适合家庭娱乐,拼完可以做挂画。', want: '换 1000片', sales: 25, emoji: '🐱', size: '500片' },
{ id: 17, name: '周边 徽章盲盒', eng: 'Badge Blind Box', cat: 'classic', price: 60, rarity: 20, year: 2025, rating: 4.5, starStr: '⭐⭐⭐⭐', seller: '盲盒店', tag: '随机抽取', desc: '动漫徽章盲盒,随机抽取,角色众多,收藏乐趣多,成色全新,一盒5个。', want: '换 手办', sales: 30, emoji: '🎖️', size: '5个' },
{ id: 18, name: '桌游 剧本杀 盒子', eng: 'Murder Mystery Game', cat: 'classic', price: 150, rarity: 25, year: 2024, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '剧本杀店', tag: '悬疑推理', desc: '剧本杀实体盒装,剧情丰富,角色扮演,适合朋友聚会,成色好,含解析。', want: '换 狼人杀', sales: 20, emoji: '🕵️', size: '6人本' }
];
// ---------------- 交换帖数据(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: '1000片换3000片,都是拼图,补差价换,可聊聊看。', 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: 40, author: '卡牌大师', likes: 342, downloads: 2100, emoji: '📖', steps: ['费用曲线 1-10页', '单卡选择 11-25页', '应对策略 26-40页'] },
{ id: 2, name: '桌游规则速查', type: '桌游', pages: 20, author: '桌游设计师', likes: 276, downloads: 1580, emoji: '📘', steps: ['常见机制 1-8页', '热门桌游 9-15页', '快速上手 16-20页'] },
{ id: 3, name: '手办收藏保养', type: '手办', pages: 30, author: '手办控', likes: 415, downloads: 3300, emoji: '🗿', steps: ['防尘防潮 1-10页', '清洁方法 11-20页', '摆放展示 21-30页'] },
{ id: 4, name: '拼图技巧大全', type: '拼图', pages: 25, author: '拼图玩家', likes: 198, downloads: 1260, emoji: '🧩', steps: ['分拣方法 1-8页', '边框拼法 9-15页', '内片填充 16-25页'] },
{ id: 5, name: '桌游聚会指南', type: '聚会', pages: 15, author: '桌游吧老板', likes: 233, downloads: 1420, emoji: '🎲', steps: ['选游建议 1-5页', '人数匹配 6-10页', '气氛营造 11-15页'] }
];
// ---------------- 配件/周边数据(9条写死) ----------------
const ACCESSORIES: AccessoryItem[] = [
{ id: 1, name: '卡套', series: '透明', price: 25, condition: '全新', seller: '卡牌配件', emoji: '🛡️', desc: '保护卡牌,防划痕' },
{ id: 2, name: '牌盒', series: 'PU', price: 80, condition: '9成新', seller: '卡牌玩家', emoji: '📦', desc: '高档PU,耐用防潮' },
{ id: 3, name: '桌游桌垫', series: '大号', price: 100, condition: '全新', seller: '桌游配件', emoji: '🧻', desc: '防滑,保护桌面' },
{ id: 4, name: '手办底座', series: '透明', price: 30, condition: '全新', seller: '手办配件', emoji: '🗿', desc: '展示稳固,防尘' },
{ id: 5, name: '拼图胶水', series: '常规', price: 35, condition: '全新', seller: '拼图配件', emoji: '🧴', desc: '拼图固定,便于挂画' },
{ id: 6, name: '盲盒展示柜', series: '亚克力', price: 150, condition: '全新', seller: '周边配件', emoji: '🪟', desc: '透明展示,美观大方' },
{ id: 7, name: '骰子塔', series: '木质', price: 45, condition: '全新', seller: '桌游配件', emoji: '🗼', desc: '掷骰子防掉落,仪式感' },
{ id: 8, name: '卡牌计数器', series: '电子', price: 60, condition: '9成新', seller: '卡牌配件', emoji: '🔢', desc: '记录生命值,便捷' },
{ id: 9, name: '桌游收纳盒', series: '大容量', price: 120, condition: '全新', seller: '桌游配件', emoji: '🧰', desc: '分类收纳,防丢失' }
];
// ---------------- 图鉴收藏数据(6条写死) ----------------
const COLLECTIONS: CollectionItem[] = [
{ id: 1, name: 'TCG卡牌', series: 'TCG', owned: 6, total: 12, rate: 50, emoji: '🃏' },
{ id: 2, name: '桌游', series: 'Board Game', owned: 8, total: 20, rate: 40, emoji: '🎲' },
{ id: 3, name: '手办', series: 'Figures', owned: 5, total: 15, rate: 33, emoji: '🗿' },
{ id: 4, name: '拼图', series: 'Puzzles', owned: 10, total: 25, rate: 40, emoji: '🧩' },
{ id: 5, name: '周边', series: 'Merch', owned: 15, total: 30, rate: 50, emoji: '🎁' },
{ id: 6, name: '盲盒', series: 'Blind Box', owned: 3, total: 8, rate: 38, emoji: '🎖️' }
];
// ---------------- 点评数据(3条写死) ----------------
const TOY_REVIEWS: ToyReview[] = [
{ 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[] = [56, 64, 72, 58, 102, 146, 138];
// ---------------- 弹框选项 ----------------
const CONDITION_OPTIONS: string[] = ['全新未拆', '仅使用1次', '9成新', '8成新', '有磨损'];
const PLACES: string[] = ['光谷广场站', '江汉路站', '洪山广场站', '楚河汉街站', '线上互换'];
// ---------------- 全局纯函数 ----------------
function catColor(cat: string): string {
if (cat === 'retired') return '#9C27B0';
if (cat === 'moc') return '#7C4DFF';
if (cat === 'fig') return '#00B0FF';
if (cat === 'tech') return '#FFD740';
if (cat === 'street') return '#FF5252';
return '#9C27B0';
}
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 '#9C27B0';
if (r >= 80) return '#FF8A00';
if (r >= 60) return '#00B0FF';
return '#4CAF50';
}
function tradeBarHeight(v: number): string {
return Math.round(v / 146 * 96).toString() + 'vp';
}
function rateColor(r: number): string {
if (r >= 55) return '#4CAF50';
if (r >= 40) return '#FFD740';
return '#FF5252';
}
function retiredSets(): ToyItem[] { return [TOYS[0], TOYS[1], TOYS[2]]; }
function mocSets(): ToyItem[] { return [TOYS[3], TOYS[4], TOYS[5]]; }
function figSets(): ToyItem[] { return [TOYS[6], TOYS[7], TOYS[8]]; }
function techSets(): ToyItem[] { return [TOYS[9], TOYS[10], TOYS[11]]; }
function streetSets(): ToyItem[] { return [TOYS[12], TOYS[13], TOYS[14]]; }
function classicSets(): ToyItem[] { return [TOYS[15], TOYS[16], TOYS[17]]; }
function cityLeft(): ToyItem[] { return [TOYS[16], TOYS[17]]; }
function cityRight(): ToyItem[] { return [TOYS[15]]; }
function hotSets(): ToyItem[] { return [TOYS[3], TOYS[5], TOYS[16], TOYS[17], TOYS[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 selectedToyId: number = 1;
@State showSellModal: boolean = false;
@State showSwapModal: boolean = false;
@State showDeleteModal: boolean = false;
@State showDetailModal: boolean = false;
@State sellToyIdx: 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 < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].name; return ''; }
detailEng(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].eng; return ''; }
detailEmoji(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].emoji; return '🃏'; }
detailPrice(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return '¥' + TOYS[i].price.toString(); return ''; }
detailSize(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].size; return ''; }
detailRarity(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].rarity.toString(); return ''; }
detailYear(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].year.toString(); return ''; }
detailSeller(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].seller; return ''; }
detailTag(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].tag; return ''; }
detailStar(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].starStr; return ''; }
detailRating(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].rating.toFixed(1) + '分'; return ''; }
detailDesc(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].desc; return ''; }
detailWant(): string { for (let i = 0; i < TOYS.length; i++) if (TOYS[i].id === this.selectedToyId) return TOYS[i].want; return ''; }
// ---------------- 头部 ----------------
@Builder
headerBuilder() {
Column() {
Row() {
Column() {
Text('🎮 玩乐仓库').fontSize(22).fontWeight(FontWeight.Bold).fontColor('#FFFFFF')
Text('淘好物 · 换心头好 · 玩起来').fontSize(11).fontColor('#D4B3E8').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('#9C27B0').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('#C9A8DE').layoutWeight(1)
Text('🧰 我的求购').fontSize(11).fontColor('#9C27B0').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: [['#9C27B0', 0], ['#1E1E2E', 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 ? '#9C27B0' : '#7A8A99').fontWeight(this.currentTopTab === idx ? FontWeight.Bold : FontWeight.Normal).margin({ top: 2 })
if (this.currentTopTab === idx) {
Divider().width(16).strokeWidth(3).color('#00B0FF').borderRadius(2).margin({ top: 4 })
} else {
Divider().width(16).strokeWidth(3).color('#F0F4FF').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('#9C27B0')
Text('顶级好物 3天限时 · 卖家免服务费').fontSize(12).fontColor('#7A8A99').margin({ top: 6 })
Row({ space: 10 }) {
Text('🏆 顶级收藏').fontSize(11).fontColor('#9C27B0').backgroundColor('#FFFFFF').borderRadius(12).padding({ left: 10, right: 10, top: 4, bottom: 4 })
Text('🃏 卡牌专区').fontSize(11).fontColor('#9C27B0').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: [['#FFD740', 0], ['#FFB300', 1]] }).borderRadius(16)
Text('✨ 全城新上架').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(cityLeft(), (t: ToyItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 16 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1E1E2E').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#7A8A99').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#7A8A99').margin({ top: 8 }).maxLines(3).textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(15).fontWeight(FontWeight.Bold).fontColor('#FF5252')
Text(t.tag).fontSize(9).fontColor('#9C27B0').backgroundColor('#F3E5F5').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.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem) => 'cl' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
ForEach(cityRight(), (t: ToyItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 24 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1E1E2E').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#7A8A99').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#7A8A99').margin({ top: 10 }).maxLines(4).textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(15).fontWeight(FontWeight.Bold).fontColor('#FF5252')
Text(t.starStr).fontSize(10)
}.margin({ top: 12, bottom: 20 })
}.width('100%').backgroundColor('#E0F7FA').borderRadius(14).alignItems(HorizontalAlign.Start).padding({ left: 14, right: 14 })
.onClick(() => { this.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem) => '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('#9C27B0').width('100%')
Scroll() {
Row({ space: 12 }) {
ForEach(retiredSets(), (t: ToyItem) => {
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('#D4B3E8').margin({ top: 4 })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD740')
Text(rarityLabel(t.rarity)).fontSize(10).fontColor('#9C27B0').backgroundColor('#FFD740').borderRadius(8).padding({ left: 6, right: 6, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width(160).linearGradient({ angle: 160, colors: [['#9C27B0', 0], ['#1E1E2E', 1]] }).borderRadius(16).alignItems(HorizontalAlign.Center)
.onClick(() => { this.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem) => '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('#9C27B0').width('100%')
Row({ space: 6 }) {
ForEach(retiredSets(), (t: ToyItem, i: number) => {
Column({ space: 5 }) {
Text(t.rarity.toString()).fontSize(9).fontColor('#9C27B0')
Column().width(34).height((t.rarity).toString() + 'vp').backgroundColor(i === 2 ? '#FF5252' : '#9C27B0').borderRadius({ topLeft: 5, topRight: 5 })
Text(t.year.toString() + '年').fontSize(9).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Center).layoutWeight(1)
}, (t: ToyItem, i: number) => 'rb' + i.toString() + t.id.toString())
}.width('100%').justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Bottom).padding({ top: 12 })
Text('万智牌老圈以98分稀有度登顶,市面流通极少').fontSize(10).fontColor('#7A8A99').margin({ top: 8 })
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14).margin({ left: 14, right: 14 })
Column() {
Text('🕵️ 今日捡漏榜').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%').margin({ bottom: 8 })
ForEach(retiredSets(), (t: ToyItem, i: number) => {
Row({ space: 10 }) {
Text((i + 1).toString()).fontSize(14).fontWeight(FontWeight.Bold).fontColor(i === 0 ? '#FF5252' : '#7A8A99').width(20)
Text(t.emoji).fontSize(18)
Column() {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#1E1E2E')
Text(rarityLabel(t.rarity) + ' · ' + t.want).fontSize(10).fontColor('#7A8A99').margin({ top: 2 })
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FF5252')
}.width('100%').padding({ top: 8, bottom: 8 }).onClick(() => { this.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem, 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('#9C27B0').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('#00B0FF').margin({ top: 4 })
}
}.width(40).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) {
Row({ space: 8 }) {
Text(m.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1E1E2E').layoutWeight(1)
Text('⬇ ' + m.downloads.toString()).fontSize(10).fontColor('#9C27B0')
}.width('100%')
Text('by ' + m.author + ' · ' + m.type + ' · ' + m.pages.toString() + '页').fontSize(10).fontColor('#7A8A99')
Column({ space: 5 }) {
ForEach(m.steps, (s: string, si: number) => {
Row({ space: 8 }) {
Text((si + 1).toString()).fontSize(9).fontWeight(FontWeight.Bold).fontColor('#9C27B0').backgroundColor('#F0F4FF').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('#F0F4FF').borderRadius(10).padding(10)
Row({ space: 8 }) {
Text('❤️ ' + m.likes.toString()).fontSize(10).fontColor('#FF5252')
Text(m.emoji + ' 教程可下载').fontSize(10).fontColor('#9C27B0').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.layoutWeight(1).backgroundColor(i === 1 ? '#E0F7FA' : '#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('#9C27B0').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('#1E1E2E').margin({ top: 6 }).maxLines(1)
Text(f.series).fontSize(8).fontColor('#7A8A99').margin({ top: 2 })
Text('¥' + f.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FF5252').margin({ top: 4, bottom: 12 })
}.width('31%').backgroundColor('#FFFFFF').borderRadius(12).alignItems(HorizontalAlign.Center).margin({ bottom: 8 })
.onClick(() => { this.selectedToyId = 7 + f.id % 3; this.showDetailModal = true; })
}, (f: AccessoryItem) => 'fg' + f.id.toString())
}.width('100%')
Column() {
Text('🤝 配件交换行情').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#9C27B0').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('#1E1E2E')
Text(f.desc).fontSize(10).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + f.price.toString()).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#00B0FF')
}.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('#9C27B0').width('100%')
Row({ space: 10 }) {
Column() {
Text('🃏').fontSize(34).margin({ top: 14 })
Text('万智牌老圈').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('1993年 · 现价¥120000').fontSize(10).fontColor('#D4B3E8').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#9C27B0', 0], ['#1E1E2E', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
Column() {
Text('VS').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#9C27B0')
Text('本周').fontSize(9).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Center)
Column() {
Text('🎲').fontSize(34).margin({ top: 14 })
Text('三国杀豪华').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('2008年 · 现价¥2800').fontSize(10).fontColor('#D4B3E8').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#7A8A99', 0], ['#1E1E2E', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
}.width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(techSets(), (t: ToyItem) => {
Row({ space: 10 }) {
Text(t.emoji).fontSize(22)
Column({ space: 2 }) {
Text(t.name).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1E1E2E')
Text(t.tag + ' · ' + t.size).fontSize(10).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#FF5252')
}.width('100%').backgroundColor('#FFFFFF').borderRadius(12).padding(12).onClick(() => { this.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem) => 'tc' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
Column({ space: 4 }) {
Text('12').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#9C27B0')
Text('本周好物成交').fontSize(9).fontColor('#7A8A99')
}.width('100%').backgroundColor('#F3E5F5').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('2.6万').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#FFD740')
Text('好物总交易额').fontSize(9).fontColor('#7A8A99')
}.width('100%').backgroundColor('#FFF8E1').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('95%').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#4CAF50')
Text('好评率').fontSize(9).fontColor('#7A8A99')
}.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('#9C27B0').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('#9C27B0').backgroundColor('#F3E5F5').borderRadius(12).padding({ left: 10, right: 10, top: 6, bottom: 6 }).margin(4)
}, (c: CollectionItem) => 'ccoll' + c.id.toString())
}.width('100%')
ForEach(streetSets(), (t: ToyItem) => {
Row({ space: 12 }) {
Text(t.emoji).fontSize(24)
Column({ space: 2 }) {
Row({ space: 6 }) {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#1E1E2E')
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('#7A8A99').maxLines(1).textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + t.price.toString()).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FF5252')
}.width('100%').backgroundColor(t.id === 15 ? '#F3E5F5' : '#FFFFFF').borderRadius(12).padding(12).onClick(() => { this.selectedToyId = t.id; this.showDetailModal = true; })
}, (t: ToyItem) => 'st' + t.id.toString())
Text('💬 集齐三大收藏可召唤隐藏福利:万智牌+宝可梦+游戏王').fontSize(10).fontColor('#7A8A99').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('#9C27B0'); Text('在交换中').fontSize(10).fontColor('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('42').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#FFD740'); Text('今日成交').fontSize(10).fontColor('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('98%').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#4CAF50'); Text('面交好评').fontSize(10).fontColor('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) { Text('🤝 发交换').fontSize(12).fontColor('#FFFFFF').backgroundColor('#9C27B0').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('#1E1E2E')
Text(swapBadge(s.likes)).fontSize(8).fontColor('#FFD740').backgroundColor('#FFF8E1').borderRadius(6).padding({ left: 5, right: 5, top: 1, bottom: 1 })
}
Text(s.time + ' · ' + s.place).fontSize(9).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('⋯').fontSize(16).fontColor('#7A8A99').onClick(() => { this.showDeleteModal = true; })
}.width('100%')
Row({ space: 10 }) {
Column({ space: 4 }) { Text('我提供').fontSize(9).fontColor('#9C27B0'); Text(s.offer).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1E1E2E') }.layoutWeight(1).backgroundColor('#F3E5F5').borderRadius(10).padding(8).alignItems(HorizontalAlign.Center)
Text('⇄').fontSize(14).fontColor('#00B0FF')
Column({ space: 4 }) { Text('我想换').fontSize(9).fontColor('#FF5252'); Text(s.want).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1E1E2E') }.layoutWeight(1).backgroundColor('#E0F7FA').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('#9C27B0').backgroundColor('#F0F4FF').borderRadius(10).padding({ left: 8, right: 8, top: 4, bottom: 4 })
Text('❤️ ' + s.likes.toString()).fontSize(10).fontColor('#FF5252').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('#9C27B0')
Text('记录每一件心头好的收藏进度').fontSize(10).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('✚ 登记').fontSize(12).fontColor('#FFFFFF').backgroundColor('#9C27B0').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('#1E1E2E')
Text(c.series + ' · 已收 ' + c.owned.toString() + '/' + c.total.toString()).fontSize(10).fontColor('#7A8A99')
}.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('#E0E6F0').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('#9C27B0').width('100%').margin({ bottom: 8 })
Flex({ wrap: FlexWrap.Wrap }) {
Text('🎖️ 卡牌大师').fontSize(10).fontColor('#9C27B0').backgroundColor('#F3E5F5').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🏆 桌游达人').fontSize(10).fontColor('#00B0FF').backgroundColor('#E0F7FA').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🗿 手办收藏家').fontSize(10).fontColor('#FF5252').backgroundColor('#FFEBEE').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🧩 拼图高手').fontSize(10).fontColor('#4CAF50').backgroundColor('#E8F5E9').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('#D4B3E8')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('>').fontSize(18).fontColor('#D4B3E8')
}.width('100%')
Row({ space: 0 }) {
Column({ space: 3 }) { Text('38').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD740'); Text('在售好物').fontSize(9).fontColor('#D4B3E8') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('12').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD740'); Text('求购中').fontSize(9).fontColor('#D4B3E8') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('¥5.8万').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#FFD740'); Text('累计成交额').fontSize(9).fontColor('#D4B3E8') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').margin({ top: 16 })
}.width('100%').padding(18).linearGradient({ angle: 120, colors: [['#9C27B0', 0], ['#1E1E2E', 1]] }).borderRadius(16).margin({ top: 10 })
Column() {
Text('🔨 我的求购清单').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%').margin({ bottom: 6 })
ForEach(TOYS, (t: ToyItem) => {
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('#1E1E2E')
Text('预算 ¥' + t.price.toString() + ' 内 · ' + t.want).fontSize(9).fontColor('#7A8A99')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('出价中').fontSize(10).fontColor('#FFD740').backgroundColor('#FFF8E1').borderRadius(10).padding({ left: 8, right: 8, top: 3, bottom: 3 })
}.width('100%').padding({ top: 9, bottom: 9 })
}
}, (t: ToyItem) => 'wish' + t.id.toString())
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
Column() {
Text('📍 常去面交点').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#9C27B0').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('#1E1E2E').layoutWeight(1)
Text(['光谷站台', '江汉路天桥', '洪山转盘', '楚河入口', '顺丰网点'][i]).fontSize(9).fontColor('#7A8A99')
}.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 ? '#9C27B0' : '#7A8A99').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('#D4B3E8').margin({ top: 4, bottom: 16 })
}.width('100%').linearGradient({ angle: 120, colors: [['#9C27B0', 0], ['#1E1E2E', 1]] }).borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('要出售的好物').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(TOYS, (t: ToyItem, i: number) => {
if (i < 8) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.sellToyIdx === i ? '#FFFFFF' : '#9C27B0').backgroundColor(this.sellToyIdx === i ? '#9C27B0' : '#F3E5F5').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.sellToyIdx = i; })
}
}, (t: ToyItem, 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('#9C27B0').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(CONDITION_OPTIONS, (c: string, i: number) => {
Text(c).fontSize(10).fontColor(this.sellCondIdx === i ? '#FFFFFF' : '#FFD740').backgroundColor(this.sellCondIdx === i ? '#FFD740' : '#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('#9C27B0')
Row({ space: 0 }) {
Text('−').fontSize(16).fontColor('#9C27B0').backgroundColor('#F3E5F5').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('#1E1E2E').backgroundColor('#FFFFFF').height(30).textAlign(TextAlign.Center).padding({ left: 14, right: 14 })
Text('+').fontSize(16).fontColor('#FFFFFF').backgroundColor('#9C27B0').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 ? '#FF5252' : '#7A8A99').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
Column({ space: 8 }) {
Text('宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%')
TextInput({ placeholder: '成色、瑕疵、配件情况如实描述…', text: this.sellWords }).fontSize(12).fontColor('#1E1E2E').backgroundColor('#F0F4FF').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('#7A8A99').backgroundColor('#F0F4FF').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSellModal = false; })
Text('上架出售').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#9C27B0').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('#1E1E2E') }.margin({ top: 16 })
Text('用闲置换心头好,玩家互助').fontSize(11).fontColor('#7A8A99').margin({ top: 4, bottom: 14 })
}.width('100%').backgroundColor('#00B0FF').borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('我提供').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(TOYS, (t: ToyItem, i: number) => {
if (i % 3 === 0 && i < 15) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.swapOfferIdx === i ? '#FFFFFF' : '#9C27B0').backgroundColor(this.swapOfferIdx === i ? '#1E1E2E' : '#F0F4FF').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.swapOfferIdx = i; })
}
}, (t: ToyItem, 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('#9C27B0').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(TOYS, (t: ToyItem, i: number) => {
if (i % 3 === 2 && i < 15) {
Text((this.pickedWant(i) ? '✓ ' : '') + t.emoji + ' ' + t.name).fontSize(10).fontColor(this.pickedWant(i) ? '#FFFFFF' : '#FF5252').backgroundColor(this.pickedWant(i) ? '#FF5252' : '#E0F7FA').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.toggleWant(i); })
}
}, (t: ToyItem, 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('#9C27B0').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(PLACES, (p: string, i: number) => {
Text(p).fontSize(10).fontColor(this.swapPlaceIdx === i ? '#FFFFFF' : '#9C27B0').backgroundColor(this.swapPlaceIdx === i ? '#9C27B0' : '#F3E5F5').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('#7A8A99').lineHeight(15).layoutWeight(1)
}.width('100%').backgroundColor('#E0F7FA').borderRadius(10).padding(10)
Row({ space: 12 }) {
Text('再想想').fontSize(13).fontColor('#7A8A99').backgroundColor('#F0F4FF').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSwapModal = false; })
Text('发布交换帖').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#9C27B0').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('#9C27B0')
Text('下架后买家将无法搜索到这条信息,\n收藏和留言会一并清空,可重新上架。').fontSize(11).fontColor('#7A8A99').textAlign(TextAlign.Center).lineHeight(17)
Row({ space: 12 }) {
Text('留着').fontSize(13).fontColor('#9C27B0').backgroundColor('#F3E5F5').borderRadius(20).layoutWeight(1).height(40).textAlign(TextAlign.Center).onClick(() => { this.showDeleteModal = false; })
Text('确认下架').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#FF5252').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('#1E1E2E').margin({ top: 8 })
Text(this.detailEng()).fontSize(10).fontColor('#7A8A99').margin({ top: 2 })
Row({ space: 8 }) {
Text(this.detailTag()).fontSize(9).fontColor('#FFFFFF').backgroundColor('#9C27B0').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
Text(rarityLabel(Number(this.detailRarity()))).fontSize(9).fontColor('#1E1E2E').backgroundColor('#FFD740').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width('100%').linearGradient({ angle: 135, colors: [['#FFD740', 0], ['#E0F7FA', 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('#FF5252'); Text('售价').fontSize(9).fontColor('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailSize()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#9C27B0'); Text('规格').fontSize(9).fontColor('#7A8A99') }.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('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailYear()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#00B0FF'); Text('年份').fontSize(9).fontColor('#7A8A99') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').backgroundColor('#F0F4FF').borderRadius(12).padding({ top: 12, bottom: 12 })
Column({ space: 8 }) {
Text('🧾 宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1E1E2E').width('100%')
Text(this.detailDesc()).fontSize(11).fontColor('#4A5A6E').lineHeight(18)
Row({ space: 8 }) {
Text('👤 ' + this.detailSeller()).fontSize(10).fontColor('#9C27B0')
Text(this.detailStar() + ' ' + this.detailRating()).fontSize(10).fontColor('#FFD740').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 8 }) {
Text('🤝').fontSize(14)
Text('卖家想换:' + this.detailWant()).fontSize(11).fontColor('#FF5252').layoutWeight(1)
}.width('100%').backgroundColor('#E0F7FA').borderRadius(10).padding(10)
Column({ space: 10 }) {
Text('💬 圈友点评').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#9C27B0').width('100%')
ForEach(TOY_REVIEWS, (r: ToyReview) => {
Column({ space: 5 }) {
Row({ space: 8 }) { Text('👤').fontSize(14); Text(r.user).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1E1E2E'); Text(r.starStr).fontSize(9).layoutWeight(1).textAlign(TextAlign.End) }.width('100%')
Text(r.content).fontSize(10).fontColor('#7A8A99').lineHeight(15)
}.width('100%').backgroundColor('#F0F4FF').borderRadius(10).padding(10)
}, (r: ToyReview) => 'rv' + r.id.toString())
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 12 }) {
Text('💬 留言问问').fontSize(13).fontColor('#9C27B0').backgroundColor('#F3E5F5').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showDetailModal = false; })
Text('🛒 立即购买').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#FF5252').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、测试、元服务和应用上架分发等。

更多推荐