import { router } from '@kit.ArkUI'

class ListClass {
  id: number = 0;
  imageSrc: ResourceStr = '';
  content: string = ''

  constructor(id: number, imageSrc: ResourceStr, content: string) {
    this.id = id
    this.imageSrc = imageSrc;
    this.content = content;
  }
}

@Preview
@Component
export struct OtherList {
  @State otherList:Array<ListClass>=[
    // new ListClass(1,$r('app.media.app_icon'),'福利卡兑换'),
    // new ListClass(2,$r('app.media.app_icon'),'发票管理'),
    // new ListClass(3,$r('app.media.app_icon'),'常用银行卡'),
    new ListClass(4,$r('app.media.my_page_sethelp'),'设置与帮助')
  ]

  build() {
    Row() {
      List() {
        ForEach(this.otherList,(model:ListClass)=>{
          ListItem(){
            Column(){
              Row() {
                Image(model.imageSrc)
                  .width(22)
                  .height(22)
                  .margin({left:15})
                Text(model.content)
                  .fontSize(12)
                  .margin({left:10})
                Blank()
                Image($r('sys.media.ohos_ic_public_arrow_right'))
                  .width(15)
                  .height(15)
                  .margin({right:10})
              }
              .width('100%')
              .height(52)
              .justifyContent(FlexAlign.SpaceBetween)
              .onClick(()=>{
                router.pushUrl({url:'pages/MinePage/SettingPage'})
              })

              if (model.id <= 3) {
                Divider()
                  .color('#F4F4F4')
                  .strokeWidth(1)
                  .height(1)
                  .margin({left:10,top:0})
              }
            }
            .justifyContent(FlexAlign.Start)
          }
          .height(53)
        })
      }
      .backgroundColor(Color.White)
      .borderRadius(5)
      .margin({top:10,left:10,right:10})
    }
  }
}
