Showing
12 changed files
with
678 additions
and
11 deletions
| 1 | import ArrayList from '@ohos.util.ArrayList' | 1 | import ArrayList from '@ohos.util.ArrayList' |
| 2 | import { MineSettingComponent } from 'wdComponent'; | 2 | import { MineSettingComponent } from 'wdComponent'; |
| 3 | +import { AccountAndSecurityLayout } from 'wdComponent'; | ||
| 4 | +import router from '@ohos.router'; | ||
| 3 | 5 | ||
| 4 | @Entry | 6 | @Entry |
| 5 | @Component | 7 | @Component |
| 6 | struct SettingPage { | 8 | struct SettingPage { |
| 7 | @State message: string = 'Hello World 02' | 9 | @State message: string = 'Hello World 02' |
| 10 | + @State pageType: string = ''; | ||
| 11 | + | ||
| 12 | + onPageShow() { | ||
| 13 | + const params = router.getParams(); // 获取传递过来的参数对象 | ||
| 14 | + this.pageType = 'mainSetting';// 获取info属性的值 | ||
| 15 | + } | ||
| 8 | 16 | ||
| 9 | build() { | 17 | build() { |
| 10 | Column() { | 18 | Column() { |
| 11 | - MineSettingComponent() | 19 | + if (this.pageType == 'mainSetting') { |
| 20 | + MineSettingComponent() | ||
| 21 | + } else { | ||
| 22 | + AccountAndSecurityLayout() | ||
| 23 | + } | ||
| 12 | }.setFullWidth() | 24 | }.setFullWidth() |
| 13 | } | 25 | } |
| 14 | 26 |
| 1 | +import { SettingPasswordLayout } from 'wdComponent'; | ||
| 2 | + | ||
| 3 | +@Entry | ||
| 4 | +@Component | ||
| 5 | +struct SettingPasswordPage { | ||
| 6 | + @State message: string = 'Hello World' | ||
| 7 | + | ||
| 8 | + build() { | ||
| 9 | + Row() { | ||
| 10 | + Column() { | ||
| 11 | + SettingPasswordLayout() | ||
| 12 | + } | ||
| 13 | + .width('100%') | ||
| 14 | + } | ||
| 15 | + .height('100%') | ||
| 16 | + } | ||
| 17 | +} |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "pages/SettingPage", | 7 | "pages/SettingPage", |
| 8 | "pages/PrivacySettingPage", | 8 | "pages/PrivacySettingPage", |
| 9 | "pages/SettingAboutPage", | 9 | "pages/SettingAboutPage", |
| 10 | - "pages/AppointmentListPage" | 10 | + "pages/AppointmentListPage", |
| 11 | + "pages/SettingPasswordPage" | ||
| 11 | ] | 12 | ] |
| 12 | -} | 13 | +} |
| @@ -33,3 +33,8 @@ export { MineSettingComponent } from "./components/page/MineSettingComponent" | @@ -33,3 +33,8 @@ export { MineSettingComponent } from "./components/page/MineSettingComponent" | ||
| 33 | export { AboutPageUI } from "./components/page/about/AboutPageUI" | 33 | export { AboutPageUI } from "./components/page/about/AboutPageUI" |
| 34 | 34 | ||
| 35 | export { AppointmentListUI } from "./components/page/mine/AppointmentListUI" | 35 | export { AppointmentListUI } from "./components/page/mine/AppointmentListUI" |
| 36 | + | ||
| 37 | +export { AccountAndSecurityLayout } from "./components/page/AccountAndSecurityLayout" | ||
| 38 | + | ||
| 39 | +export { SettingPasswordLayout } from "./components/page/SettingPasswordLayout" | ||
| 40 | + |
PeopleDaily_Harmony/wdComponent/src/main/ets/components/page/AccountAndSecurityLayout.ets
0 → 100644
| 1 | +// @ts-nocheck | ||
| 2 | +import { BottomNavi, CommonConstants } from 'wdConstant'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { TopNavigationComponent } from './TopNavigationComponent'; | ||
| 5 | +import { BottomNavDTO } from '../../repository/bean/BottomNavDTO'; | ||
| 6 | +import { UIUtils } from '../../repository/UIUtils'; | ||
| 7 | +import { MinePageComponent } from './MinePageComponent'; | ||
| 8 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 9 | +import MineSettingDatasModel from '../../model/MineSettingDatasModel'; | ||
| 10 | +import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem' | ||
| 11 | + | ||
| 12 | +import storageStatistics from "@ohos.file.storageStatistics"; | ||
| 13 | +import { BusinessError } from '@ohos.base'; | ||
| 14 | +import ArrayList from '@ohos.util.ArrayList'; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +@Component | ||
| 18 | +export struct AccountAndSecurityLayout { | ||
| 19 | + @State listData: ArrayList<any> = new ArrayList(); | ||
| 20 | + @State privacySwitch: boolean = false | ||
| 21 | + @State cacheSice: number = 0 | ||
| 22 | + | ||
| 23 | + aboutToAppear() { | ||
| 24 | + // 获取设置页面数据 | ||
| 25 | + this.getAccountAndSecurityData() | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + getAccountAndSecurityData() { | ||
| 29 | + this.listData = MineSettingDatasModel.getAccountAndSecuritySettingData() | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + build() { | ||
| 33 | + Navigation() { | ||
| 34 | + //滑动区域 | ||
| 35 | + this.settingList() | ||
| 36 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 37 | + .title('账号与安全') | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + // 页面布局 | ||
| 41 | + @Builder settingList() { | ||
| 42 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 43 | + Column() { | ||
| 44 | + List() { | ||
| 45 | + ForEach(this.listData, (item: MineMainSettingFunctionItem, index: number) => { | ||
| 46 | + ListItem() { | ||
| 47 | + if (item.type == 0) { | ||
| 48 | + Column() { | ||
| 49 | + this.getArrowCell(item) | ||
| 50 | + }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | ||
| 51 | + } else if (item.type == 1) { | ||
| 52 | + Column() { | ||
| 53 | + this.getSwitchCell(item) | ||
| 54 | + }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | ||
| 55 | + } else { | ||
| 56 | + Column().width('100%').height('15lpx').backgroundColor(0xf0f0f0) | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + .onClick(() => { | ||
| 60 | + console.log(index + "") | ||
| 61 | + RouteManager.jumpNewPage("pages/SettingPasswordPage") // 调用跳转方法,跳转新页面 | ||
| 62 | + }) | ||
| 63 | + | ||
| 64 | + }, item => item) | ||
| 65 | + } | ||
| 66 | + .divider({ | ||
| 67 | + strokeWidth: 1, | ||
| 68 | + startMargin: 15, | ||
| 69 | + endMargin: 10, | ||
| 70 | + color: '#f0f0f0' | ||
| 71 | + }) | ||
| 72 | + .onScrollFrameBegin((offset, state) => { | ||
| 73 | + return { offsetRemain: 0 } | ||
| 74 | + }) | ||
| 75 | + }.height("100%") | ||
| 76 | + | ||
| 77 | + Column() { | ||
| 78 | + Button('退出登录',{ stateEffect: true }).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').onClick(()=>{ | ||
| 79 | + AlertDialog.show({ | ||
| 80 | + title: '🥟id : ' + "button", | ||
| 81 | + message: '标题:' + '退出登录', | ||
| 82 | + confirm: { | ||
| 83 | + value: "OK", | ||
| 84 | + action: () => { | ||
| 85 | + | ||
| 86 | + }, | ||
| 87 | + } | ||
| 88 | + }) | ||
| 89 | + }) | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Builder itemHead(text: string) { | ||
| 96 | + // 列表分组的头部组件,对应联系人分组A、B等位置的组件 | ||
| 97 | + if (text.length > 0) { | ||
| 98 | + Row().width('100%').height('20lpx').backgroundColor(0xf0f0f0) | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + // 右侧开关cell | ||
| 103 | + @Builder getSwitchCell(item: MineMainSettingFunctionItem) { | ||
| 104 | + Column() { | ||
| 105 | + Row() { | ||
| 106 | + // 左侧logo和标题 | ||
| 107 | + Row() { | ||
| 108 | + // 判断有没有图片 | ||
| 109 | + if (item.imgSrc) { | ||
| 110 | + Image(item.imgSrc).height('38lpx').margin({ right: '5lpx' }) | ||
| 111 | + Text(`${item.title}`).margin({ top: '8lpx' }).height('38lpx').fontColor('#333333').fontSize('29lpx') | ||
| 112 | + } else { | ||
| 113 | + Text(`${item.title}`).margin({ top: '8lpx' }).height('38lpx').fontColor('#333333').fontSize('29lpx') | ||
| 114 | + } | ||
| 115 | + }.width('60%') | ||
| 116 | + | ||
| 117 | + // 右侧文案和右箭头 | ||
| 118 | + Row() { | ||
| 119 | + Toggle({ type: ToggleType.Switch, isOn: item.switchState }) | ||
| 120 | + .height('50lpx') | ||
| 121 | + .margin({ left: '81lpx', right: '29lpx' }) | ||
| 122 | + .selectedColor(Color.Pink) | ||
| 123 | + .onChange((isOn: boolean) => { | ||
| 124 | + this.privacySwitch = isOn; | ||
| 125 | + }) | ||
| 126 | + }.width('40%') | ||
| 127 | + .margin({ right: '29lpx' }) | ||
| 128 | + .justifyContent(FlexAlign.End) | ||
| 129 | + | ||
| 130 | + } | ||
| 131 | + .alignItems(VerticalAlign.Center) | ||
| 132 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 133 | + }.height('54lpx') | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + // 右文字+箭头cell | ||
| 137 | + @Builder getArrowCell(item: MineMainSettingFunctionItem) { | ||
| 138 | + Column() { | ||
| 139 | + Row() { | ||
| 140 | + // 左侧logo和标题 | ||
| 141 | + Row() { | ||
| 142 | + // 判断有没有图片 | ||
| 143 | + if (item.imgSrc) { | ||
| 144 | + Image(item.imgSrc) | ||
| 145 | + .height('38lpx') | ||
| 146 | + .margin({ right: '5lpx' }) | ||
| 147 | + } | ||
| 148 | + Text(`${item.title}`) | ||
| 149 | + .margin({ top: '8lpx' }) | ||
| 150 | + .height('38lpx') | ||
| 151 | + .fontColor('#333333') | ||
| 152 | + .fontSize('29lpx') | ||
| 153 | + }.width('60%') | ||
| 154 | + | ||
| 155 | + // 右侧文案和右箭头 | ||
| 156 | + Row() { | ||
| 157 | + Text(item.subTitle ? item.subTitle : '') | ||
| 158 | + .fontColor('#999999') | ||
| 159 | + .maxLines(1) | ||
| 160 | + Image($r('app.media.mine_user_arrow')) | ||
| 161 | + .width('27lpx') | ||
| 162 | + .height('27lpx') | ||
| 163 | + .objectFit(ImageFit.Auto) | ||
| 164 | + Column().width('29lpx') | ||
| 165 | + }.width('40%') | ||
| 166 | + .margin({ right: '29lpx' }) | ||
| 167 | + .justifyContent(FlexAlign.End) | ||
| 168 | + | ||
| 169 | + } | ||
| 170 | + .alignItems(VerticalAlign.Center) | ||
| 171 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 172 | + | ||
| 173 | + } | ||
| 174 | + .height('54lpx') | ||
| 175 | + } | ||
| 176 | +} |
| @@ -9,13 +9,14 @@ import PageViewModel from '../../viewmodel/PageViewModel'; | @@ -9,13 +9,14 @@ import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 9 | 9 | ||
| 10 | import storageStatistics from "@ohos.file.storageStatistics"; | 10 | import storageStatistics from "@ohos.file.storageStatistics"; |
| 11 | import { BusinessError } from '@ohos.base'; | 11 | import { BusinessError } from '@ohos.base'; |
| 12 | +import RouteManager from '../../utils/RouteManager' | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | @Component | 15 | @Component |
| 15 | export struct MineSettingComponent { | 16 | export struct MineSettingComponent { |
| 16 | @State listData: Array<string | Array<string>> = new Array(); | 17 | @State listData: Array<string | Array<string>> = new Array(); |
| 17 | - @State privacySwitch:boolean = false | ||
| 18 | - @State cacheSice:number = 0 | 18 | + @State privacySwitch: boolean = false |
| 19 | + @State cacheSice: number = 0 | ||
| 19 | 20 | ||
| 20 | aboutToAppear() { | 21 | aboutToAppear() { |
| 21 | // 获取设置页面数据 | 22 | // 获取设置页面数据 |
| @@ -26,7 +27,7 @@ export struct MineSettingComponent { | @@ -26,7 +27,7 @@ export struct MineSettingComponent { | ||
| 26 | if (err) { | 27 | if (err) { |
| 27 | console.error(`Invoke getCurrentBundleStats failed, code is ${err.code}, message is ${err.message}`); | 28 | console.error(`Invoke getCurrentBundleStats failed, code is ${err.code}, message is ${err.message}`); |
| 28 | } else { | 29 | } else { |
| 29 | - this.cacheSice = bundleStats.appSize / 1024.00 / 1024.00.toFixed(2); | 30 | + this.cacheSice = bundleStats.appSize / 1024.00 / 1024.00.toFixed(2); |
| 30 | } | 31 | } |
| 31 | }); | 32 | }); |
| 32 | } | 33 | } |
| @@ -64,10 +65,12 @@ export struct MineSettingComponent { | @@ -64,10 +65,12 @@ export struct MineSettingComponent { | ||
| 64 | 65 | ||
| 65 | }.padding({ left: '27lpx' }) | 66 | }.padding({ left: '27lpx' }) |
| 66 | .onClick(() => { | 67 | .onClick(() => { |
| 67 | - console.log(subIndex + "") | ||
| 68 | - if (subIndex == 4) { | ||
| 69 | - // RouteManager.jumpNewPage("pages/SettingPage") // 调用跳转方法,跳转新页面 | ||
| 70 | - } | 68 | + // 在Home页面中 |
| 69 | + let paramsInfo: object = { | ||
| 70 | + pageId: 123, | ||
| 71 | + pageType:'AccountAndSecurityLayout' | ||
| 72 | + }; | ||
| 73 | + RouteManager.jumpNewPage("pages/SettingPasswordPage") // 调用跳转方法,跳转新页面 | ||
| 71 | }) | 74 | }) |
| 72 | .height('117lpx') | 75 | .height('117lpx') |
| 73 | }, subItem => subItem) | 76 | }, subItem => subItem) |
| 1 | +import ArrayList from '@ohos.util.ArrayList'; | ||
| 2 | +import promptAction from '@ohos.promptAction'; | ||
| 3 | + | ||
| 4 | +export default class AccoutPageDataModel { | ||
| 5 | + // 页面数据 | ||
| 6 | + compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白 | ||
| 7 | + compLogo: string | ||
| 8 | + compTitle: string | ||
| 9 | + compSubTitle: string | ||
| 10 | + compDesc: string | ||
| 11 | + compButtonTitle: string | ||
| 12 | + inputPlacholder: string | ||
| 13 | + inputTag: number | ||
| 14 | + | ||
| 15 | + constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) { | ||
| 16 | + this.compType = compType | ||
| 17 | + this.compTitle = compTitle | ||
| 18 | + this.compLogo = compLogo | ||
| 19 | + this.compDesc = compDesc | ||
| 20 | + this.compButtonTitle = compButtonTitle | ||
| 21 | + this.inputPlacholder = inputPlacholder | ||
| 22 | + this.inputTag = inputTag | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@Component | ||
| 27 | +export struct SettingPasswordLayout { | ||
| 28 | + @State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据 | ||
| 29 | + @State btnStatus: boolean = false | ||
| 30 | + password01: string | ||
| 31 | + password02: string | ||
| 32 | + passwordOri: string | ||
| 33 | + | ||
| 34 | + aboutToAppear() { | ||
| 35 | + this.getPageListData(4) | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + getPageListData(pageId:number) { | ||
| 39 | + switch (pageId) { | ||
| 40 | + case 0: | ||
| 41 | + // 验证/更换手机号 | ||
| 42 | + this.listData.push(new AccoutPageDataModel(0, '更换手机号', null, null, null, null, null)) | ||
| 43 | + this.listData.push(new AccoutPageDataModel(7, null, null, null, null, '请输入手机号', 10010)) | ||
| 44 | + this.listData.push(new AccoutPageDataModel(2, null, null, null, null, '验证码', 10088)) | ||
| 45 | + this.listData.push(new AccoutPageDataModel(4, null, null, null, '确认', null, null)) | ||
| 46 | + break; | ||
| 47 | + | ||
| 48 | + case 1: | ||
| 49 | + // 设置密码 | ||
| 50 | + this.listData.push(new AccoutPageDataModel(0, '设置密码', null, null, null, null, null)) | ||
| 51 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请输入密码', 10086)) | ||
| 52 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '再次输入密码', 10087)) | ||
| 53 | + this.listData.push(new AccoutPageDataModel(4, null, null, '提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成', null, null, null)) | ||
| 54 | + this.listData.push(new AccoutPageDataModel(5, null, null, null, '确认', null, null)) | ||
| 55 | + break; | ||
| 56 | + | ||
| 57 | + case 2: | ||
| 58 | + // 修改密码 | ||
| 59 | + this.listData.push(new AccoutPageDataModel(0, '修改密码', null, null, null, null, null)) | ||
| 60 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请输入原密码', 10010)) | ||
| 61 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请输入新密码', 10086)) | ||
| 62 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请再请输入原密码', 10087)) | ||
| 63 | + this.listData.push(new AccoutPageDataModel(3, null, null, '提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成', null, null, null)) | ||
| 64 | + this.listData.push(new AccoutPageDataModel(4, null, null, null, '确认', null, null)) | ||
| 65 | + this.listData.push(new AccoutPageDataModel(3, null, null, '忘记密码', null, null, null)) | ||
| 66 | + break; | ||
| 67 | + | ||
| 68 | + case 3: | ||
| 69 | + // 绑定手机号 | ||
| 70 | + this.listData.push(new AccoutPageDataModel(0, '绑定手机号', null, null, null, null, null)) | ||
| 71 | + this.listData.push(new AccoutPageDataModel(7, null, null, null, null, '请输入手机号', 10010)) | ||
| 72 | + this.listData.push(new AccoutPageDataModel(2, null, null, null, null, '验证码', 10088)) | ||
| 73 | + this.listData.push(new AccoutPageDataModel(4, null, null, null, '确认', null, null)) | ||
| 74 | + break; | ||
| 75 | + | ||
| 76 | + case 4: | ||
| 77 | + // 有logo的 | ||
| 78 | + this.listData.push(new AccoutPageDataModel(5, null, 'https://img-blog.csdnimg.cn/24f43f4d626d428891ebb2adb5c2c2e9.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5YyX5aSn5Z-55paH5byg6ICB5biI,size_20,color_FFFFFF,t_70,g_se,x_16', null, null, null , null)) | ||
| 79 | + this.listData.push(new AccoutPageDataModel(0, '修改密码', null, null, null, null, null)) | ||
| 80 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请输入原密码', 10010)) | ||
| 81 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请输入新密码', 10086)) | ||
| 82 | + this.listData.push(new AccoutPageDataModel(1, null, null, null, null, '请再请输入原密码', 10087)) | ||
| 83 | + this.listData.push(new AccoutPageDataModel(2, null, null, null, null, '验证码', 10088)) | ||
| 84 | + this.listData.push(new AccoutPageDataModel(3, null, null, '提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成', null, null, null)) | ||
| 85 | + this.listData.push(new AccoutPageDataModel(4, null, null, null, '确认', null, null)) | ||
| 86 | + this.listData.push(new AccoutPageDataModel(3, null, null, '忘记密码', null, null, null)) | ||
| 87 | + break; | ||
| 88 | + | ||
| 89 | + default: | ||
| 90 | + break; | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + build() { | ||
| 95 | + Navigation() { | ||
| 96 | + this.settingList() //滑动区域 | ||
| 97 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 98 | + .title('') | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + // 页面布局 | ||
| 102 | + @Builder settingList() { | ||
| 103 | + Column() { | ||
| 104 | + List() { | ||
| 105 | + ForEach(this.listData, (item: AccoutPageDataModel, index: number) => { | ||
| 106 | + ListItem() { | ||
| 107 | + if (item.compType == 0) { | ||
| 108 | + this.getTitleCell(item, HorizontalAlign.Start) | ||
| 109 | + } else if (item.compType == 1) { | ||
| 110 | + this.getPasswordCell(item) | ||
| 111 | + } else if (item.compType == 2) { | ||
| 112 | + this.getCodeCell(item) | ||
| 113 | + } else if (item.compType == 3) { | ||
| 114 | + if (index == this.listData.length - 1) { | ||
| 115 | + this.getDescCell(item, HorizontalAlign.Center) | ||
| 116 | + } else { | ||
| 117 | + this.getDescCell(item, HorizontalAlign.Start) | ||
| 118 | + } | ||
| 119 | + } else if (item.compType == 4) { | ||
| 120 | + this.getButtonCell(item) | ||
| 121 | + } else if (item.compType == 5) { | ||
| 122 | + this.getLogoCell(item) | ||
| 123 | + } else if (item.compType == 7) { | ||
| 124 | + this.getPhoneCell(item) | ||
| 125 | + } else { | ||
| 126 | + Text('' + item.compType) | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + // .divider({ | ||
| 132 | + // strokeWidth: 1, | ||
| 133 | + // startMargin: 15, | ||
| 134 | + // endMargin: 10, | ||
| 135 | + // color: '#f0f0f0' | ||
| 136 | + // }) | ||
| 137 | + }.width('100%').padding('30lpx') | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /***************************** UI元素 ******************************************/ | ||
| 141 | + | ||
| 142 | + // 标题 | ||
| 143 | + @Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 144 | + Column() { | ||
| 145 | + Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | ||
| 146 | + } | ||
| 147 | + .width('100%') | ||
| 148 | + .height('75lpx') | ||
| 149 | + .alignItems(alignTitle) | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + // 密码输入框 | ||
| 153 | + @Builder getPasswordCell(item: AccoutPageDataModel) { | ||
| 154 | + Row() { | ||
| 155 | + Row() { | ||
| 156 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 157 | + .type(InputType.Password) | ||
| 158 | + .backgroundColor('#00000000') | ||
| 159 | + .onChange((value: string) => { | ||
| 160 | + this.inputTextChange(value, item.inputTag) | ||
| 161 | + }) | ||
| 162 | + .onSubmit((EnterKeyType) => { | ||
| 163 | + promptAction.showToast({ message: 'submit' }) | ||
| 164 | + }) | ||
| 165 | + } | ||
| 166 | + .alignItems(VerticalAlign.Center) | ||
| 167 | + .height('80lpx') | ||
| 168 | + .backgroundColor('#f5f5f5') | ||
| 169 | + .borderRadius('4vp') | ||
| 170 | + } | ||
| 171 | + .width('100%') | ||
| 172 | + .height('110lpx') | ||
| 173 | + .backgroundColor(0xffffff0) | ||
| 174 | + .alignItems(VerticalAlign.Center) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + // 手机号输入框 | ||
| 178 | + @Builder getPhoneCell(item: AccoutPageDataModel) { | ||
| 179 | + Row() { | ||
| 180 | + Row() { | ||
| 181 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 182 | + .backgroundColor('#00000000') | ||
| 183 | + .onChange((value: string) => { | ||
| 184 | + this.inputTextChange(value, item.inputTag) | ||
| 185 | + }) | ||
| 186 | + .onSubmit((EnterKeyType) => { | ||
| 187 | + promptAction.showToast({ message: 'submit' }) | ||
| 188 | + }) | ||
| 189 | + } | ||
| 190 | + .alignItems(VerticalAlign.Center) | ||
| 191 | + .height('80lpx') | ||
| 192 | + .backgroundColor('#f5f5f5') | ||
| 193 | + .borderRadius('4vp') | ||
| 194 | + } | ||
| 195 | + .width('100%') | ||
| 196 | + .height('110lpx') | ||
| 197 | + .backgroundColor(0xffffff0) | ||
| 198 | + .alignItems(VerticalAlign.Center) | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + // 验证码码输入框 | ||
| 202 | + @Builder getCodeCell(item: AccoutPageDataModel) { | ||
| 203 | + Row() { | ||
| 204 | + Stack() { | ||
| 205 | + Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') | ||
| 206 | + Row() { | ||
| 207 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 208 | + .backgroundColor('#00000000') | ||
| 209 | + .width('67.28%') | ||
| 210 | + .onChange((value: string) => { | ||
| 211 | + this.inputTextChange(value, item.inputTag) | ||
| 212 | + }) | ||
| 213 | + Button('发送验证码') | ||
| 214 | + .width('32.71%') | ||
| 215 | + .backgroundColor('#00000000') | ||
| 216 | + .fontColor('#da3e22') | ||
| 217 | + } | ||
| 218 | + .width('100%') | ||
| 219 | + }.height('80lpx') | ||
| 220 | + } | ||
| 221 | + .width('100%') | ||
| 222 | + .height('110lpx') | ||
| 223 | + .backgroundColor(0xffffff0) | ||
| 224 | + .alignItems(VerticalAlign.Center) | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + // desc | ||
| 228 | + @Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 229 | + Column() { | ||
| 230 | + Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | ||
| 231 | + .onClick(()=>{ | ||
| 232 | + if (item.compDesc == '忘记密码') { | ||
| 233 | + promptAction.showToast({ message: '密码不符合密码规范' }) | ||
| 234 | + } | ||
| 235 | + }) | ||
| 236 | + } | ||
| 237 | + .width('100%') | ||
| 238 | + .height('85lpx') | ||
| 239 | + .alignItems(alignTitle) | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + // 按钮 | ||
| 243 | + @Builder getButtonCell(item: AccoutPageDataModel) { | ||
| 244 | + Row() { | ||
| 245 | + Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true }) | ||
| 246 | + .width('100%') | ||
| 247 | + .height('80lpx') | ||
| 248 | + .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d') | ||
| 249 | + .fontColor('#fff') | ||
| 250 | + .borderRadius('4vp') | ||
| 251 | + .onClick(() => { | ||
| 252 | + this.buttonClick() | ||
| 253 | + }) | ||
| 254 | + } | ||
| 255 | + .padding({top:'25lpx'}) | ||
| 256 | + .alignItems(VerticalAlign.Center) | ||
| 257 | + .width('100%') | ||
| 258 | + .height('120lpx') | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + // 标题 | ||
| 262 | + @Builder getLogoCell(item: AccoutPageDataModel) { | ||
| 263 | + Column() { | ||
| 264 | + Image(item.compLogo).height('150lpx').width('150lpx') | ||
| 265 | + } | ||
| 266 | + .width('100%') | ||
| 267 | + .height('200lpx') | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + /***************************** 事件处理 ******************************************/ | ||
| 271 | + // 提交按钮点击事件 | ||
| 272 | + buttonClick() { | ||
| 273 | + if (this.btnStatus) { | ||
| 274 | + // 需要+手机号校验 | ||
| 275 | + if (this.password01.length < 6 || this.password01.length > 20) { | ||
| 276 | + promptAction.showToast({ message: '密码不符合密码规范' }) | ||
| 277 | + return | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + promptAction.showToast({ message: '请求接口' }) | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + // 输入框数据变动:输入数据处理 | ||
| 285 | + inputTextChange(text: string, tag: number) { | ||
| 286 | + if (tag == 10086) { | ||
| 287 | + this.password01 = text; | ||
| 288 | + } else if (tag == 10087) { | ||
| 289 | + this.password02 = text; | ||
| 290 | + } else { | ||
| 291 | + this.passwordOri = text; | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + if (this.password01) { | ||
| 295 | + if (this.password01 == this.password02 && this.password01.length >= 6 && this.password01.length <= 20) { | ||
| 296 | + this.btnStatus = true; | ||
| 297 | + } else { | ||
| 298 | + this.btnStatus = false; | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | +} |
| @@ -68,7 +68,12 @@ export default struct MinePageMoreFunctionUI{ | @@ -68,7 +68,12 @@ export default struct MinePageMoreFunctionUI{ | ||
| 68 | if (index == 3) { | 68 | if (index == 3) { |
| 69 | RouteManager.jumpNewPage("pages/SettingPage") | 69 | RouteManager.jumpNewPage("pages/SettingPage") |
| 70 | } else { | 70 | } else { |
| 71 | - RouteManager.jumpNewPage("pages/PrivacySettingPage") | 71 | + // 在Home页面中 |
| 72 | + let paramsInfo: object = { | ||
| 73 | + pageId: 123, | ||
| 74 | + pageType:'mainSetting' | ||
| 75 | + }; | ||
| 76 | + RouteManager.jumpNewPage("pages/PrivacySettingPage",paramsInfo) | ||
| 72 | } | 77 | } |
| 73 | }) | 78 | }) |
| 74 | .height('117lpx') | 79 | .height('117lpx') |
| @@ -84,6 +84,22 @@ class MinePageDatasModel{ | @@ -84,6 +84,22 @@ class MinePageDatasModel{ | ||
| 84 | return this.moreData | 84 | return this.moreData |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | + /** | ||
| 88 | + * 扫一扫 我的奖品 等5个数据 | ||
| 89 | + * 包含名字和图标 | ||
| 90 | + */ | ||
| 91 | + getSettingFunctionsData():MinePageCreatorFunctionsItem[]{ | ||
| 92 | + if(this.moreData.length === 5){ | ||
| 93 | + return this.moreData | ||
| 94 | + } | ||
| 95 | + this.moreData.push(new MinePageMoreFunctionModel("扫一扫",$r('app.media.mine_scan'))) | ||
| 96 | + this.moreData.push(new MinePageMoreFunctionModel("我的奖品",$r('app.media.mine_mygift'))) | ||
| 97 | + this.moreData.push(new MinePageMoreFunctionModel("意见反馈",$r('app.media.mine_suggest'))) | ||
| 98 | + this.moreData.push(new MinePageMoreFunctionModel("设置",$r('app.media.mine_setting'))) | ||
| 99 | + this.moreData.push(new MinePageMoreFunctionModel("关于",$r('app.media.mine_about'))) | ||
| 100 | + return this.moreData | ||
| 101 | + } | ||
| 102 | + | ||
| 87 | fetchAppointmentListData(pageSize:string,pageNum:string) { | 103 | fetchAppointmentListData(pageSize:string,pageNum:string) { |
| 88 | let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` | 104 | let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` |
| 89 | let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | 105 | let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); |
| 1 | + | ||
| 2 | +import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunctionsItem' | ||
| 3 | +import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' | ||
| 4 | +import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | ||
| 5 | +import { HttpUrlUtils } from '../network/HttpUrlUtils'; | ||
| 6 | +import HashMap from '@ohos.util.HashMap'; | ||
| 7 | +import { ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 8 | +import { Logger } from 'wdKit'; | ||
| 9 | +import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem' | ||
| 10 | + | ||
| 11 | +const TAG = "MineSettingDatasModel" | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 我的设置页面 所有数据 获取封装类 | ||
| 15 | + */ | ||
| 16 | +class MineSettingDatasModel{ | ||
| 17 | + private static instance: MineSettingDatasModel; | ||
| 18 | + mainSettingData:MineMainSettingFunctionItem[] = [] | ||
| 19 | + accountAndSecurityData:MineMainSettingFunctionItem[] = [] | ||
| 20 | + | ||
| 21 | + private constructor() { } | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 单例模式 | ||
| 25 | + * @returns | ||
| 26 | + */ | ||
| 27 | + public static getInstance(): MineSettingDatasModel { | ||
| 28 | + if (!MineSettingDatasModel.instance) { | ||
| 29 | + MineSettingDatasModel.instance = new MineSettingDatasModel(); | ||
| 30 | + } | ||
| 31 | + return MineSettingDatasModel.instance; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 评论 关注 收藏 等7个数据 | ||
| 39 | + * 包含名字和图标 | ||
| 40 | + */ | ||
| 41 | + getMineMainSettingFunctionItemData():MineMainSettingFunctionItem[]{ | ||
| 42 | + if(this.mainSettingData.length === 7){ | ||
| 43 | + return this.mainSettingData | ||
| 44 | + } | ||
| 45 | + this.mainSettingData = [] | ||
| 46 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '账户与安全', '18888888888', 0, false)) | ||
| 47 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '接收推送', null, 1, false)) | ||
| 48 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false)) | ||
| 49 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '仅WiFi网络加载图片', null, 1, false)) | ||
| 50 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, 'WiFi网络情况下自动播放视频', null, 1, false)) | ||
| 51 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开户播放器悬浮窗', null, 1, false)) | ||
| 52 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null)) | ||
| 53 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '清除缓存', '32MB', 0, false)) | ||
| 54 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '去评分', null, 0, false)) | ||
| 55 | + | ||
| 56 | + return this.mainSettingData | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 评论 关注 收藏 等7个数据 | ||
| 61 | + * 包含名字和图标 | ||
| 62 | + */ | ||
| 63 | + getAccountAndSecuritySettingData():MineMainSettingFunctionItem[]{ | ||
| 64 | + if(this.accountAndSecurityData.length === 7){ | ||
| 65 | + return this.accountAndSecurityData | ||
| 66 | + } | ||
| 67 | + this.accountAndSecurityData = [] | ||
| 68 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '更换手机号', '18888888888', 0, false)) | ||
| 69 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '设置密码', null, 0, false)) | ||
| 70 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null)) | ||
| 71 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.mine_order_icon'), '绑定QQ', '立即绑定', 0, false)) | ||
| 72 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.mine_order_icon'), '绑定微信', '立即绑定', 0, false)) | ||
| 73 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.mine_order_icon'), '绑定新浪微博', '立即绑定', 0, false)) | ||
| 74 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, 'Apple ID', null, 0, false)) | ||
| 75 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null)) | ||
| 76 | + | ||
| 77 | + this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '注销账号', null, 0, false)) | ||
| 78 | + | ||
| 79 | + return this.accountAndSecurityData | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + // 网络请求设置数据 | ||
| 85 | + fetchAppointmentListData(pageSize:string,pageNum:string) { | ||
| 86 | + // let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` | ||
| 87 | + // let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 88 | + // return WDHttp.get<ResponseDTO<MineAppointmentListItem>>(url, headers) | ||
| 89 | + }; | ||
| 90 | + | ||
| 91 | + // getAppointmentListData(pageSize:string,pageNum:string): Promise<MineAppointmentListItem> { | ||
| 92 | + // return new Promise<MineAppointmentListItem>((success, error) => { | ||
| 93 | + // Logger.info(TAG, `getAppointmentList start`); | ||
| 94 | + // this.fetchAppointmentListData(pageSize,pageNum).then((navResDTO: ResponseDTO<MineAppointmentListItem>) => { | ||
| 95 | + // if (!navResDTO) { | ||
| 96 | + // error("page data invalid"); | ||
| 97 | + // return | ||
| 98 | + // } | ||
| 99 | + // Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 100 | + // let navigationBean = navResDTO.data | ||
| 101 | + // success(navigationBean); | ||
| 102 | + // }).catch((err: Error) => { | ||
| 103 | + // Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 104 | + // error(err); | ||
| 105 | + // }) | ||
| 106 | + // }) | ||
| 107 | + // } | ||
| 108 | + | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +const mineSettingDatasModel = MineSettingDatasModel.getInstance() | ||
| 112 | +export default mineSettingDatasModel as MineSettingDatasModel |
| 1 | + | ||
| 2 | +@Observed | ||
| 3 | +export class MineMainSettingFunctionItem { | ||
| 4 | + imgSrc:Resource // 图标 | ||
| 5 | + title:string // 标题 | ||
| 6 | + subTitle:string // 副标题 | ||
| 7 | + type:number // 数据类型 0默认箭头类型,1右侧switch按钮类型 | ||
| 8 | + switchState:boolean // 右侧switch按钮状态 | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + constructor(imgSrc:Resource,title:string,subTitle:string,type:number,switchState:boolean){ | ||
| 12 | + this.imgSrc = imgSrc | ||
| 13 | + this.title = title | ||
| 14 | + this.subTitle = subTitle | ||
| 15 | + this.type = type | ||
| 16 | + this.switchState = switchState | ||
| 17 | + } | ||
| 18 | +} |
-
Please register or login to post a comment