Browse Source

在关于我们页面新增了个性化推荐按钮

wangcy 5 months ago
parent
commit
3d2783f9b4
1 changed files with 48 additions and 21 deletions
  1. 48 21
      features/user/src/main/ets/pages/AboutUS.ets

+ 48 - 21
features/user/src/main/ets/pages/AboutUS.ets

@@ -1,5 +1,4 @@
 import { YtAvoid, YTHeader, yTRouter } from 'basic';
-import { webview } from '@kit.ArkWeb';
 import { bundleManager } from '@kit.AbilityKit';
 
 
@@ -14,7 +13,7 @@ function AboutUSBuilder() {
 @Component
 export struct AboutUS {
   @State content: string = '';
-  private webviewController: WebviewController = new webview.WebviewController()
+  @State isAgree: boolean = false
   @StorageProp(YtAvoid.safeBottomKey) safeBottom: number = 0
   ICPRecordNumber: string = '19019164号-5A'
   listData: string[] = ['用户协议', '隐私政策']
@@ -41,28 +40,56 @@ export struct AboutUS {
           .fontColor(Color.Gray)
         List({ space: 25 }) {
           ForEach(this.listData, (item: string, index) => {
-            if (index != 2) {
-              ListItem() {
-                Row() {
-                  Text(item).fontSize(13)
-                    .fontColor(Color.Gray)
-                  Blank()
-                  Image($r('app.media.MRight')).width('24').height('24').margin({ right: 10 })
-                }.width('100%')
-                .onClick(() => {
-                  switch (index) {
-                    case 0:
-                      yTRouter.router2userAgreement()
-                      break;
-                    case 1:
-                      yTRouter.router2Privacy()
-                      break;
-                  }
+            ListItem() {
+              Row() {
+                Text(item).fontSize(13)
+                  .fontColor(Color.Gray)
+                Blank()
+                Image($r('app.media.MRight')).width('24').height('24').margin({ right: 10 })
+              }.width('100%')
+              .onClick(() => {
+                switch (index) {
+                  case 0:
+                    yTRouter.router2userAgreement()
+                    break;
+                  case 1:
+                    yTRouter.router2Privacy()
+                    break;
+                }
 
-                })
-              }
+              })
             }
           }, (item: string) => item)
+
+          ListItem() {
+            Row() {
+              Text('个性化推荐').fontSize(13)
+                .fontColor(Color.Gray)
+              Blank()
+              Row() {
+                Text()
+                  .height('100%')
+                  .aspectRatio(1)
+                  .backgroundColor(Color.White)
+                  .borderRadius(20)
+              }
+              .padding(1)
+              .alignSelf(ItemAlign.End)
+              .width(39)
+              .aspectRatio(2)
+              .borderRadius(20)
+              .justifyContent(this.isAgree ? FlexAlign.End : FlexAlign.Start)
+              .backgroundColor(this.isAgree ? $r('[basic].color.main_ac_color_dark') : '#D9D9D9')
+              .onClick(() => {
+                animateTo({ duration: 200 }, () => {
+                  this.isAgree = !this.isAgree
+                })
+              })
+            }
+            .width('100%')
+            .alignItems(VerticalAlign.Center)
+            .padding({ right: 16 })
+          }
         }
         .divider({
           strokeWidth: 1,