黑胶转动岁月留声:基于HarmonyOS 6.1.1与ArkTS声明式UI的黑胶音像店,从红金渐变头部到稀有度四级分级的复古音像二手交易全栈开发实战解析

从披头士首版黑胶到邓丽君绝版磁带,从芬达电吉他到马歇尔音箱,从打口碟到摇滚T恤——本文以一套完整的ArkTS黑胶音像店应用为例,深度解析HarmonyOS 6.1.1在复古音像二手交易场景下的双Tab嵌套架构、14粒子漂浮动效、稀有度四级分级、唱片详情红金渐变头、以物换碟交换帖等核心技术实现。

一、引言

黑胶唱片、磁带、乐器、音箱——这些承载着几代人音乐记忆的载体,在数字时代反而焕发了新的收藏热潮。从披头士首版黑胶到邓丽君绝版磁带,从芬达电吉他到马歇尔音箱,复古音像收藏已经成为一个庞大的文化市场。然而复古音像交易长期依赖闲鱼、贴吧等泛平台,缺乏针对音像收藏的专业化功能——稀有度评级、格式区分(LP/CD/磁带/乐器/音箱)、以物换碟、收藏图鉴等核心需求无法得到满足。

本应用(黑胶音像店)以"黑胶黑+摩登红"复古摩登风为视觉基调,打造集唱片交易、换碟交换、收藏图鉴、个人中心四大模块于一体的复古音像二手交易与收藏社区。18款唱片/乐器/音箱覆盖黑胶/磁带/CD/乐器/音箱/周边全品类,8条换碟交换帖覆盖以物换物场景,5套鉴赏教程覆盖黑胶保养/爵士入门/吉他教学/HiFi选购/声乐技巧,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嵌套是本应用的架构特色——唱片作为主品类,内部再按黑胶/磁带/乐器/音箱/周边细分,用户可以快速切换品类浏览。

三、色彩系统:黑胶黑+摩登红复古摩登风

复古音像的视觉语言应该是"摩登、复古、有唱片店的温度感"。本应用采用黑胶黑+摩登红配色:

主色体系:

  • #1A1A1A 黑胶黑:主文字色、深色卡片背景、弹框头部、渐变起点——代表黑胶唱片的深邃
  • #D32F2F 摩登红:主高亮色、Tab选中态、按钮、标签、渐变——代表摩登与热情
  • #0D0D0D 深黑:最深背景色——代表极致复古
  • #C9A24B 复古金:Tab指示条、Banner渐变、标签、统计数字——代表经典与珍贵
  • #4A7C59 松石绿:辅助色、好评率、交换价格——代表清新
  • #8A8A8A 烟灰:辅助文字、未选中Tab、说明文字——代表素雅
  • #E5E5E5 浅灰:分割线、进度条背景——代表层次

浅色背景层次:

  • #F4F4F4 浅灰白:应用根背景
  • #FFFFFF 纯白:卡片背景、弹框背景
  • #F5E1E1 浅红:标签背景、选中态背景、高亮卡片背景
  • #F5EFE0 浅金:提示背景、想换物品背景
  • #E8F7EF 浅绿:成就标签背景
  • #E8F0FE 浅蓝:成就标签背景

渐变设计:

  • 头部:linearGradient angle 135 从#1A1A1A到#8E2A2A——黑胶黑到暗红的摩登渐变
  • 黑胶音乐节Banner:linearGradient angle 120 从#C9A24B到#E2CE94——复古金到浅金的经典渐变
  • 首版神物大卡:linearGradient angle 160 从#D32F2F到#1A1A1A——摩登红到黑胶黑的深邃渐变
  • 唱片详情头部:linearGradient angle 135 从#C9A24B到#F5E1E1——复古金到浅红的明快渐变
  • 发布出售弹框头部:linearGradient angle 120 从#D32F2F到#1A1A1A——与首版神物大卡一致的红黑渐变
  • 我的页会员卡:linearGradient angle 120 从#1A1A1A到#8E2A2A——与头部一致的黑红渐变

黑胶黑+摩登红的配色通过浅灰白根背景+纯白卡片+浅红/浅金高亮背景营造复古空间感,摩登红#D32F2F作为唯一主高亮色贯穿全应用,复古金#C9A24B作为Tab指示条和Banner色,黑胶黑#1A1A1A作为主文字和深色背景色,确保视觉一致性和复古摩登韵味。

四、数据模型

应用定义了7个接口,覆盖复古音像交易全链路:

  • RecordItem唱片/乐器/音箱(id/name/eng/cat/price/rarity/year/rating/starStr/seller/tag/desc/want/sales/emoji/format)——18款,含中英文名称、分类、稀有度0-100、发行年份、格式(LP/CD/磁带/乐器/音箱/周边/耳机/设备)、想换物品等音像特色字段
  • 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套图鉴,含已收/总数/进度百分比
  • RecordReview点评(id/user/setName/starStr/content)——3条点评
  • ColorPalette配色(bg/card/black/red/deep/gold/green/sub/line)——9色配色常量

rarity稀有度字段是音像藏品的特色设计——0-100数值,通过rarityLabel函数映射为四级(传世级≥95/稀有级≥80/紧俏级≥60/流通级<60),通过rarityColor函数映射为四色(摩登红/橙/蓝/松石绿),在稀有度柱状图和唱片详情中直接渲染。format格式字段区分LP/CD/磁带/乐器/音箱/周边等不同格式,want想换物品字段支持以物换碟场景。

五、Tab0 唱片交易(双Tab嵌套)

唱片页是应用的核心,采用底部Tab+顶部Tab双层嵌套架构。顶部6个分类Tab(全部/黑胶/磁带/乐器/音箱/周边),每个Tab有独立的布局风格:

全部Tab:Banner+双列瀑布

  • 复古金渐变Banner:黑胶音乐节春季专场+经典唱片3天限时+首版神物/顶级乐器标签
  • 全城新上架:双列瀑布布局,左列2件(黑胶唱片机/摇滚T恤),右列1件(披头士海报,浅红高亮背景),每件含emoji/中文名/英文名/描述/价格/标签

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

  • 首版神物专区:3件横滑大卡(披头士Abbey Road/迈克尔杰克逊Thriller/邓丽君淡淡幽情),红黑渐变背景160宽,含emoji/名称/英文+年份/价格+稀有度标签
  • 稀有度排行:3根柱状图(95/88/98),第三根邓丽君用复古金高亮,底部说明"邓丽君淡淡幽情以98分稀有度登顶,市面流通不足十张"
  • 今日捡漏榜:3件排行列表,第1名摩登红数字,含排名/emoji/名称+稀有度+想换/价格

磁带Tab:鉴赏时间轴

  • 5套鉴赏教程时间轴布局(黑胶清洗保养指南/爵士乐入门指南/吉他基础教学/HiFi音响选购指南/卡拉OK演唱技巧),左侧emoji+复古金竖线连接,右侧卡片含名称/下载数/作者+类型+页数/步骤列表(带序号圆点)/点赞+教程可下载

乐器Tab:三列格子+交换建议

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

音箱Tab:对决卡+侧栏统计

  • 器材对决:芬达电吉他 VS 马歇尔音箱,两张红黑渐变对决卡中间VS标识
  • 左侧3件器材列表(雅马哈吉他/芬达电吉他/雅马哈电子琴),右侧3格统计(12本周器材成交摩登红/2.2万器材总交易额复古金/89%好评率松石绿)

周边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求购中复古金/¥9.8万累计成交额复古金)。

2. 我的求购清单:3件求购唱片(马歇尔音箱/披头士海报/摇滚T恤),每件含emoji/名称+预算+想换/右侧出价中标签(摩登红底浅红背景)。

3. 常去面交点:5个地点列表(汉口江滩/徐东古玩城/洪山广场站/楚河汉街站/线上互换),每个含不同emoji(🚇/🏬/🚌/🏪/📦)+地点名+右侧站点说明。

我的页通过求购清单和常去面交点两个特色功能,将复古音像交易的线下场景融入个人中心,让乐友可以管理自己的求购需求和常去的线下交易地点。

九、弹框体系

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

1. 发布出售弹框(新增):88%宽76%高,红黑渐变头部(💿发布出售+闲置回血神物不愁卖),滚动内容含:要出售的唱片(8款唱片chip选择,选中摩登红底白字)+成色说明(5档chip:全新未拆/仅拆封/9成新/8成新/有瑕疵,选中复古金底白字)+出售价格(−/¥价格/+步进器,步进10元,价格>2000显示"高价好物建议包邮"否则"实惠价更容易出手")+宝贝描述(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. 稀有度四级分级:rarity字段0-100数值,通过rarityLabel映射为四级标签(传世级≥95/稀有级≥80/紧俏级≥60/流通级<60),通过rarityColor映射为四色(摩登红/橙/蓝/松石绿),在柱状图、唱片详情、紧凑列表中统一渲染,数据驱动UI。

4. 红黑渐变头部设计:头部、首版神物大卡、发布出售弹框头部、我的页会员卡均使用黑胶黑#1A1A1A到暗红#8E2A2A或摩登红#D32F2F的linearGradient渐变,复古金#C9A24B文字和标签在深色背景上形成强烈对比,营造复古摩登感。

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. 详情数据取值方法:13个detailXxx方法(detailName/detailEng/detailEmoji/detailPrice/detailFormat/detailRarity/detailYear/detailSeller/detailTag/detailStar/detailRating/detailDesc/detailWant)通过遍历RECORDS数组查找selectedRecordId对应的唱片字段,在详情弹框中调用,避免在Builder中写复杂的查找逻辑。

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

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

十一、同类对比

维度 通用二手音像App 本应用(黑胶音像店)
主题 浅色/红色为主 黑胶黑+摩登红复古摩登风
架构 单Tab或简单分类 双Tab嵌套(底部4+顶部6)
动效 无或简单 14个粒子漂浮动效
稀有度 无或简单星级 0-100数值+四级分级+四色映射
以物换碟 无或简单留言 交换帖+我提供⇄我想换对称布局
鉴赏教程 无或外部链接 5套时间轴布局教程+步骤列表
收藏图鉴 无或简单收藏 6套图鉴+进度条+成就墙
求购清单 3件求购+预算+想换+出价中
常去面交点 5个地点+站点说明
弹框 2-3种 4种(发布出售/发起交换/下架/详情)

十二、完整代码结构总览

1303.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/selectedRecordId/4个弹框显隐/出售表单/交换表单/particles粒子)
│   ├── 生命周期(aboutToAppear生成粒子+启动定时器/aboutToDisappear清理定时器)
│   ├── 粒子方法(buildParticles/driftParticles)
│   ├── 详情取值方法(13个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

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

13.3 配置SDK

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

13.4 创建项目

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

13.5 运行应用

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

13.6 预览调试

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

十四、总结展望

本文完整解析了基于HarmonyOS 6.1.1的黑胶音像店应用,从黑胶黑+摩登红复古摩登配色系统、双Tab嵌套架构、唱片藏品数据模型(含稀有度0-100/格式/想换物品等特色字段)、唱片交易六大品类独立布局(全部双列瀑布/黑胶横滑大卡+稀有度柱状图+捡漏榜/磁带鉴赏时间轴/乐器三列网格/音箱对决卡+侧栏统计/周边标签云+紧凑列表)、换碟以物换物交换帖、收藏图鉴进度条、个人中心求购清单+常去面交点,到4种弹框体系、14粒子漂浮动效、稀有度四级分级、红黑渐变头部、全局纯函数工具集、详情数据取值方法,展现了ArkTS在复古音像二手交易场景下的完整工程实践。

核心价值:

  1. 黑胶黑+摩登红复古配色:6处linearGradient渐变营造唱片店的复古摩登韵味
  2. 双Tab嵌套架构:底部4Tab+顶部6Tab,双层分类浏览体验
  3. 14粒子漂浮动效:setInterval驱动emoji粒子漂浮,aboutToDisappear清理定时器
  4. 稀有度四级分级:0-100数值→四级标签→四色映射,数据驱动UI
  5. 以物换碟交换帖:我提供⇄我想换对称布局+热度标签动态生成+线下面交
  6. 收藏图鉴进度管理:6套图鉴+双色进度条+成就墙,收藏系统化
  7. 全局纯函数工具集:10+纯函数抽离数据到UI映射逻辑,代码可维护

未来可扩展:

  • 接入真实唱片数据库,自动识别唱片版本和稀有度,替代手动评级
  • 粒子动效接入设备陀螺仪,随手机倾斜方向漂移,增强沉浸感
  • 稀有度接入真实拍卖数据和市场行情,动态更新稀有度评分
  • 以物换碟接入智能匹配算法,根据唱片品类和价值推荐交换对象
  • 图鉴接入NFC扫码登记,扫描唱片/磁带NFC标签自动添加到图鉴
  • 接入直播开箱功能,乐友可以直播展示藏品请圈友在线鉴定
  • 求购清单接入推送通知,有匹配唱片时自动提醒乐友

黑胶音像店,让每一张老唱片都找到懂它的耳朵,让黑胶转动、岁月留声。


附录:完整源码

// ============================================================
// 1303.ets - 黑胶音像店
// 场景:黑胶唱片/乐器/音箱/磁带的二手交易与收藏社区(复古摩登风)
// 风格:黑胶黑 #1A1A1A + 摩登红 #D32F2F 经典音像风
// 底部Tab:唱片 / 换碟 / 图鉴 / 我的
// 顶部Tab:全部 / 黑胶 / 磁带 / 乐器 / 音箱 / 周边
// 弹框:发布出售(新增) / 发起交换(新增) / 下架(删除) / 唱片详情(详情)
// ============================================================
// ---------------- 配色 ----------------
interface ColorPalette {
bg: string;
card: string;
black: string;
red: string;
deep: string;
gold: string;
green: string;
sub: string;
line: string;
}
const PALETTE: ColorPalette = {
bg: '#F4F4F4',
card: '#FFFFFF',
black: '#1A1A1A',
red: '#D32F2F',
deep: '#0D0D0D',
gold: '#C9A24B',
green: '#4A7C59',
sub: '#8A8A8A',
line: '#E5E5E5'
};
// ---------------- 通用结构 ----------------
interface TabItem { label: string; icon: string; }
interface ParticleItem { x: number; emoji: string; size: number; speed: number; opacity: number; }
// ---------------- 唱片条目 ----------------
interface RecordItem {
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; format: 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 RecordReview {
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 RECORDS: RecordItem[] = [
{ id: 1, name: '披头士 Abbey Road', eng: 'Beatles Abbey Road', cat: 'retired', price: 3800, rarity: 95, year: 1969, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '老唱片博物馆', tag: '首版黑胶', desc: '英首版,封面品相极佳,盘面略有轻痕但不影响播放,收藏级神物。', want: '换 齐柏林飞艇', sales: 1, emoji: '🎸', format: 'LP' },
{ id: 2, name: '迈克尔·杰克逊 Thriller', eng: 'MJ Thriller', cat: 'retired', price: 2800, rarity: 88, year: 1982, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '流行乐之魂', tag: '全球销量王', desc: '美首版,包含原装海报,封套完好,流行音乐史上最伟大的唱片。', want: '换 麦当娜', sales: 3, emoji: '👑', format: 'LP' },
{ id: 3, name: '邓丽君 淡淡幽情', eng: 'Teresa Teng', cat: 'retired', price: 5800, rarity: 98, year: 1980, rating: 5.0, starStr: '⭐⭐⭐⭐⭐', seller: '君姐粉丝会', tag: '华语绝版', desc: '台湾首版,极其稀缺,歌词本完整,一代人的记忆,品相完美。', want: '面交诚换', sales: 2, emoji: '🌙', format: 'LP' },
{ id: 4, name: '爵士钢琴鉴赏指南', eng: 'Jazz Piano Guide', cat: 'moc', price: 39, rarity: 30, year: 2025, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '爵士乐评人', tag: '入门必读', desc: '从比波普到自由爵士,完整解析爵士钢琴大师的演奏风格与代表专辑。', want: '可换磁带', sales: 126, emoji: '🎹', format: '电子版' },
{ id: 5, name: '古典音乐大师合集', eng: 'Classical Masters', cat: 'moc', price: 89, rarity: 45, year: 2024, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '古典乐迷俱乐部', tag: '无损音质', desc: '贝多芬、莫扎特、巴赫全集高清无损音源,附完整曲目解析。', want: '换 乐器', sales: 98, emoji: '🎻', format: '数字版' },
{ id: 6, name: '打口碟 涅槃乐队', eng: 'Nirvana Nevermind', cat: 'moc', price: 1500, rarity: 80, year: 1991, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '垃圾摇滚老炮', tag: '打口带', desc: '美首版打口碟,经典垃圾摇滚神作,盘面完好,极具年代感。', want: '换 珍珠酱', sales: 8, emoji: '🤘', format: 'CD' },
{ id: 7, name: '卡带 邓丽君', eng: 'Teresa Teng Cassette', cat: 'fig', price: 1200, rarity: 90, year: 1983, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '磁带收藏家', tag: '原版磁带', desc: '港版磁带,外壳完好,音质清晰,非常罕见,华语磁带收藏极品。', want: '换 黑胶', sales: 5, emoji: '📼', format: '磁带' },
{ id: 8, name: '卡带 张国荣', eng: 'Leslie Cheung', cat: 'fig', price: 800, rarity: 75, year: 1985, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '哥哥粉丝会', tag: '港版磁带', desc: '经典港版磁带,包装精美,无损音质,荣迷必收。', want: '换 梅艳芳', sales: 12, emoji: '🎤', format: '磁带' },
{ id: 9, name: '卡带 周杰伦 范特西', eng: 'Jay Chou Fantasy', cat: 'fig', price: 1000, rarity: 85, year: 2001, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '杰伦铁粉', tag: '巅峰卡带', desc: '台版卡带,收藏级,华语流行乐里程碑作品,极其少见。', want: '换 CD', sales: 9, emoji: '🎧', format: '磁带' },
{ id: 10, name: '雅马哈 吉他', eng: 'Yamaha Acoustic', cat: 'tech', price: 3500, rarity: 50, year: 2015, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '吉他手老白', tag: '民谣吉他', desc: '雅马哈FG系列,音色温暖,手感极佳,无磕碰,带原装琴包。', want: '换 电吉他', sales: 6, emoji: '🎸', format: '乐器' },
{ id: 11, name: '芬达 电吉他', eng: 'Fender Stratocaster', cat: 'tech', price: 8800, rarity: 65, year: 2010, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: '摇滚老哥', tag: '经典琴型', desc: '美产Fender,经典三单拾音器,音色清晰,可玩性极高,带硬盒。', want: '换 吉普森', sales: 2, emoji: '🎸', format: '乐器' },
{ id: 12, name: '雅马哈 电子琴', eng: 'Yamaha Keyboard', cat: 'tech', price: 1800, rarity: 35, year: 2018, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '键盘手阿杰', tag: '入门神器', desc: '61键电子琴,功能齐全,音色优美,适合练习和演出,成色极新。', want: '换 音箱', sales: 11, emoji: '🎹', format: '乐器' },
{ id: 13, name: '马歇尔 音箱', eng: 'Marshall Speaker', cat: 'street', price: 1200, rarity: 40, year: 2020, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '摇滚青年', tag: '经典箱头', desc: '马歇尔蓝牙音箱,复古造型,音质爆棚,经典摇滚风,带原包装。', want: '换 吉他', sales: 15, emoji: '🔊', format: '音箱' },
{ id: 14, name: '铁三角 耳机', eng: 'Audio-Technica Headphones', cat: 'street', price: 600, rarity: 30, year: 2022, rating: 4.7, starStr: '⭐⭐⭐⭐', seller: '发烧友小陈', tag: '监听耳机', desc: '铁三角监听耳机,声场开阔,低频扎实,适合欣赏音乐,成色好。', want: '换 外设', sales: 20, emoji: '🎧', format: '耳机' },
{ id: 15, name: '宝华韦健 音响', eng: 'Bowers & Wilkins', cat: 'street', price: 5000, rarity: 55, year: 2019, rating: 4.9, starStr: '⭐⭐⭐⭐⭐', seller: 'HiFi发烧友', tag: '极致音质', desc: '宝华韦健书架音箱,原装进口,中高频通透,低频震撼,成色极佳。', want: '换 CD机', sales: 4, emoji: '🔊', format: '音箱' },
{ id: 16, name: '披头士 海报', eng: 'Beatles Poster', cat: 'classic', price: 500, rarity: 60, year: 1970, rating: 4.6, starStr: '⭐⭐⭐⭐', seller: '海报收藏家', tag: '原版海报', desc: '披头士经典海报,品相完整,无折痕,极具历史意义和收藏价值。', want: '换 周边', sales: 8, emoji: '🖼️', format: '周边' },
{ id: 17, name: '黑胶唱片机', eng: 'Turntable', cat: 'classic', price: 2800, rarity: 45, year: 2016, rating: 4.8, starStr: '⭐⭐⭐⭐✨', seller: '音乐器材铺', tag: '复古留声机', desc: '复古黑胶唱机,带蓝牙功能,可播放现代唱片,做工精致。', want: '换 音箱', sales: 7, emoji: '📻', format: '设备' },
{ id: 18, name: '摇滚T恤', eng: 'Rock T-Shirt', cat: 'classic', price: 200, rarity: 25, year: 2023, rating: 4.5, starStr: '⭐⭐⭐⭐', seller: '乐队周边', tag: '限量版', desc: '经典摇滚乐队限量T恤,全新未拆,各种尺码可选,粉丝必买。', want: '换 卡带', sales: 30, emoji: '👕', format: '周边' }
];
// ---------------- 交换帖数据(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: '涅槃CD', want: '珍珠酱CD', time: '昨天 18:42', likes: 61, content: '打口碟换打口碟,都是90年代经典,多换一好商量。', 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: 'CD机', time: '3天前 22:08', likes: 55, content: '台版卡带换CD机,都是情怀,愿补差价,面交优先。', place: '武昌火车站' },
{ id: 8, user: '周边收藏家', avatar: '👕', offer: '限量T恤', want: '任意周边', time: '4天前 14:26', likes: 17, content: '全新未拆T恤换任意周边,学生党优先,主要是想换喜欢的东西。', place: '线上交换' }
];
// ---------------- 鉴赏/教程数据(5条写死) ----------------
const GUIDES: GuideItem[] = [
{ id: 1, name: '黑胶清洗保养指南', type: '保养', pages: 20, author: '老唱片博物馆', likes: 342, downloads: 2100, emoji: '💿', steps: ['清洗液配方 1-5页', '洗碟机操作 6-12页', '存放环境要求 13-20页'] },
{ id: 2, name: '爵士乐入门指南', type: '鉴赏', pages: 45, author: '爵士乐评人', likes: 276, downloads: 1580, emoji: '🎷', steps: ['爵士乐历史 1-15页', '代表人物介绍 16-30页', '必听专辑推荐 31-45页'] },
{ id: 3, name: '吉他基础教学', type: '乐器', pages: 80, author: '吉他手老白', likes: 415, downloads: 3300, emoji: '🎸', steps: ['持琴姿势 1-10页', '和弦指法 11-40页', '节奏练习 41-60页', '进阶技巧 61-80页'] },
{ id: 4, name: 'HiFi音响选购指南', type: '设备', pages: 50, author: '发烧友小陈', likes: 198, downloads: 1260, emoji: '🔊', steps: ['预算规划 1-12页', '品牌对比 13-30页', '试音技巧 31-50页'] },
{ id: 5, name: '卡拉OK演唱技巧', type: '声乐', pages: 60, author: '声乐老师', likes: 233, downloads: 1420, emoji: '🎤', steps: ['发声方法 1-20页', '气息控制 21-40页', '情感表达 41-60页'] }
];
// ---------------- 配件/周边数据(9条写死) ----------------
const ACCESSORIES: AccessoryItem[] = [
{ id: 1, name: '黑胶防静电袋', series: '透明', price: 30, condition: '全新', seller: '唱片配件铺', emoji: '🛍️', desc: '防静电材质,保护唱片' },
{ id: 2, name: '吉他拨片套装', series: '多色', price: 25, condition: '全新', seller: '乐器配件', emoji: '🎼', desc: '多种厚度,适合不同风格' },
{ id: 3, name: '音箱防尘罩', series: '通用', price: 80, condition: '9成新', seller: '音响配件', emoji: '🛡️', desc: '防尘防刮,有效保护音箱' },
{ id: 4, name: '磁带清洁剂', series: '进口', price: 50, condition: '全新', seller: '磁带修复', emoji: '🧪', desc: '清洁磁头,提升音质' },
{ id: 5, name: '耳机收纳盒', series: '硬壳', price: 60, condition: '全新', seller: '耳机配件', emoji: '🎁', desc: '防压防摔,便于携带' },
{ id: 6, name: '黑胶唱片机针头', series: '钻石', price: 150, condition: '全新', seller: '设备维修', emoji: '💎', desc: '高品质针头,音质细腻' },
{ id: 7, name: '吉他背带', series: '真皮', price: 120, condition: '9成新', seller: '乐器配件', emoji: '🎸', desc: '舒适透气,宽度适中' },
{ id: 8, name: '音乐主题笔记本', series: '复古', price: 40, condition: '全新', seller: '文创产品', emoji: '📓', desc: '记录灵感和歌词' },
{ id: 9, name: '演唱会应援灯', series: 'LED', price: 30, condition: '全新', seller: '周边礼品', emoji: '💡', desc: '七彩变换,气氛拉满' }
];
// ---------------- 图鉴收藏数据(6条写死) ----------------
const COLLECTIONS: CollectionItem[] = [
{ id: 1, name: '黑胶唱片', series: 'Vinyl', owned: 12, total: 30, rate: 40, emoji: '💿' },
{ id: 2, name: '经典卡带', series: 'Cassette', owned: 8, total: 20, rate: 40, emoji: '📼' },
{ id: 3, name: '乐器收藏', series: 'Instrument', owned: 3, total: 10, rate: 30, emoji: '🎸' },
{ id: 4, name: '音箱设备', series: 'Audio', owned: 4, total: 8, rate: 50, emoji: '🔊' },
{ id: 5, name: '音乐周边', series: 'Merch', owned: 6, total: 15, rate: 40, emoji: '🎁' },
{ id: 6, name: '演唱会经历', series: 'Live', owned: 5, total: 10, rate: 50, emoji: '🎤' }
];
// ---------------- 点评数据(3条写死) ----------------
const RECORD_REVIEWS: RecordReview[] = [
{ 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, 48, 112, 166, 148];
// ---------------- 弹框选项 ----------------
const CONDITION_OPTIONS: string[] = ['全新未拆', '仅拆封', '9成新', '8成新', '有瑕疵'];
const PLACES: string[] = ['汉口江滩', '徐东古玩城', '洪山广场站', '楚河汉街站', '线上互换'];
// ---------------- 全局纯函数 ----------------
function catColor(cat: string): string {
if (cat === 'retired') return '#D32F2F';
if (cat === 'moc') return '#7C4DFF';
if (cat === 'fig') return '#4A7C59';
if (cat === 'tech') return '#C9A24B';
if (cat === 'street') return '#1E88E5';
return '#1A1A1A';
}
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 '传世级';
if (r >= 80) return '稀有级';
if (r >= 60) return '紧俏级';
return '流通级';
}
function rarityColor(r: number): string {
if (r >= 95) return '#D32F2F';
if (r >= 80) return '#FF8A00';
if (r >= 60) return '#1E88E5';
return '#4A7C59';
}
function tradeBarHeight(v: number): string {
return Math.round(v / 166 * 96).toString() + 'vp';
}
function rateColor(r: number): string {
if (r >= 55) return '#4A7C59';
if (r >= 40) return '#C9A24B';
return '#D32F2F';
}
function retiredSets(): RecordItem[] { return [RECORDS[0], RECORDS[1], RECORDS[2]]; }
function mocSets(): RecordItem[] { return [RECORDS[3], RECORDS[4], RECORDS[5]]; }
function figSets(): RecordItem[] { return [RECORDS[6], RECORDS[7], RECORDS[8]]; }
function techSets(): RecordItem[] { return [RECORDS[9], RECORDS[10], RECORDS[11]]; }
function streetSets(): RecordItem[] { return [RECORDS[12], RECORDS[13], RECORDS[14]]; }
function classicSets(): RecordItem[] { return [RECORDS[15], RECORDS[16], RECORDS[17]]; }
function cityLeft(): RecordItem[] { return [RECORDS[16], RECORDS[17]]; }
function cityRight(): RecordItem[] { return [RECORDS[15]]; }
function hotSets(): RecordItem[] { return [RECORDS[3], RECORDS[5], RECORDS[16], RECORDS[17], RECORDS[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 selectedRecordId: number = 1;
@State showSellModal: boolean = false;
@State showSwapModal: boolean = false;
@State showDeleteModal: boolean = false;
@State showDetailModal: boolean = false;
@State sellRecordIdx: 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 < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].name; return ''; }
detailEng(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].eng; return ''; }
detailEmoji(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].emoji; return '💿'; }
detailPrice(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return '¥' + RECORDS[i].price.toString(); return ''; }
detailFormat(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].format; return ''; }
detailRarity(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].rarity.toString(); return ''; }
detailYear(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].year.toString(); return ''; }
detailSeller(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].seller; return ''; }
detailTag(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].tag; return ''; }
detailStar(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].starStr; return ''; }
detailRating(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].rating.toFixed(1) + '分'; return ''; }
detailDesc(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].desc; return ''; }
detailWant(): string { for (let i = 0; i < RECORDS.length; i++) if (RECORDS[i].id === this.selectedRecordId) return RECORDS[i].want; return ''; }
// ---------------- 头部 ----------------
@Builder
headerBuilder() {
Column() {
Row() {
Column() {
Text('🎧 黑胶音像店').fontSize(22).fontWeight(FontWeight.Bold).fontColor('#FFFFFF')
Text('听歌 · 收藏 · 换器材').fontSize(11).fontColor('#F5C1C1').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('#D32F2F').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('#E8B4B4').layoutWeight(1)
Text('🧰 我的求购').fontSize(11).fontColor('#D32F2F').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: [['#1A1A1A', 0], ['#8E2A2A', 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 ? '#D32F2F' : '#8A8A8A').fontWeight(this.currentTopTab === idx ? FontWeight.Bold : FontWeight.Normal).margin({ top: 2 })
if (this.currentTopTab === idx) {
Divider().width(16).strokeWidth(3).color('#C9A24B').borderRadius(2).margin({ top: 4 })
} else {
Divider().width(16).strokeWidth(3).color('#F4F4F4').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('#1A1A1A')
Text('经典唱片 3天限时 · 卖家免服务费').fontSize(12).fontColor('#5B6B7F').margin({ top: 6 })
Row({ space: 10 }) {
Text('🏆 首版神物').fontSize(11).fontColor('#1A1A1A').backgroundColor('#FFFFFF').borderRadius(12).padding({ left: 10, right: 10, top: 4, bottom: 4 })
Text('🎸 顶级乐器').fontSize(11).fontColor('#1A1A1A').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: [['#C9A24B', 0], ['#E2CE94', 1]] }).borderRadius(16)
Text('✨ 全城新上架').fontSize(15).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(cityLeft(), (t: RecordItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 16 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#8A8A8A').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#8A8A8A').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('#D32F2F').backgroundColor('#F5E1E1').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.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem) => 'cl' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
ForEach(cityRight(), (t: RecordItem) => {
Column() {
Text(t.emoji).fontSize(34).margin({ top: 24 })
Text(t.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').margin({ top: 8 })
Text(t.eng).fontSize(9).fontColor('#8A8A8A').margin({ top: 2 })
Text(t.desc).fontSize(11).fontColor('#8A8A8A').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('#F5E1E1').borderRadius(14).alignItems(HorizontalAlign.Start).padding({ left: 14, right: 14 })
.onClick(() => { this.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem) => '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('#1A1A1A').width('100%')
Scroll() {
Row({ space: 12 }) {
ForEach(retiredSets(), (t: RecordItem) => {
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('#F5C1C1').margin({ top: 4 })
Row({ space: 6 }) {
Text('¥' + t.price.toString()).fontSize(16).fontWeight(FontWeight.Bold).fontColor('#E2CE94')
Text(rarityLabel(t.rarity)).fontSize(10).fontColor('#1A1A1A').backgroundColor('#C9A24B').borderRadius(8).padding({ left: 6, right: 6, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width(160).linearGradient({ angle: 160, colors: [['#D32F2F', 0], ['#1A1A1A', 1]] }).borderRadius(16).alignItems(HorizontalAlign.Center)
.onClick(() => { this.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem) => '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('#1A1A1A').width('100%')
Row({ space: 6 }) {
ForEach(retiredSets(), (t: RecordItem, i: number) => {
Column({ space: 5 }) {
Text(t.rarity.toString()).fontSize(9).fontColor('#D32F2F')
Column().width(34).height((t.rarity).toString() + 'vp').backgroundColor(i === 2 ? '#C9A24B' : '#D32F2F').borderRadius({ topLeft: 5, topRight: 5 })
Text(t.year.toString() + '年').fontSize(9).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Center).layoutWeight(1)
}, (t: RecordItem, i: number) => 'rb' + i.toString() + t.id.toString())
}.width('100%').justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Bottom).padding({ top: 12 })
Text('邓丽君 淡淡幽情以98分稀有度登顶,市面流通不足十张').fontSize(10).fontColor('#8A8A8A').margin({ top: 8 })
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14).margin({ left: 14, right: 14 })
Column() {
Text('🕵️ 今日捡漏榜').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%').margin({ bottom: 8 })
ForEach(retiredSets(), (t: RecordItem, i: number) => {
Row({ space: 10 }) {
Text((i + 1).toString()).fontSize(14).fontWeight(FontWeight.Bold).fontColor(i === 0 ? '#D32F2F' : '#8A8A8A').width(20)
Text(t.emoji).fontSize(18)
Column() {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#1A1A1A')
Text(rarityLabel(t.rarity) + ' · ' + t.want).fontSize(10).fontColor('#8A8A8A').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.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem, 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('#1A1A1A').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('#C9A24B').margin({ top: 4 })
}
}.width(40).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) {
Row({ space: 8 }) {
Text(m.name).fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').layoutWeight(1)
Text('⬇ ' + m.downloads.toString()).fontSize(10).fontColor('#D32F2F')
}.width('100%')
Text('by ' + m.author + ' · ' + m.type + ' · ' + m.pages.toString() + '页').fontSize(10).fontColor('#8A8A8A')
Column({ space: 5 }) {
ForEach(m.steps, (s: string, si: number) => {
Row({ space: 8 }) {
Text((si + 1).toString()).fontSize(9).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').backgroundColor('#F4F4F4').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('#F4F4F4').borderRadius(10).padding(10)
Row({ space: 8 }) {
Text('❤️ ' + m.likes.toString()).fontSize(10).fontColor('#D32F2F')
Text(m.emoji + ' 教程可下载').fontSize(10).fontColor('#C9A24B').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
}.layoutWeight(1).backgroundColor(i === 1 ? '#F5E1E1' : '#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('#1A1A1A').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('#1A1A1A').margin({ top: 6 }).maxLines(1)
Text(f.series).fontSize(8).fontColor('#8A8A8A').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.selectedRecordId = 7 + f.id % 3; this.showDetailModal = true; })
}, (f: AccessoryItem) => 'fg' + f.id.toString())
}.width('100%')
Column() {
Text('🤝 配件交换行情').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').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('#1A1A1A')
Text(f.desc).fontSize(10).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('¥' + f.price.toString()).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#4A7C59')
}.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('#1A1A1A').width('100%')
Row({ space: 10 }) {
Column() {
Text('🎸').fontSize(34).margin({ top: 14 })
Text('芬达电吉他').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('2010年 · 现价¥8800').fontSize(10).fontColor('#F5C1C1').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#D32F2F', 0], ['#1A1A1A', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
Column() {
Text('VS').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
Text('本周').fontSize(9).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Center)
Column() {
Text('🔊').fontSize(34).margin({ top: 14 })
Text('马歇尔音箱').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').margin({ top: 6 })
Text('2020年 · 现价¥1200').fontSize(10).fontColor('#F5C1C1').margin({ top: 4, bottom: 14 })
}.layoutWeight(1).linearGradient({ angle: 150, colors: [['#8A8A8A', 0], ['#1A1A1A', 1]] }).borderRadius(14).alignItems(HorizontalAlign.Center)
}.width('100%')
Row({ space: 10 }) {
Column({ space: 10 }) {
ForEach(techSets(), (t: RecordItem) => {
Row({ space: 10 }) {
Text(t.emoji).fontSize(22)
Column({ space: 2 }) {
Text(t.name).fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A')
Text(t.tag + ' · ' + t.format).fontSize(10).fontColor('#8A8A8A')
}.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.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem) => 'tc' + t.id.toString())
}.layoutWeight(1)
Column({ space: 10 }) {
Column({ space: 4 }) {
Text('12').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#D32F2F')
Text('本周器材成交').fontSize(9).fontColor('#8A8A8A')
}.width('100%').backgroundColor('#F5E1E1').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('2.2万').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#C9A24B')
Text('器材总交易额').fontSize(9).fontColor('#8A8A8A')
}.width('100%').backgroundColor('#F5EFE0').borderRadius(12).padding({ top: 10, bottom: 10 }).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) {
Text('89%').fontSize(18).fontWeight(FontWeight.Bold).fontColor('#4A7C59')
Text('好评率').fontSize(9).fontColor('#8A8A8A')
}.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('#1A1A1A').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('#1A1A1A').backgroundColor('#F5E1E1').borderRadius(12).padding({ left: 10, right: 10, top: 6, bottom: 6 }).margin(4)
}, (c: CollectionItem) => 'ccoll' + c.id.toString())
}.width('100%')
ForEach(streetSets(), (t: RecordItem) => {
Row({ space: 12 }) {
Text(t.emoji).fontSize(24)
Column({ space: 2 }) {
Row({ space: 6 }) {
Text(t.name).fontSize(13).fontWeight(FontWeight.Bold).fontColor('#1A1A1A')
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('#8A8A8A').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 ? '#F5E1E1' : '#FFFFFF').borderRadius(12).padding(12).onClick(() => { this.selectedRecordId = t.id; this.showDetailModal = true; })
}, (t: RecordItem) => 'st' + t.id.toString())
Text('💬 集齐三大乐队可召唤隐藏福利:披头士+滚石+齐柏林飞艇').fontSize(10).fontColor('#8A8A8A').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('#D32F2F'); Text('在交换中').fontSize(10).fontColor('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('42').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#C9A24B'); Text('今日成交').fontSize(10).fontColor('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text('98%').fontSize(20).fontWeight(FontWeight.Bold).fontColor('#4A7C59'); Text('面交好评').fontSize(10).fontColor('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 6 }) { Text('🤝 发交换').fontSize(12).fontColor('#FFFFFF').backgroundColor('#D32F2F').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('#1A1A1A')
Text(swapBadge(s.likes)).fontSize(8).fontColor('#D32F2F').backgroundColor('#F5E1E1').borderRadius(6).padding({ left: 5, right: 5, top: 1, bottom: 1 })
}
Text(s.time + ' · ' + s.place).fontSize(9).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('⋯').fontSize(16).fontColor('#8A8A8A').onClick(() => { this.showDeleteModal = true; })
}.width('100%')
Row({ space: 10 }) {
Column({ space: 4 }) { Text('我提供').fontSize(9).fontColor('#D32F2F'); Text(s.offer).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1A1A1A') }.layoutWeight(1).backgroundColor('#F5E1E1').borderRadius(10).padding(8).alignItems(HorizontalAlign.Center)
Text('⇄').fontSize(14).fontColor('#C9A24B')
Column({ space: 4 }) { Text('我想换').fontSize(9).fontColor('#D32F2F'); Text(s.want).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1A1A1A') }.layoutWeight(1).backgroundColor('#F5EFE0').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('#D32F2F').backgroundColor('#F4F4F4').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('#1A1A1A')
Text('记录每一张心头好的收藏进度').fontSize(10).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('✚ 登记').fontSize(12).fontColor('#FFFFFF').backgroundColor('#D32F2F').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('#1A1A1A')
Text(c.series + ' · 已收 ' + c.owned.toString() + '/' + c.total.toString()).fontSize(10).fontColor('#8A8A8A')
}.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('#E5E5E5').borderRadius(3)
}.width('100%')
}.width('100%').backgroundColor(c.id === 5 ? '#F5EFE0' : '#FFFFFF').borderRadius(14).padding(14)
}, (c: CollectionItem) => 'coll' + c.id.toString())
Column() {
Text('🏅 图鉴成就墙').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%').margin({ bottom: 8 })
Flex({ wrap: FlexWrap.Wrap }) {
Text('🎖️ 黑胶收集狂').fontSize(10).fontColor('#D32F2F').backgroundColor('#F5E1E1').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🏆 首版珍藏家').fontSize(10).fontColor('#C9A24B').backgroundColor('#F5EFE0').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🎸 乐器达人').fontSize(10).fontColor('#4A7C59').backgroundColor('#E8F7EF').borderRadius(10).padding({ left: 8, right: 8, top: 5, bottom: 5 }).margin(4)
Text('🎤 演唱会达人').fontSize(10).fontColor('#1E88E5').backgroundColor('#E8F0FE').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('#F5C1C1')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('>').fontSize(18).fontColor('#F5C1C1')
}.width('100%')
Row({ space: 0 }) {
Column({ space: 3 }) { Text('38').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#E2CE94'); Text('在售唱片').fontSize(9).fontColor('#F5C1C1') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('12').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#E2CE94'); Text('求购中').fontSize(9).fontColor('#F5C1C1') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 3 }) { Text('¥9.8万').fontSize(16).fontWeight(FontWeight.Bold).fontColor('#E2CE94'); Text('累计成交额').fontSize(9).fontColor('#F5C1C1') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').margin({ top: 16 })
}.width('100%').padding(18).linearGradient({ angle: 120, colors: [['#1A1A1A', 0], ['#8E2A2A', 1]] }).borderRadius(16).margin({ top: 10 })
Column() {
Text('🔨 我的求购清单').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%').margin({ bottom: 6 })
ForEach(RECORDS, (t: RecordItem) => {
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('#1A1A1A')
Text('预算 ¥' + t.price.toString() + ' 内 · ' + t.want).fontSize(9).fontColor('#8A8A8A')
}.alignItems(HorizontalAlign.Start).layoutWeight(1)
Text('出价中').fontSize(10).fontColor('#D32F2F').backgroundColor('#F5E1E1').borderRadius(10).padding({ left: 8, right: 8, top: 3, bottom: 3 })
}.width('100%').padding({ top: 9, bottom: 9 })
}
}, (t: RecordItem) => 'wish' + t.id.toString())
}.width('100%').backgroundColor('#FFFFFF').borderRadius(14).padding(14)
Column() {
Text('📍 常去面交点').fontSize(14).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').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('#1A1A1A').layoutWeight(1)
Text(['汉口站台', '徐东入口', '洪山转盘', '楚河入口', '顺丰网点'][i]).fontSize(9).fontColor('#8A8A8A')
}.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 ? '#D32F2F' : '#8A8A8A').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('#F5C1C1').margin({ top: 4, bottom: 16 })
}.width('100%').linearGradient({ angle: 120, colors: [['#D32F2F', 0], ['#1A1A1A', 1]] }).borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('要出售的唱片').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(RECORDS, (t: RecordItem, i: number) => {
if (i < 8) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.sellRecordIdx === i ? '#FFFFFF' : '#1A1A1A').backgroundColor(this.sellRecordIdx === i ? '#D32F2F' : '#F5E1E1').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.sellRecordIdx = i; })
}
}, (t: RecordItem, 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('#1A1A1A').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(CONDITION_OPTIONS, (c: string, i: number) => {
Text(c).fontSize(10).fontColor(this.sellCondIdx === i ? '#FFFFFF' : '#C9A24B').backgroundColor(this.sellCondIdx === i ? '#C9A24B' : '#F5EFE0').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('#1A1A1A')
Row({ space: 0 }) {
Text('−').fontSize(16).fontColor('#D32F2F').backgroundColor('#F5E1E1').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('#1A1A1A').backgroundColor('#FFFFFF').height(30).textAlign(TextAlign.Center).padding({ left: 14, right: 14 })
Text('+').fontSize(16).fontColor('#FFFFFF').backgroundColor('#D32F2F').borderRadius({ topRight: 10, bottomRight: 10 }).width(34).height(30).textAlign(TextAlign.Center).onClick(() => { if (this.sellPrice < 9999) { this.sellPrice += 10; } })
}.borderRadius(10)
Text(this.sellPrice > 2000 ? '💰 高价好物建议包邮' : '实惠价更容易出手').fontSize(9).fontColor(this.sellPrice > 2000 ? '#D32F2F' : '#8A8A8A').layoutWeight(1).textAlign(TextAlign.End)
}.width('100%')
Column({ space: 8 }) {
Text('宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
TextInput({ placeholder: '成色、瑕疵、配件情况如实描述…', text: this.sellWords }).fontSize(12).fontColor('#1A1A1A').backgroundColor('#F4F4F4').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('#8A8A8A').backgroundColor('#F4F4F4').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSellModal = false; })
Text('上架出售').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#D32F2F').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('#1A1A1A') }.margin({ top: 16 })
Text('用闲置换心头好,乐友互助').fontSize(11).fontColor('#5B6B7F').margin({ top: 4, bottom: 14 })
}.width('100%').backgroundColor('#C9A24B').borderRadius({ topLeft: 18, topRight: 18 })
Scroll() {
Column({ space: 14 }) {
Column({ space: 8 }) {
Text('我提供').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(RECORDS, (t: RecordItem, i: number) => {
if (i % 3 === 0 && i < 15) {
Text(t.emoji + ' ' + t.name).fontSize(10).fontColor(this.swapOfferIdx === i ? '#FFFFFF' : '#1A1A1A').backgroundColor(this.swapOfferIdx === i ? '#1A1A1A' : '#F4F4F4').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.swapOfferIdx = i; })
}
}, (t: RecordItem, 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('#1A1A1A').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(RECORDS, (t: RecordItem, 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' : '#F5E1E1').borderRadius(12).padding({ left: 9, right: 9, top: 5, bottom: 5 }).margin(4).onClick(() => { this.toggleWant(i); })
}
}, (t: RecordItem, 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('#1A1A1A').width('100%')
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(PLACES, (p: string, i: number) => {
Text(p).fontSize(10).fontColor(this.swapPlaceIdx === i ? '#FFFFFF' : '#D32F2F').backgroundColor(this.swapPlaceIdx === i ? '#D32F2F' : '#F5E1E1').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('#8A8A8A').lineHeight(15).layoutWeight(1)
}.width('100%').backgroundColor('#F5EFE0').borderRadius(10).padding(10)
Row({ space: 12 }) {
Text('再想想').fontSize(13).fontColor('#8A8A8A').backgroundColor('#F4F4F4').borderRadius(20).layoutWeight(1).height(42).textAlign(TextAlign.Center).onClick(() => { this.showSwapModal = false; })
Text('发布交换帖').fontSize(13).fontWeight(FontWeight.Bold).fontColor('#FFFFFF').backgroundColor('#D32F2F').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('#1A1A1A')
Text('下架后买家将无法搜索到这条信息,\n收藏和留言会一并清空,可重新上架。').fontSize(11).fontColor('#8A8A8A').textAlign(TextAlign.Center).lineHeight(17)
Row({ space: 12 }) {
Text('留着').fontSize(13).fontColor('#D32F2F').backgroundColor('#F5E1E1').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('#1A1A1A').margin({ top: 8 })
Text(this.detailEng()).fontSize(10).fontColor('#5B6B7F').margin({ top: 2 })
Row({ space: 8 }) {
Text(this.detailTag()).fontSize(9).fontColor('#FFFFFF').backgroundColor('#D32F2F').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
Text(rarityLabel(Number(this.detailRarity()))).fontSize(9).fontColor('#1A1A1A').backgroundColor('#C9A24B').borderRadius(8).padding({ left: 7, right: 7, top: 2, bottom: 2 })
}.margin({ top: 10, bottom: 18 })
}.width('100%').linearGradient({ angle: 135, colors: [['#C9A24B', 0], ['#F5E1E1', 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('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailFormat()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#1A1A1A'); Text('格式').fontSize(9).fontColor('#8A8A8A') }.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('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
Column({ space: 4 }) { Text(this.detailYear()).fontSize(17).fontWeight(FontWeight.Bold).fontColor('#C9A24B'); Text('发行年份').fontSize(9).fontColor('#8A8A8A') }.layoutWeight(1).alignItems(HorizontalAlign.Center)
}.width('100%').backgroundColor('#F4F4F4').borderRadius(12).padding({ top: 12, bottom: 12 })
Column({ space: 8 }) {
Text('🧾 宝贝描述').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
Text(this.detailDesc()).fontSize(11).fontColor('#4A5A6E').lineHeight(18)
Row({ space: 8 }) {
Text('👤 ' + this.detailSeller()).fontSize(10).fontColor('#D32F2F')
Text(this.detailStar() + ' ' + this.detailRating()).fontSize(10).fontColor('#C9A24B').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('#F5E1E1').borderRadius(10).padding(10)
Column({ space: 10 }) {
Text('💬 圈友点评').fontSize(12).fontWeight(FontWeight.Bold).fontColor('#1A1A1A').width('100%')
ForEach(RECORD_REVIEWS, (r: RecordReview) => {
Column({ space: 5 }) {
Row({ space: 8 }) { Text('👤').fontSize(14); Text(r.user).fontSize(11).fontWeight(FontWeight.Bold).fontColor('#1A1A1A'); Text(r.starStr).fontSize(9).layoutWeight(1).textAlign(TextAlign.End) }.width('100%')
Text(r.content).fontSize(10).fontColor('#8A8A8A').lineHeight(15)
}.width('100%').backgroundColor('#F4F4F4').borderRadius(10).padding(10)
}, (r: RecordReview) => 'rv' + r.id.toString())
}.width('100%').alignItems(HorizontalAlign.Start)
Row({ space: 12 }) {
Text('💬 留言问问').fontSize(13).fontColor('#D32F2F').backgroundColor('#F5E1E1').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)
}
}

ignment.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、测试、元服务和应用上架分发等。

更多推荐