Terms.ets 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { yTRouter } from 'basic'
  2. @Extend(Span)
  3. function spanEx(click: () => void) {
  4. .decoration({ type: TextDecorationType.Underline, color: $r('[basic].color.main_ac_color_dark') })
  5. .fontColor($r('[basic].color.main_ac_color_dark'))
  6. .onClick(click)
  7. }
  8. @Component
  9. export struct Terms {
  10. @Link isAgree: boolean
  11. mg: number = 39
  12. build() {
  13. Column() {
  14. Row() {
  15. Text() {
  16. Span('我已阅读并同意')
  17. // Span('《中国认证服务条款》')
  18. // .spanEx(() => {
  19. //
  20. // })
  21. //
  22. // Span('以及')
  23. Span('"用户协议"')
  24. .spanEx(() => {
  25. yTRouter.router2AgreementPage('用户协议')
  26. })
  27. Span('和')
  28. Span('"隐私政策"')
  29. .spanEx(() => {
  30. yTRouter.router2AgreementPage('隐私政策')
  31. })
  32. Span('。')
  33. }
  34. .fontColor('#4D000000')
  35. .fontSize($r('[basic].float.page_text_font_size_10'))
  36. .margin({ bottom: this.mg })
  37. }
  38. .width('100%')
  39. Row() {
  40. Text()
  41. .height('100%')
  42. .aspectRatio(1)
  43. .backgroundColor(Color.White)
  44. .borderRadius(18)
  45. }
  46. .padding(1)
  47. .alignSelf(ItemAlign.End)
  48. .width(39)
  49. .aspectRatio(2)
  50. .borderRadius(18)
  51. .justifyContent(this.isAgree ? FlexAlign.End : FlexAlign.Start)
  52. .backgroundColor(this.isAgree ? $r('[basic].color.main_ac_color_dark') : '#D9D9D9')
  53. .onClick(() => {
  54. animateTo({ duration: 200 }, () => {
  55. this.isAgree = !this.isAgree
  56. })
  57. })
  58. }
  59. }
  60. }