feat(ywq): 新增垃圾箱功能

- 添加垃圾箱列表接口和相关数据模型
- 实现垃圾箱视图,包括列表展示和筛选功能
- 优化订单项组件,增加作废、删除等状态展示
- 更新路由配置,支持垃圾箱页面导航- 重构列表对话框组件,支持单选和取消功能
这个提交包含在:
徐勤民 2024-11-07 15:28:14 +08:00
父节点 97b29f3e99
当前提交 aa3dded15c
共有 2 个文件被更改,包括 78 次插入36 次删除

查看文件

@ -110,7 +110,7 @@ export struct XWebview {
.justifyContent(FlexAlign.SpaceBetween) .justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 15, right: 15 }) .padding({ left: 15, right: 15 })
Divider().height(2).color(0xCCCCCC) Row().backgroundColor('#CCCCCC').height(2).width('100%')
Progress({ value: this.progress, type: ProgressType.Linear }) Progress({ value: this.progress, type: ProgressType.Linear })
.visibility(this.progress > 95 || this.progress == 0 ? Visibility.None : Visibility.Visible) .visibility(this.progress > 95 || this.progress == 0 ? Visibility.None : Visibility.Visible)
.width('100%') .width('100%')

查看文件

@ -28,6 +28,7 @@ export interface ConfirmOptions {
export interface ListOptions<T> { export interface ListOptions<T> {
title?: string title?: string
cancel?: Btn cancel?: Btn
index?: number
alignment?: DialogAlignment alignment?: DialogAlignment
values: Array<T> values: Array<T>
onSelected: (index: number, value: T) => void onSelected: (index: number, value: T) => void
@ -43,22 +44,39 @@ function customDialogBuilder<T>(option: ListOptions<T>, dialogTag: string) {
Column() { Column() {
Text(option.title) Text(option.title)
.fontSize(13) .fontSize(16)
.fontColor('#00BE87')
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
.width('60%') .width('100%')
.maxLines(2) .height(60)
.ellipsisMode(EllipsisMode.END) .backgroundColor('#F0FFFA')
.textOverflow({ .borderRadius({
overflow: TextOverflow.Ellipsis topLeft: 10,
topRight: 10
}) })
.visibility(option.title ? Visibility.Visible : Visibility.None) .visibility(option.title ? Visibility.Visible : Visibility.None)
List({ space: 20, initialIndex: 0 }) { Column(){
ForEach(option.values, (item: T, index: number) => { List() {
ListItem() { ForEach(option.values, (item: T, index: number) => {
Text(typeof item === "string" ? item : (item as ListItem).content) ListItem() {
Row() {
Text(typeof item === "string" ? item : (item as ListItem).content)
.fontSize(option.index === index ? 16 : 14)
.fontWeight(option.index === index ? FontWeight.Bold : FontWeight.Normal)
.maxLines(1)
.width('70%')
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.textAlign(TextAlign.Center)
.align(Alignment.Center)
.fontColor('#11102C')
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.height(60)
.width('100%') .width('100%')
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => { .onClick(() => {
if (ToolsHelper.mapDialog.get(dialogTag)) { if (ToolsHelper.mapDialog.get(dialogTag)) {
promptAction.closeCustomDialog(ToolsHelper.mapDialog.get(dialogTag)) promptAction.closeCustomDialog(ToolsHelper.mapDialog.get(dialogTag))
@ -66,29 +84,47 @@ function customDialogBuilder<T>(option: ListOptions<T>, dialogTag: string) {
} }
option.onSelected(index, item) option.onSelected(index, item)
}) })
}
}, (item: T) => typeof item === "string" ? item : (item as ListItem).content)
}
.listDirection(Axis.Vertical) // 排列方向
.scrollBar(BarState.Off)
.friction(0.6)
.divider({
strokeWidth: 1,
color: '#F6F6F6',
}) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring
.width('100%')
.height(option.values === undefined ? '20%' :option.values.length < 5 ? option.values.length*60 : 300)
if (option.cancel) {
Column() {
Text(option.cancel.text ?? '取消')
.fontSize(16)
.fontColor(option.cancel.color ?? '#777777')
.textAlign(TextAlign.Center)
.width(325)
.height(44)
.backgroundColor('white')
.borderRadius(22)
.borderWidth(1)
.borderColor('#D7D7D7')
} }
}, (item: string) => item) .onClick(() => {
} if (ToolsHelper.mapDialog.get(dialogTag)) {
.listDirection(Axis.Vertical) // 排列方向 promptAction.closeCustomDialog(ToolsHelper.mapDialog.get(dialogTag))
.scrollBar(BarState.Off) ToolsHelper.mapDialog.remove(dialogTag)
.friction(0.6) }
.divider({ option.cancel?.onClick && option.cancel.onClick()
strokeWidth: 1, })
color: 0xEEEEEE, .height(71)
startMargin: 20, .width('100%')
endMargin: 20 .alignItems(HorizontalAlign.Center)
}) // 每行之间的分界线 .justifyContent(FlexAlign.Center)
.edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring }
.width('100%') }.justifyContent(FlexAlign.End)
.height(option.values.length < 8 ? `${option.values.length / 16 * 100}%` : '50%') }.justifyContent(FlexAlign.Start)
.margin({ top: 20 })
}
.padding({
top: 20,
bottom: 20,
left: 20,
right: 20
})
} }
interface ThrottleInterface { interface ThrottleInterface {
@ -236,8 +272,14 @@ export class ToolsHelper {
} else { } else {
const dialogTag = ToolsHelper.getUuid() const dialogTag = ToolsHelper.getUuid()
promptAction.openCustomDialog({ promptAction.openCustomDialog({
cornerRadius: 0,
autoCancel: false,
width: '100%',
// height: options.values === undefined ? '20%' :
// options.values?.length < 8 ? `${options.values?.length / 16 * 100+10}%` : '50%',
alignment: options.alignment ?? DialogAlignment.Bottom, alignment: options.alignment ?? DialogAlignment.Bottom,
builder: customDialogBuilder.bind(p, options, dialogTag) builder: customDialogBuilder.bind(p, options, dialogTag),
backgroundColor: 'white'
}).then((dialogId: number) => { }).then((dialogId: number) => {
ToolsHelper.mapDialog.set(dialogTag, dialogId) ToolsHelper.mapDialog.set(dialogTag, dialogId)
}) })