Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
69 changed files
with
1388 additions
and
560 deletions
| 1 | +import ArrayList from '@ohos.util.ArrayList' | ||
| 2 | +import { MineSettingComponent } from 'wdComponent'; | ||
| 3 | + | ||
| 4 | +@Entry | ||
| 5 | +@Component | ||
| 6 | +struct SettingPage { | ||
| 7 | + @State message: string = 'Hello World 02' | ||
| 8 | + | ||
| 9 | + build() { | ||
| 10 | + Column() { | ||
| 11 | + MineSettingComponent() | ||
| 12 | + }.setFullWidth() | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + // 私有方法 | ||
| 16 | + @Styles setFullWidth(){ | ||
| 17 | + .width('100%') | ||
| 18 | + } | ||
| 19 | +} | ||
| 20 | +/* | ||
| 21 | + | ||
| 22 | +* */ |
| @@ -4,6 +4,9 @@ | @@ -4,6 +4,9 @@ | ||
| 4 | "pages/MainPage", | 4 | "pages/MainPage", |
| 5 | "pages/ColumnPage", | 5 | "pages/ColumnPage", |
| 6 | "pages/TestPage", | 6 | "pages/TestPage", |
| 7 | + "pages/SettingPage", | ||
| 8 | + "pages/PrivacySettingPage", | ||
| 9 | + "pages/SettingAboutPage", | ||
| 7 | "pages/AppointmentListPage", | 10 | "pages/AppointmentListPage", |
| 8 | "pages/FollowListPage" | 11 | "pages/FollowListPage" |
| 9 | ] | 12 | ] |
| @@ -28,6 +28,10 @@ export { BigPicCardComponent } from "./components/view/BigPicCardComponent" | @@ -28,6 +28,10 @@ export { BigPicCardComponent } from "./components/view/BigPicCardComponent" | ||
| 28 | 28 | ||
| 29 | export { HeadPictureCardComponent } from "./components/view/HeadPictureCardComponent" | 29 | export { HeadPictureCardComponent } from "./components/view/HeadPictureCardComponent" |
| 30 | 30 | ||
| 31 | +export { MineSettingComponent } from "./components/page/MineSettingComponent" | ||
| 32 | + | ||
| 33 | +export { AboutPageUI } from "./components/page/about/AboutPageUI" | ||
| 34 | + | ||
| 31 | export { AppointmentListUI } from "./components/page/mine/AppointmentListUI" | 35 | export { AppointmentListUI } from "./components/page/mine/AppointmentListUI" |
| 32 | 36 | ||
| 33 | export { FollowFirstTabsComponent } from "./components/page/mine/follow/FollowFirstTabsComponent" | 37 | export { FollowFirstTabsComponent } from "./components/page/mine/follow/FollowFirstTabsComponent" |
| @@ -65,6 +65,7 @@ export struct MinePageComponent { | @@ -65,6 +65,7 @@ export struct MinePageComponent { | ||
| 65 | //Card | 65 | //Card |
| 66 | MinePageCardUI() | 66 | MinePageCardUI() |
| 67 | //创作者区域 | 67 | //创作者区域 |
| 68 | + | ||
| 68 | MinePageCreatorFunctionUI({creatorData:$creatorData}) | 69 | MinePageCreatorFunctionUI({creatorData:$creatorData}) |
| 69 | //更多功能 | 70 | //更多功能 |
| 70 | MinePageMoreFunctionUI({moreData:$moreData}) | 71 | MinePageMoreFunctionUI({moreData:$moreData}) |
| 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 | + | ||
| 10 | +import storageStatistics from "@ohos.file.storageStatistics"; | ||
| 11 | +import { BusinessError } from '@ohos.base'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +@Component | ||
| 15 | +export struct MineSettingComponent { | ||
| 16 | + @State listData: Array<string | Array<string>> = new Array(); | ||
| 17 | + @State privacySwitch:boolean = false | ||
| 18 | + @State cacheSice:number = 0 | ||
| 19 | + | ||
| 20 | + aboutToAppear() { | ||
| 21 | + // 获取设置页面数据 | ||
| 22 | + this.getSettingPageData() | ||
| 23 | + | ||
| 24 | + // 获取缓存数据 | ||
| 25 | + storageStatistics.getCurrentBundleStats((err: BusinessError, bundleStats: storageStatistics.BundleStats) => { | ||
| 26 | + if (err) { | ||
| 27 | + console.error(`Invoke getCurrentBundleStats failed, code is ${err.code}, message is ${err.message}`); | ||
| 28 | + } else { | ||
| 29 | + this.cacheSice = bundleStats.appSize / 1024.00 / 1024.00.toFixed(2); | ||
| 30 | + } | ||
| 31 | + }); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + getSettingPageData() { | ||
| 35 | + let listArr = [['账户与安全', '接收推送', '隐私设罝', '仅WiFi网络加载图片', 'WiFi网络情况下自动播放视频', '开户播放器悬浮窗'], ['清除缓存', '去评分']]; | ||
| 36 | + this.listData = listArr; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + build() { | ||
| 40 | + Navigation() { | ||
| 41 | + //滑动区域 | ||
| 42 | + this.settingList() | ||
| 43 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 44 | + .title('设置') | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // 页面布局 | ||
| 48 | + @Builder settingList() { | ||
| 49 | + Column() { | ||
| 50 | + List() { | ||
| 51 | + // 循环渲染ListItemGroup,contactsGroups为多个分组联系人contacts和标题title的数据集合 | ||
| 52 | + ForEach(this.listData, (item: Array<string>, index: number) => { | ||
| 53 | + ListItemGroup({ header: index === 0 ? this.itemHead("") : this.itemHead("1") }) { | ||
| 54 | + // 循环渲染ListItem | ||
| 55 | + ForEach(item, (subItem: string, subIndex: number) => { | ||
| 56 | + ListItem() { | ||
| 57 | + if (subIndex == 6) { | ||
| 58 | + this.getArrowCell(subItem, subIndex, index) | ||
| 59 | + } else if (subIndex == 1 || subIndex == 3 || subIndex == 4 || subIndex == 5) { | ||
| 60 | + this.getSwitchCell(subItem, subIndex) | ||
| 61 | + } else { | ||
| 62 | + this.getArrowCell(subItem, subIndex, index) | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + }.padding({ left: '27lpx' }) | ||
| 66 | + .onClick(() => { | ||
| 67 | + console.log(subIndex + "") | ||
| 68 | + if (subIndex == 4) { | ||
| 69 | + // RouteManager.jumpNewPage("pages/SettingPage") // 调用跳转方法,跳转新页面 | ||
| 70 | + } | ||
| 71 | + }) | ||
| 72 | + .height('117lpx') | ||
| 73 | + }, subItem => subItem) | ||
| 74 | + } | ||
| 75 | + .divider({ | ||
| 76 | + strokeWidth: 1, | ||
| 77 | + startMargin: 15, | ||
| 78 | + endMargin: 10, | ||
| 79 | + color: '#f0f0f0' | ||
| 80 | + }) | ||
| 81 | + }) | ||
| 82 | + }.onScrollFrameBegin((offset, state) => { | ||
| 83 | + return { offsetRemain: 0 } | ||
| 84 | + }) | ||
| 85 | + } | ||
| 86 | + .backgroundColor(Color.White) | ||
| 87 | + .borderRadius(8) | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Builder itemHead(text: string) { | ||
| 91 | + // 列表分组的头部组件,对应联系人分组A、B等位置的组件 | ||
| 92 | + if (text.length > 0) { | ||
| 93 | + Row().width('100%').height('20lpx').backgroundColor(0xf0f0f0) | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + // 右侧开关cell | ||
| 98 | + @Builder getSwitchCell(item, index) { | ||
| 99 | + Column() { | ||
| 100 | + Row() { | ||
| 101 | + // 左侧logo和标题 | ||
| 102 | + Row() { | ||
| 103 | + // 判断有没有图片 | ||
| 104 | + if (0) { | ||
| 105 | + Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') | ||
| 106 | + .height('38lpx') | ||
| 107 | + .margin({ right: '5lpx' }) | ||
| 108 | + | ||
| 109 | + Text(`${item}`) | ||
| 110 | + .margin({ top: '8lpx' }) | ||
| 111 | + .height('38lpx') | ||
| 112 | + .fontColor('#333333') | ||
| 113 | + .fontSize('29lpx') | ||
| 114 | + } else { | ||
| 115 | + Text(`${item}`) | ||
| 116 | + .margin({ top: '8lpx' }) | ||
| 117 | + .height('38lpx') | ||
| 118 | + .fontColor('#333333') | ||
| 119 | + .fontSize('29lpx') | ||
| 120 | + } | ||
| 121 | + }.width('60%') | ||
| 122 | + | ||
| 123 | + // 右侧文案和右箭头 | ||
| 124 | + Row() { | ||
| 125 | + Toggle({ type: ToggleType.Switch, isOn: false }) | ||
| 126 | + .height('50lpx') | ||
| 127 | + .margin({ left: '81lpx', right: '29lpx' }) | ||
| 128 | + .selectedColor(Color.Pink) | ||
| 129 | + .onChange((isOn: boolean) => { | ||
| 130 | + this.privacySwitch = isOn; | ||
| 131 | + }) | ||
| 132 | + }.width('40%') | ||
| 133 | + .margin({ right: '29lpx' }) | ||
| 134 | + .justifyContent(FlexAlign.End) | ||
| 135 | + | ||
| 136 | + } | ||
| 137 | + .alignItems(VerticalAlign.Center) | ||
| 138 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 139 | + }.height('54lpx') | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + // 右文字+箭头cell | ||
| 143 | + @Builder getArrowCell(item, index, mainIndex) { | ||
| 144 | + Column() { | ||
| 145 | + | ||
| 146 | + Row() { | ||
| 147 | + // 左侧logo和标题 | ||
| 148 | + Row() { | ||
| 149 | + // 判断有没有图片 | ||
| 150 | + if (this.privacySwitch) { | ||
| 151 | + Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') | ||
| 152 | + .height('38lpx') | ||
| 153 | + .margin({ right: '5lpx' }) | ||
| 154 | + } | ||
| 155 | + Text(`${item}`) | ||
| 156 | + .margin({ top: '8lpx' }) | ||
| 157 | + .height('38lpx') | ||
| 158 | + .fontColor('#333333') | ||
| 159 | + .fontSize('29lpx') | ||
| 160 | + }.width('60%') | ||
| 161 | + | ||
| 162 | + // 右侧文案和右箭头 | ||
| 163 | + Row() { | ||
| 164 | + Text((index == 0 && mainIndex != 0) ? this.cacheSice.toFixed(2) + 'MB' : '') | ||
| 165 | + .fontColor('#999999') | ||
| 166 | + .maxLines(1) | ||
| 167 | + Image($r('app.media.mine_user_arrow')) | ||
| 168 | + .width('27lpx') | ||
| 169 | + .height('27lpx') | ||
| 170 | + .objectFit(ImageFit.Auto) | ||
| 171 | + Column().width('29lpx') | ||
| 172 | + }.width('40%') | ||
| 173 | + .margin({ right: '29lpx' }) | ||
| 174 | + .justifyContent(FlexAlign.End) | ||
| 175 | + | ||
| 176 | + } | ||
| 177 | + .alignItems(VerticalAlign.Center) | ||
| 178 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 179 | + | ||
| 180 | + } | ||
| 181 | + .height('54lpx') | ||
| 182 | + } | ||
| 183 | +} |
| 1 | +const TAG = 'AboutPageUI'; | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct AboutPageUI { | ||
| 5 | + @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.' | ||
| 6 | + @State version: string = '版本号:v8.0.1.1' | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + build() { | ||
| 10 | + Column() { | ||
| 11 | + Image($r('app.media.setting_about_logo')) | ||
| 12 | + .width('278lpx') | ||
| 13 | + .height('154lpx') | ||
| 14 | + .margin({top:'173lpx',bottom:'154lpx'}) | ||
| 15 | + | ||
| 16 | + Row(){ | ||
| 17 | + | ||
| 18 | + }.backgroundColor(Color.Yellow) | ||
| 19 | + .width('100%') | ||
| 20 | + .height('97lpx') | ||
| 21 | + | ||
| 22 | + Row(){ | ||
| 23 | + | ||
| 24 | + }.backgroundColor(Color.Yellow) | ||
| 25 | + .width('100%') | ||
| 26 | + .height('97lpx') | ||
| 27 | + | ||
| 28 | + Blank() | ||
| 29 | + | ||
| 30 | + Image($r('app.media.app_icon')) | ||
| 31 | + .width('192lpx') | ||
| 32 | + .height('192lpx') | ||
| 33 | + | ||
| 34 | + Text(this.version) | ||
| 35 | + .fontSize('25lpx') | ||
| 36 | + .textAlign(TextAlign.Center) | ||
| 37 | + .fontColor($r("app.color.color_666666")) | ||
| 38 | + .margin({bottom:'31lpx'}) | ||
| 39 | + | ||
| 40 | + Text(this.message) | ||
| 41 | + .fontSize('19lpx') | ||
| 42 | + .textAlign(TextAlign.Center) | ||
| 43 | + .fontColor($r("app.color.color_999999")) | ||
| 44 | + .margin({bottom:'35lpx'}) | ||
| 45 | + } | ||
| 46 | + .width('100%') | ||
| 47 | + .height('100%') | ||
| 48 | + } | ||
| 49 | +} |
| 1 | import MinePageMoreFunctionModel from '../../../viewmodel/MinePageMoreFunctionModel' | 1 | import MinePageMoreFunctionModel from '../../../viewmodel/MinePageMoreFunctionModel' |
| 2 | +import RouteManager from '../../../utils/RouteManager' | ||
| 2 | 3 | ||
| 3 | @Component | 4 | @Component |
| 4 | export default struct MinePageMoreFunctionUI{ | 5 | export default struct MinePageMoreFunctionUI{ |
| @@ -64,6 +65,11 @@ export default struct MinePageMoreFunctionUI{ | @@ -64,6 +65,11 @@ export default struct MinePageMoreFunctionUI{ | ||
| 64 | } | 65 | } |
| 65 | .onClick(()=>{ | 66 | .onClick(()=>{ |
| 66 | console.log(index+"") | 67 | console.log(index+"") |
| 68 | + if (index == 3) { | ||
| 69 | + RouteManager.jumpNewPage("pages/SettingPage") | ||
| 70 | + } else { | ||
| 71 | + RouteManager.jumpNewPage("pages/PrivacySettingPage") | ||
| 72 | + } | ||
| 67 | }) | 73 | }) |
| 68 | .height('117lpx') | 74 | .height('117lpx') |
| 69 | }, item => item) | 75 | }, item => item) |
18.7 KB
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 4 | "specifiers": { |
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../wdConstant", | ||
| 10 | - "wdKit@../../../../commons/wdKit": "wdKit@../wdKit" | 5 | + "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0" |
| 11 | }, | 6 | }, |
| 12 | "packages": { | 7 | "packages": { |
| 13 | - "@ohos/axios@2.1.1": { | ||
| 14 | - "name": "@ohos/axios", | ||
| 15 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 16 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 17 | - "registryType": "ohpm" | ||
| 18 | - }, | ||
| 19 | - "wdConstant@../wdConstant": { | ||
| 20 | - "name": "wdconstant", | ||
| 21 | - "resolved": "../wdConstant", | ||
| 22 | - "registryType": "local" | ||
| 23 | - }, | ||
| 24 | - "wdKit@../wdKit": { | ||
| 25 | - "name": "wdkit", | ||
| 26 | - "resolved": "../wdKit", | ||
| 27 | - "registryType": "local" | 8 | + "@ohos/axios@2.2.0": { |
| 9 | + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", | ||
| 10 | + "integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==" | ||
| 28 | } | 11 | } |
| 29 | } | 12 | } |
| 30 | } | 13 | } |
| @@ -54,7 +54,20 @@ export class HttpUrlUtils { | @@ -54,7 +54,20 @@ export class HttpUrlUtils { | ||
| 54 | */ | 54 | */ |
| 55 | static readonly E_NEWSPAPER_LIST_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/paperApi/paperList"; | 55 | static readonly E_NEWSPAPER_LIST_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/paperApi/paperList"; |
| 56 | 56 | ||
| 57 | - private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 57 | + /** |
| 58 | + * 早晚报列表 | ||
| 59 | + * 根据页面id获取页面楼层列表 | ||
| 60 | + * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 | ||
| 61 | + * 根据楼层Id获取组件节目信息 | ||
| 62 | + * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/compInfo?loadStrategy= | ||
| 63 | + * first_load&refreshTime=1710829610144&pageId=28927&channelStrategy=2&groupId=40621& | ||
| 64 | + * pageSize=20&pageNum=1&topicId=10000009445 | ||
| 65 | + * */ | ||
| 66 | + static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | ||
| 67 | + | ||
| 68 | + static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | ||
| 69 | + | ||
| 70 | + private static hostUrl: string = HttpUrlUtils.HOST_UAT; | ||
| 58 | 71 | ||
| 59 | static getCommonHeaders(): HashMap<string, string> { | 72 | static getCommonHeaders(): HashMap<string, string> { |
| 60 | let headers: HashMap<string, string> = new HashMap<string, string>() | 73 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| @@ -67,7 +80,7 @@ export class HttpUrlUtils { | @@ -67,7 +80,7 @@ export class HttpUrlUtils { | ||
| 67 | headers.set('timestamp', HttpUrlUtils.getTimestamp()) | 80 | headers.set('timestamp', HttpUrlUtils.getTimestamp()) |
| 68 | headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) | 81 | headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) |
| 69 | headers.set('device_id', HttpUrlUtils.getDeviceId()) | 82 | headers.set('device_id', HttpUrlUtils.getDeviceId()) |
| 70 | - headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc') | 83 | + // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc') |
| 71 | headers.set('build_version', HttpUrlUtils.getVersion()) | 84 | headers.set('build_version', HttpUrlUtils.getVersion()) |
| 72 | headers.set('adcode', HttpUrlUtils.getAdCode()) | 85 | headers.set('adcode', HttpUrlUtils.getAdCode()) |
| 73 | headers.set('os_version', HttpUrlUtils.getOsVersion()) | 86 | headers.set('os_version', HttpUrlUtils.getOsVersion()) |
| @@ -214,4 +227,19 @@ export class HttpUrlUtils { | @@ -214,4 +227,19 @@ export class HttpUrlUtils { | ||
| 214 | private static getUserType() { | 227 | private static getUserType() { |
| 215 | return '2'; | 228 | return '2'; |
| 216 | } | 229 | } |
| 230 | + | ||
| 231 | + static getVerifyCodeUrl() { | ||
| 232 | + let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode"; | ||
| 233 | + return url; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + static getAppLoginUrl() :string{ | ||
| 237 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/appLogin"; | ||
| 238 | + return url; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + static getCheckVerifyCodeUrl() { | ||
| 242 | + let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; | ||
| 243 | + return url; | ||
| 244 | + } | ||
| 217 | } | 245 | } |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "wdBean@../../../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 9 | - "wdKit@../../../../commons/wdKit": "wdKit@../wdKit" | ||
| 10 | - }, | ||
| 11 | - "packages": { | ||
| 12 | - "wdBean@../../features/wdBean": { | ||
| 13 | - "name": "wdbean", | ||
| 14 | - "resolved": "../../features/wdBean", | ||
| 15 | - "registryType": "local" | ||
| 16 | - }, | ||
| 17 | - "wdKit@../wdKit": { | ||
| 18 | - "name": "wdkit", | ||
| 19 | - "resolved": "../wdKit", | ||
| 20 | - "registryType": "local" | ||
| 21 | - } | ||
| 22 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 23 | } | 6 | } |
| @@ -15,21 +15,25 @@ export class WDRouterPage { | @@ -15,21 +15,25 @@ export class WDRouterPage { | ||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // 主页 | 17 | // 主页 |
| 18 | - static index = new WDRouterPage("entry", "ets/pages/Index"); | 18 | + static index = new WDRouterPage("phone", "ets/pages/Index"); |
| 19 | // 关于页面 | 19 | // 关于页面 |
| 20 | // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | 20 | // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); |
| 21 | // web默认页面 | 21 | // web默认页面 |
| 22 | - static defaultWebPage = new WDRouterPage("entry", "ets/pages/web/DefaultWebPage"); | 22 | + static defaultWebPage = new WDRouterPage("phone", "ets/pages/web/DefaultWebPage"); |
| 23 | // 电子报页面 | 23 | // 电子报页面 |
| 24 | - static eNewspaper = new WDRouterPage("entry", "ets/pages/ENewspaper") | 24 | + static eNewspaper = new WDRouterPage("phone", "ets/pages/ENewspaper") |
| 25 | // 早晚报页面 | 25 | // 早晚报页面 |
| 26 | - static morningEveningPaperPage = new WDRouterPage("entry", "ets/pages/MorningEveningPaperPage") | 26 | + static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") |
| 27 | // 图文详情页 | 27 | // 图文详情页 |
| 28 | - static imageTextDetailPage = new WDRouterPage("entry", "ets/pages/ImageAndTextDetailPage"); | 28 | + static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); |
| 29 | // 短视频详情页 | 29 | // 短视频详情页 |
| 30 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | 30 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); |
| 31 | // 点播详情页 | 31 | // 点播详情页 |
| 32 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | 32 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); |
| 33 | // 直播详情页 | 33 | // 直播详情页 |
| 34 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | 34 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); |
| 35 | + | ||
| 36 | + static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | ||
| 37 | + | ||
| 38 | + static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | ||
| 35 | } | 39 | } |
| @@ -14,7 +14,7 @@ export class WDRouterRule { | @@ -14,7 +14,7 @@ export class WDRouterRule { | ||
| 14 | WDRouterRule.jumpWithPage(page, action) | 14 | WDRouterRule.jumpWithPage(page, action) |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | - private static jumpWithPage(page?: WDRouterPage, params?: object) { | 17 | + static jumpWithPage(page?: WDRouterPage, params?: object) { |
| 18 | if (page) { | 18 | if (page) { |
| 19 | if (params) { | 19 | if (params) { |
| 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) | 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "wdBean@../../../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 9 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../wdConstant", | ||
| 10 | - "wdJsBridge@../../../wdJsBridge": "wdJsBridge@../wdJsBridge", | ||
| 11 | - "wdJsBridge@../wdJsBridge": "wdJsBridge@../wdJsBridge", | ||
| 12 | - "wdKit@../../../../commons/wdKit": "wdKit@../wdKit", | ||
| 13 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../wdRouter" | ||
| 14 | - }, | ||
| 15 | - "packages": { | ||
| 16 | - "wdBean@../../features/wdBean": { | ||
| 17 | - "name": "wdbean", | ||
| 18 | - "resolved": "../../features/wdBean", | ||
| 19 | - "registryType": "local" | ||
| 20 | - }, | ||
| 21 | - "wdConstant@../wdConstant": { | ||
| 22 | - "name": "wdconstant", | ||
| 23 | - "resolved": "../wdConstant", | ||
| 24 | - "registryType": "local" | ||
| 25 | - }, | ||
| 26 | - "wdJsBridge@../wdJsBridge": { | ||
| 27 | - "name": "wdjsbridge", | ||
| 28 | - "resolved": "../wdJsBridge", | ||
| 29 | - "registryType": "local" | ||
| 30 | - }, | ||
| 31 | - "wdKit@../wdKit": { | ||
| 32 | - "name": "wdkit", | ||
| 33 | - "resolved": "../wdKit", | ||
| 34 | - "registryType": "local" | ||
| 35 | - }, | ||
| 36 | - "wdRouter@../wdRouter": { | ||
| 37 | - "name": "wdrouter", | ||
| 38 | - "resolved": "../wdRouter", | ||
| 39 | - "registryType": "local", | ||
| 40 | - "dependencies": { | ||
| 41 | - "wdKit": "file:../wdKit", | ||
| 42 | - "wdBean": "file:../../features/wdBean" | ||
| 43 | - } | ||
| 44 | - } | ||
| 45 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 46 | } | 6 | } |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdBean@../../../../features/wdBean": "wdBean@../wdBean", | ||
| 10 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 11 | - "wdConstant@../../commons/wdConstant": "wdConstant@../commons/wdConstant", | ||
| 12 | - "wdJsBridge@../../../wdJsBridge": "wdJsBridge@../../commons/wdJsBridge", | ||
| 13 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 14 | - "wdKit@../../commons/wdKit": "wdKit@../commons/wdKit", | ||
| 15 | - "wdNetwork@../../../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 16 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../../commons/wdRouter", | ||
| 17 | - "wdWebComponent@../../../../commons/wdWebComponent": "wdWebComponent@../../commons/wdWebComponent" | ||
| 18 | - }, | ||
| 19 | - "packages": { | ||
| 20 | - "@ohos/axios@2.1.1": { | ||
| 21 | - "name": "@ohos/axios", | ||
| 22 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 23 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 24 | - "registryType": "ohpm" | ||
| 25 | - }, | ||
| 26 | - "wdBean@../wdBean": { | ||
| 27 | - "name": "wdbean", | ||
| 28 | - "resolved": "../wdBean", | ||
| 29 | - "registryType": "local" | ||
| 30 | - }, | ||
| 31 | - "wdConstant@../../commons/wdConstant": { | ||
| 32 | - "name": "wdconstant", | ||
| 33 | - "resolved": "../../commons/wdConstant", | ||
| 34 | - "registryType": "local" | ||
| 35 | - }, | ||
| 36 | - "wdConstant@../commons/wdConstant": { | ||
| 37 | - "name": "wdconstant", | ||
| 38 | - "resolved": "../commons/wdConstant", | ||
| 39 | - "registryType": "local" | ||
| 40 | - }, | ||
| 41 | - "wdJsBridge@../../commons/wdJsBridge": { | ||
| 42 | - "name": "wdjsbridge", | ||
| 43 | - "resolved": "../../commons/wdJsBridge", | ||
| 44 | - "registryType": "local" | ||
| 45 | - }, | ||
| 46 | - "wdKit@../../commons/wdKit": { | ||
| 47 | - "name": "wdkit", | ||
| 48 | - "resolved": "../../commons/wdKit", | ||
| 49 | - "registryType": "local" | ||
| 50 | - }, | ||
| 51 | - "wdKit@../commons/wdKit": { | ||
| 52 | - "name": "wdkit", | ||
| 53 | - "resolved": "../commons/wdKit", | ||
| 54 | - "registryType": "local" | ||
| 55 | - }, | ||
| 56 | - "wdNetwork@../../commons/wdNetwork": { | ||
| 57 | - "name": "wdnetwork", | ||
| 58 | - "resolved": "../../commons/wdNetwork", | ||
| 59 | - "registryType": "local", | ||
| 60 | - "dependencies": { | ||
| 61 | - "wdConstant": "file:../wdConstant", | ||
| 62 | - "wdKit": "file:../wdKit", | ||
| 63 | - "@ohos/axios": "^2.1.1" | ||
| 64 | - } | ||
| 65 | - }, | ||
| 66 | - "wdRouter@../../commons/wdRouter": { | ||
| 67 | - "name": "wdrouter", | ||
| 68 | - "resolved": "../../commons/wdRouter", | ||
| 69 | - "registryType": "local", | ||
| 70 | - "dependencies": { | ||
| 71 | - "wdKit": "file:../wdKit", | ||
| 72 | - "wdBean": "file:../../features/wdBean" | ||
| 73 | - } | ||
| 74 | - }, | ||
| 75 | - "wdWebComponent@../../commons/wdWebComponent": { | ||
| 76 | - "name": "wdwebcomponent", | ||
| 77 | - "resolved": "../../commons/wdWebComponent", | ||
| 78 | - "registryType": "local", | ||
| 79 | - "dependencies": { | ||
| 80 | - "wdConstant": "file:../wdConstant", | ||
| 81 | - "wdKit": "file:../wdKit", | ||
| 82 | - "wdJsBridge": "file:../wdJsBridge", | ||
| 83 | - "wdBean": "file:../../features/wdBean", | ||
| 84 | - "wdRouter": "file:../wdRouter" | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 88 | } | 6 | } |
| 1 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 2 | + | ||
| 1 | const TAG = 'PageComponent'; | 3 | const TAG = 'PageComponent'; |
| 2 | 4 | ||
| 3 | /** | 5 | /** |
| @@ -7,7 +9,9 @@ const TAG = 'PageComponent'; | @@ -7,7 +9,9 @@ const TAG = 'PageComponent'; | ||
| 7 | export struct MinePageComponent { | 9 | export struct MinePageComponent { |
| 8 | // TODO 待完善 | 10 | // TODO 待完善 |
| 9 | build() { | 11 | build() { |
| 10 | - Text('我的页面') | 12 | + Text('我的页面').onClick(()=>{ |
| 13 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 14 | + }) | ||
| 11 | } | 15 | } |
| 12 | } | 16 | } |
| 13 | 17 |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdBean@../../../../features/wdBean": "wdBean@../wdBean", | ||
| 10 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 11 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 12 | - "wdKit@../../commons/wdKit": "wdKit@../commons/wdKit", | ||
| 13 | - "wdNetwork@../../../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 14 | - "wdPlayer@../../../wdPlayer": "wdPlayer@../wdPlayer", | ||
| 15 | - "wdPlayer@../wdPlayer": "wdPlayer@../wdPlayer", | ||
| 16 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../../commons/wdRouter" | ||
| 17 | - }, | ||
| 18 | - "packages": { | ||
| 19 | - "@ohos/axios@2.1.1": { | ||
| 20 | - "name": "@ohos/axios", | ||
| 21 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 22 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 23 | - "registryType": "ohpm" | ||
| 24 | - }, | ||
| 25 | - "wdBean@../wdBean": { | ||
| 26 | - "name": "wdbean", | ||
| 27 | - "resolved": "../wdBean", | ||
| 28 | - "registryType": "local" | ||
| 29 | - }, | ||
| 30 | - "wdConstant@../../commons/wdConstant": { | ||
| 31 | - "name": "wdconstant", | ||
| 32 | - "resolved": "../../commons/wdConstant", | ||
| 33 | - "registryType": "local" | ||
| 34 | - }, | ||
| 35 | - "wdKit@../../commons/wdKit": { | ||
| 36 | - "name": "wdkit", | ||
| 37 | - "resolved": "../../commons/wdKit", | ||
| 38 | - "registryType": "local" | ||
| 39 | - }, | ||
| 40 | - "wdKit@../commons/wdKit": { | ||
| 41 | - "name": "wdkit", | ||
| 42 | - "resolved": "../commons/wdKit", | ||
| 43 | - "registryType": "local" | ||
| 44 | - }, | ||
| 45 | - "wdNetwork@../../commons/wdNetwork": { | ||
| 46 | - "name": "wdnetwork", | ||
| 47 | - "resolved": "../../commons/wdNetwork", | ||
| 48 | - "registryType": "local", | ||
| 49 | - "dependencies": { | ||
| 50 | - "wdConstant": "file:../wdConstant", | ||
| 51 | - "wdKit": "file:../wdKit", | ||
| 52 | - "@ohos/axios": "^2.1.1" | ||
| 53 | - } | ||
| 54 | - }, | ||
| 55 | - "wdPlayer@../wdPlayer": { | ||
| 56 | - "name": "wdplayer", | ||
| 57 | - "resolved": "../wdPlayer", | ||
| 58 | - "registryType": "local", | ||
| 59 | - "dependencies": { | ||
| 60 | - "wdKit": "file:../../commons/wdKit" | ||
| 61 | - } | ||
| 62 | - }, | ||
| 63 | - "wdRouter@../../commons/wdRouter": { | ||
| 64 | - "name": "wdrouter", | ||
| 65 | - "resolved": "../../commons/wdRouter", | ||
| 66 | - "registryType": "local", | ||
| 67 | - "dependencies": { | ||
| 68 | - "wdKit": "file:../wdKit", | ||
| 69 | - "wdBean": "file:../../features/wdBean" | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 73 | } | 6 | } |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdBean@../../../../features/wdBean": "wdBean@../wdBean", | ||
| 10 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 11 | - "wdDetailPlayApi@../../../wdDetailPlayApi": "wdDetailPlayApi@../wdDetailPlayApi", | ||
| 12 | - "wdDetailPlayApi@../wdDetailPlayApi": "wdDetailPlayApi@../wdDetailPlayApi", | ||
| 13 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 14 | - "wdKit@../../commons/wdKit": "wdKit@../commons/wdKit", | ||
| 15 | - "wdNetwork@../../../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 16 | - "wdPlayer@../../../wdPlayer": "wdPlayer@../wdPlayer", | ||
| 17 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../../commons/wdRouter", | ||
| 18 | - "wdRouter@../../commons/wdRouter": "wdRouter@../commons/wdRouter" | ||
| 19 | - }, | ||
| 20 | - "packages": { | ||
| 21 | - "@ohos/axios@2.1.1": { | ||
| 22 | - "name": "@ohos/axios", | ||
| 23 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 24 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 25 | - "registryType": "ohpm" | ||
| 26 | - }, | ||
| 27 | - "wdBean@../wdBean": { | ||
| 28 | - "name": "wdbean", | ||
| 29 | - "resolved": "../wdBean", | ||
| 30 | - "registryType": "local" | ||
| 31 | - }, | ||
| 32 | - "wdConstant@../../commons/wdConstant": { | ||
| 33 | - "name": "wdconstant", | ||
| 34 | - "resolved": "../../commons/wdConstant", | ||
| 35 | - "registryType": "local" | ||
| 36 | - }, | ||
| 37 | - "wdDetailPlayApi@../wdDetailPlayApi": { | ||
| 38 | - "name": "wddetailplayapi", | ||
| 39 | - "resolved": "../wdDetailPlayApi", | ||
| 40 | - "registryType": "local", | ||
| 41 | - "dependencies": { | ||
| 42 | - "wdKit": "file:../../commons/wdKit", | ||
| 43 | - "wdBean": "file:../../features/wdBean", | ||
| 44 | - "wdRouter": "file:../../commons/wdRouter", | ||
| 45 | - "wdNetwork": "file:../../commons/wdNetwork", | ||
| 46 | - "wdPlayer": "file:../../features/wdPlayer" | ||
| 47 | - } | ||
| 48 | - }, | ||
| 49 | - "wdKit@../../commons/wdKit": { | ||
| 50 | - "name": "wdkit", | ||
| 51 | - "resolved": "../../commons/wdKit", | ||
| 52 | - "registryType": "local" | ||
| 53 | - }, | ||
| 54 | - "wdKit@../commons/wdKit": { | ||
| 55 | - "name": "wdkit", | ||
| 56 | - "resolved": "../commons/wdKit", | ||
| 57 | - "registryType": "local" | ||
| 58 | - }, | ||
| 59 | - "wdNetwork@../../commons/wdNetwork": { | ||
| 60 | - "name": "wdnetwork", | ||
| 61 | - "resolved": "../../commons/wdNetwork", | ||
| 62 | - "registryType": "local", | ||
| 63 | - "dependencies": { | ||
| 64 | - "wdConstant": "file:../wdConstant", | ||
| 65 | - "wdKit": "file:../wdKit", | ||
| 66 | - "@ohos/axios": "^2.1.1" | ||
| 67 | - } | ||
| 68 | - }, | ||
| 69 | - "wdPlayer@../wdPlayer": { | ||
| 70 | - "name": "wdplayer", | ||
| 71 | - "resolved": "../wdPlayer", | ||
| 72 | - "registryType": "local", | ||
| 73 | - "dependencies": { | ||
| 74 | - "wdKit": "file:../../commons/wdKit" | ||
| 75 | - } | ||
| 76 | - }, | ||
| 77 | - "wdRouter@../../commons/wdRouter": { | ||
| 78 | - "name": "wdrouter", | ||
| 79 | - "resolved": "../../commons/wdRouter", | ||
| 80 | - "registryType": "local", | ||
| 81 | - "dependencies": { | ||
| 82 | - "wdKit": "file:../wdKit", | ||
| 83 | - "wdBean": "file:../../features/wdBean" | ||
| 84 | - } | ||
| 85 | - }, | ||
| 86 | - "wdRouter@../commons/wdRouter": { | ||
| 87 | - "name": "wdrouter", | ||
| 88 | - "resolved": "../commons/wdRouter", | ||
| 89 | - "registryType": "local", | ||
| 90 | - "dependencies": { | ||
| 91 | - "wdKit": "file:../wdKit", | ||
| 92 | - "wdBean": "file:../../wdBean" | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 96 | } | 6 | } |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdBean@../../../../features/wdBean": "wdBean@../wdBean", | ||
| 10 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 11 | - "wdDetailPlayApi@../../../wdDetailPlayApi": "wdDetailPlayApi@../wdDetailPlayApi", | ||
| 12 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 13 | - "wdKit@../../commons/wdKit": "wdKit@../commons/wdKit", | ||
| 14 | - "wdNetwork@../../../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 15 | - "wdPlayer@../../../wdPlayer": "wdPlayer@../wdPlayer", | ||
| 16 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../../commons/wdRouter", | ||
| 17 | - "wdRouter@../../commons/wdRouter": "wdRouter@../commons/wdRouter" | ||
| 18 | - }, | ||
| 19 | - "packages": { | ||
| 20 | - "@ohos/axios@2.1.1": { | ||
| 21 | - "name": "@ohos/axios", | ||
| 22 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 23 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 24 | - "registryType": "ohpm" | ||
| 25 | - }, | ||
| 26 | - "wdBean@../wdBean": { | ||
| 27 | - "name": "wdbean", | ||
| 28 | - "resolved": "../wdBean", | ||
| 29 | - "registryType": "local" | ||
| 30 | - }, | ||
| 31 | - "wdConstant@../../commons/wdConstant": { | ||
| 32 | - "name": "wdconstant", | ||
| 33 | - "resolved": "../../commons/wdConstant", | ||
| 34 | - "registryType": "local" | ||
| 35 | - }, | ||
| 36 | - "wdDetailPlayApi@../wdDetailPlayApi": { | ||
| 37 | - "name": "wddetailplayapi", | ||
| 38 | - "resolved": "../wdDetailPlayApi", | ||
| 39 | - "registryType": "local", | ||
| 40 | - "dependencies": { | ||
| 41 | - "wdKit": "file:../../commons/wdKit", | ||
| 42 | - "wdBean": "file:../../features/wdBean", | ||
| 43 | - "wdRouter": "file:../../commons/wdRouter", | ||
| 44 | - "wdNetwork": "file:../../commons/wdNetwork", | ||
| 45 | - "wdPlayer": "file:../../features/wdPlayer" | ||
| 46 | - } | ||
| 47 | - }, | ||
| 48 | - "wdKit@../../commons/wdKit": { | ||
| 49 | - "name": "wdkit", | ||
| 50 | - "resolved": "../../commons/wdKit", | ||
| 51 | - "registryType": "local" | ||
| 52 | - }, | ||
| 53 | - "wdKit@../commons/wdKit": { | ||
| 54 | - "name": "wdkit", | ||
| 55 | - "resolved": "../commons/wdKit", | ||
| 56 | - "registryType": "local" | ||
| 57 | - }, | ||
| 58 | - "wdNetwork@../../commons/wdNetwork": { | ||
| 59 | - "name": "wdnetwork", | ||
| 60 | - "resolved": "../../commons/wdNetwork", | ||
| 61 | - "registryType": "local", | ||
| 62 | - "dependencies": { | ||
| 63 | - "wdConstant": "file:../wdConstant", | ||
| 64 | - "wdKit": "file:../wdKit", | ||
| 65 | - "@ohos/axios": "^2.1.1" | ||
| 66 | - } | ||
| 67 | - }, | ||
| 68 | - "wdPlayer@../wdPlayer": { | ||
| 69 | - "name": "wdplayer", | ||
| 70 | - "resolved": "../wdPlayer", | ||
| 71 | - "registryType": "local", | ||
| 72 | - "dependencies": { | ||
| 73 | - "wdKit": "file:../../commons/wdKit" | ||
| 74 | - } | ||
| 75 | - }, | ||
| 76 | - "wdRouter@../../commons/wdRouter": { | ||
| 77 | - "name": "wdrouter", | ||
| 78 | - "resolved": "../../commons/wdRouter", | ||
| 79 | - "registryType": "local", | ||
| 80 | - "dependencies": { | ||
| 81 | - "wdKit": "file:../wdKit", | ||
| 82 | - "wdBean": "file:../../features/wdBean" | ||
| 83 | - } | ||
| 84 | - }, | ||
| 85 | - "wdRouter@../commons/wdRouter": { | ||
| 86 | - "name": "wdrouter", | ||
| 87 | - "resolved": "../commons/wdRouter", | ||
| 88 | - "registryType": "local", | ||
| 89 | - "dependencies": { | ||
| 90 | - "wdKit": "file:../wdKit", | ||
| 91 | - "wdBean": "file:../../wdBean" | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 95 | } | 6 | } |
sight_harmony/features/wdLogin/.gitignore
0 → 100644
sight_harmony/features/wdLogin/Index.ets
0 → 100644
| 1 | +export { add } from "./src/main/ets/utils/Calc" |
| 1 | +{ | ||
| 2 | + "apiType": "stageMode", | ||
| 3 | + "buildOption": { | ||
| 4 | + "arkOptions": { | ||
| 5 | + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ | ||
| 6 | + } | ||
| 7 | + }, | ||
| 8 | + "buildOptionSet": [ | ||
| 9 | + { | ||
| 10 | + "name": "release", | ||
| 11 | + "arkOptions": { | ||
| 12 | + "obfuscation": { | ||
| 13 | + "ruleOptions": { | ||
| 14 | + "enable": true, | ||
| 15 | + "files": [ | ||
| 16 | + "./obfuscation-rules.txt" | ||
| 17 | + ] | ||
| 18 | + } | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + ], | ||
| 23 | + "targets": [ | ||
| 24 | + { | ||
| 25 | + "name": "default" | ||
| 26 | + } | ||
| 27 | + ] | ||
| 28 | +} |
sight_harmony/features/wdLogin/hvigorfile.ts
0 → 100644
| 1 | +# Define project specific obfuscation rules here. | ||
| 2 | +# You can include the obfuscation configuration files in the current module's build-profile.json5. | ||
| 3 | +# | ||
| 4 | +# For more details, see | ||
| 5 | +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md | ||
| 6 | + | ||
| 7 | +# Obfuscation options: | ||
| 8 | +# -disable-obfuscation: disable all obfuscations | ||
| 9 | +# -enable-property-obfuscation: obfuscate the property names | ||
| 10 | +# -enable-toplevel-obfuscation: obfuscate the names in the global scope | ||
| 11 | +# -compact: remove unnecessary blank spaces and all line feeds | ||
| 12 | +# -remove-log: remove all console.* statements | ||
| 13 | +# -print-namecache: print the name cache that contains the mapping from the old names to new names | ||
| 14 | +# -apply-namecache: reuse the given cache file | ||
| 15 | + | ||
| 16 | +# Keep options: | ||
| 17 | +# -keep-property-name: specifies property names that you want to keep | ||
| 18 | +# -keep-global-name: specifies names that you want to keep in the global scope |
| 1 | +{ | ||
| 2 | + "name": "wdlogin", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "Please describe the basic information.", | ||
| 5 | + "main": "Index.ets", | ||
| 6 | + "author": "", | ||
| 7 | + "license": "Apache-2.0", | ||
| 8 | + "dependencies": { | ||
| 9 | + "wdConstant": "file:../../commons/wdConstant", | ||
| 10 | + "wdKit": "file:../../commons/wdKit", | ||
| 11 | + "wdWebComponent": "file:../../commons/wdWebComponent", | ||
| 12 | + "wdBean": "file:../../features/wdBean", | ||
| 13 | + "wdRouter": "file:../../commons/wdRouter", | ||
| 14 | + "wdNetwork": "file:../../commons/wdNetwork" | ||
| 15 | + } | ||
| 16 | +} |
| 1 | +@CustomDialog | ||
| 2 | +export struct CustomProtocolDialog { | ||
| 3 | + controller: CustomDialogController | ||
| 4 | + | ||
| 5 | + cancel: () => void = () => { | ||
| 6 | + } | ||
| 7 | + | ||
| 8 | + confirm: () => void = () => { | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + build() { | ||
| 12 | + Column() { | ||
| 13 | + Text("温馨提示") | ||
| 14 | + .fontColor("#222222") | ||
| 15 | + .fontSize(18) | ||
| 16 | + .width("100%") | ||
| 17 | + .fontWeight(FontWeight.Bold) | ||
| 18 | + .textAlign(TextAlign.Center) | ||
| 19 | + .margin({ top: 20 }) | ||
| 20 | + Text() { | ||
| 21 | + Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | ||
| 22 | + Span("《用户协议》").fontSize(14).fontColor("#ED2800") | ||
| 23 | + Span("及").fontSize(14).fontColor("#666666") | ||
| 24 | + Span("《隐私政策》").fontSize(14).fontColor("#ED2800") | ||
| 25 | + Span("后进行登录").fontSize(14).fontColor("#666666") | ||
| 26 | + }.margin({ top: 12, left: 16, right: 16 }) | ||
| 27 | + | ||
| 28 | + Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | ||
| 29 | + Row() { | ||
| 30 | + Text('放弃登录') | ||
| 31 | + .fontSize(16) | ||
| 32 | + .fontColor("#999999") | ||
| 33 | + .layoutWeight(1) | ||
| 34 | + .fontWeight(FontWeight.Medium) | ||
| 35 | + .textAlign(TextAlign.Center) | ||
| 36 | + .onClick(() => { | ||
| 37 | + this.controller.close() | ||
| 38 | + if (this.cancel) { | ||
| 39 | + this.cancel() | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + }) | ||
| 43 | + .height('100%') | ||
| 44 | + // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 45 | + Text('同意并登录') | ||
| 46 | + .fontSize(16) | ||
| 47 | + .fontColor("#ED2800") | ||
| 48 | + .layoutWeight(1) | ||
| 49 | + .fontWeight(FontWeight.Medium) | ||
| 50 | + .textAlign(TextAlign.Center) | ||
| 51 | + .border({ | ||
| 52 | + width: { left: 1 }, | ||
| 53 | + color: "#999999", | ||
| 54 | + style: { left: BorderStyle.Solid } | ||
| 55 | + | ||
| 56 | + }) | ||
| 57 | + .onClick(() => { | ||
| 58 | + this.controller.close() | ||
| 59 | + if (this.confirm) { | ||
| 60 | + this.confirm() | ||
| 61 | + } | ||
| 62 | + }) | ||
| 63 | + .height('100%') | ||
| 64 | + }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 65 | + }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | ||
| 66 | + } | ||
| 67 | +} |
| 1 | +import { Logger } from 'wdKit/src/main/ets/utils/Logger' | ||
| 2 | +import { LoginInputComponent } from './LoginInputComponent' | ||
| 3 | +import { LoginViewModel } from './LoginViewModel' | ||
| 4 | +import router from '@ohos.router' | ||
| 5 | +import promptAction from '@ohos.promptAction' | ||
| 6 | + | ||
| 7 | +const TAG = 'ForgetPasswordPage' | ||
| 8 | +/** | ||
| 9 | + * 找回密码页面 | ||
| 10 | + * */ | ||
| 11 | +@Entry | ||
| 12 | +@Component | ||
| 13 | +struct ForgetPasswordPage { | ||
| 14 | + @State phoneContent: string = '' | ||
| 15 | + @State codeContent: string = '' | ||
| 16 | + @State isSubmit: boolean = false //是否可以提交 默认不可以 | ||
| 17 | + loginViewModel: LoginViewModel = new LoginViewModel() | ||
| 18 | + @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 | ||
| 19 | + onCodeSend() { | ||
| 20 | + if (this.isCodeSend) { | ||
| 21 | + this.sendVerifyCode() | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Column() { | ||
| 27 | + Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => { | ||
| 28 | + router.back() | ||
| 29 | + }) | ||
| 30 | + Text('找回密码').fontSize(22).fontColor('#333333').fontWeight(FontWeight.Bold).margin({ left: 25, top: 112 }) | ||
| 31 | + LoginInputComponent({ | ||
| 32 | + phoneContent: $phoneContent, | ||
| 33 | + codeContent: $codeContent, | ||
| 34 | + isSubmit: $isSubmit, | ||
| 35 | + isCodeSend: $isCodeSend | ||
| 36 | + }) | ||
| 37 | + Row() { | ||
| 38 | + Button("确认", { type: ButtonType.Normal }) | ||
| 39 | + .layoutWeight(1) | ||
| 40 | + .borderRadius(4) | ||
| 41 | + .fontSize(16) | ||
| 42 | + .fontWeight(FontWeight.Medium) | ||
| 43 | + .margin({ top: 26 }) | ||
| 44 | + .height(44) | ||
| 45 | + .backgroundColor("#ED2800") | ||
| 46 | + .opacity(this.isSubmit ? 1 : 0.6) | ||
| 47 | + .onClick(() => { | ||
| 48 | + this.checkVerifyCode() | ||
| 49 | + | ||
| 50 | + }) | ||
| 51 | + }.padding({ left: 25, right: 25 }).width('100%') | ||
| 52 | + | ||
| 53 | + }.width('100%').height('100%').alignItems(HorizontalAlign.Start) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + aboutToAppear() { | ||
| 57 | + if (this.isCodeSend) { | ||
| 58 | + this.sendVerifyCode() | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + //发送验证码 | ||
| 63 | + sendVerifyCode() { | ||
| 64 | + if (this.isEmpty(this.phoneContent)) { | ||
| 65 | + return | ||
| 66 | + } | ||
| 67 | + this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { | ||
| 68 | + promptAction.showToast({ message: "验证码已发送成功" }) | ||
| 69 | + Logger.debug(TAG, "sendVerifyCode: " + verifyCode) | ||
| 70 | + }) | ||
| 71 | + | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + //校验验证码 | ||
| 76 | + checkVerifyCode() { | ||
| 77 | + if (!this.isSubmit) { | ||
| 78 | + return | ||
| 79 | + } | ||
| 80 | + if (this.isEmpty(this.phoneContent)) { | ||
| 81 | + return | ||
| 82 | + } | ||
| 83 | + if (this.isEmpty(this.codeContent)) { | ||
| 84 | + return | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => { | ||
| 88 | + //todo 跳转密码设置页面 | ||
| 89 | + promptAction.showToast({message:"校验成功,准备跳转设置页面"}) | ||
| 90 | + Logger.debug(TAG,"校验成功") | ||
| 91 | + }).catch((error:string)=>{ | ||
| 92 | + promptAction.showToast({message:error}) | ||
| 93 | + Logger.debug(TAG,"校验失败") | ||
| 94 | + }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + isEmpty(obj: undefined|null|string): boolean { | ||
| 98 | + return (obj == undefined || obj == null || obj == ''); | ||
| 99 | + } | ||
| 100 | +} |
| 1 | +export interface LoginBean { | ||
| 2 | + // {"code":"0","data":{"firstMark":1,"id":569350079889669,"jwtToken":"eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDY0NzE0MiwidXNlcklkIjo1NjkzNTAwNzk4ODk2NjksInVzZXJWZXJzaW9uIjoiNTY5MzUwMDc5ODg5NjY5XzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QjJrRDJ4VyIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGx9.1M0E_6V60opL7AxamGzINpieTHP11fRbiXKDPc-ywWg","longTimeNoLoginMark":0,"refreshToken":"83fe2f1a-77af-4f73-8490-1cebed037f73","status":1,"userName":"人民日报网友2kD2xW","userType":1},"message":"Success","success":true,"timestamp":1710467142214} | ||
| 3 | + firstMark: number | ||
| 4 | + id: number | ||
| 5 | + jwtToken: string | ||
| 6 | + longTimeNoLoginMark: number | ||
| 7 | + refreshToken: string | ||
| 8 | + status: number | ||
| 9 | + userName: string | ||
| 10 | + userType: number | ||
| 11 | + temToken: string | ||
| 12 | +} |
| 1 | +import { Logger } from 'wdKit' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct LoginInputComponent { | ||
| 5 | + @State timeCount: number = 60 | ||
| 6 | + @Link phoneContent: string | ||
| 7 | + @Link codeContent: string | ||
| 8 | + @State codeBtnState: boolean = false //发送验证码控件是否可以 默认不可用 | ||
| 9 | + @Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口 | ||
| 10 | + @Link isSubmit: boolean //是否可以提交 | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Column() { | ||
| 14 | + this.addCodeLayout() | ||
| 15 | + }.width('100%').padding({ left: 25, right: 25 }) | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + @Builder | ||
| 19 | + addCodeLayout() { | ||
| 20 | + TextInput({ placeholder: "请输入手机号" }) | ||
| 21 | + .fontSize(16) | ||
| 22 | + .height(48) | ||
| 23 | + .margin({ top: 36 }) | ||
| 24 | + .backgroundColor("#F5F5F5") | ||
| 25 | + .borderRadius(4) | ||
| 26 | + .type(InputType.PhoneNumber) | ||
| 27 | + .onChange((content) => { | ||
| 28 | + this.phoneContent = content | ||
| 29 | + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6) | ||
| 30 | + if (content.length >= 11) { | ||
| 31 | + this.codeBtnState = true | ||
| 32 | + } else { | ||
| 33 | + this.codeBtnState = false | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | + | ||
| 37 | + Row() { | ||
| 38 | + TextInput({ placeholder: "验证码" }) | ||
| 39 | + .layoutWeight(1) | ||
| 40 | + .fontSize(16) | ||
| 41 | + .height(48) | ||
| 42 | + .type(InputType.Number) | ||
| 43 | + .fontColor("#222222") | ||
| 44 | + .backgroundColor("#00000000") | ||
| 45 | + .borderRadius({ topLeft: 4, bottomLeft: 4 }) | ||
| 46 | + .backgroundImage($r('app.media.login_code_bg_one'), ImageRepeat.NoRepeat) | ||
| 47 | + .backgroundImageSize(ImageSize.Contain) | ||
| 48 | + .onChange((value) => { | ||
| 49 | + this.codeContent = value | ||
| 50 | + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6) | ||
| 51 | + }) | ||
| 52 | + | ||
| 53 | + Text(this.isCodeSend ? this.timeCount + "s" : "发送验证码") | ||
| 54 | + .backgroundImage($r('app.media.login_code_bg'), ImageRepeat.NoRepeat) | ||
| 55 | + .backgroundImageSize(ImageSize.Cover) | ||
| 56 | + .fontColor('#ED2800') | ||
| 57 | + .width(110) | ||
| 58 | + .fontSize(14) | ||
| 59 | + .fontWeight(this.codeBtnState ? FontWeight.Bold : FontWeight.Normal) | ||
| 60 | + .height(48) | ||
| 61 | + .enabled(this.codeBtnState)// .align(Alignment.End) | ||
| 62 | + .textAlign(TextAlign.Center) | ||
| 63 | + .onClick(() => { | ||
| 64 | + if (this.phoneContent.length < 11) { | ||
| 65 | + return | ||
| 66 | + } | ||
| 67 | + this.isCodeSend = true | ||
| 68 | + let time = setInterval(() => { | ||
| 69 | + Logger.debug("倒计时:" + this.timeCount) | ||
| 70 | + this.timeCount-- | ||
| 71 | + if (this.timeCount < 1) { | ||
| 72 | + this.isCodeSend = false | ||
| 73 | + this.timeCount = 60 | ||
| 74 | + clearInterval(time) | ||
| 75 | + } | ||
| 76 | + }, 1000) | ||
| 77 | + | ||
| 78 | + }) | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + }.margin({ top: 15 }).height(61).alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Start) | ||
| 82 | + | ||
| 83 | + } | ||
| 84 | +} |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 5 | +import { LoginBean } from './LoginBean'; | ||
| 6 | +import { CheckVerifyBean } from './CheckVerifyBean'; | ||
| 7 | + | ||
| 8 | +const TAG = 'LoginModel' | ||
| 9 | + | ||
| 10 | +export class LoginModel { | ||
| 11 | + //获取验证码 | ||
| 12 | + sendVerifyCode(number: string) { | ||
| 13 | + let bean: Record<string, string> = {}; | ||
| 14 | + bean['phoneNum'] = number | ||
| 15 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 16 | + return new Promise<string>((success, fail) => { | ||
| 17 | + HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeUrl(), bean, headers).then((data: ResponseDTO<string>) => { | ||
| 18 | + if (!data || !data.data) { | ||
| 19 | + fail("数据为空") | ||
| 20 | + return | ||
| 21 | + } | ||
| 22 | + if (data.code != 0) { | ||
| 23 | + fail(data.message) | ||
| 24 | + return | ||
| 25 | + } | ||
| 26 | + success(data.data) | ||
| 27 | + }, (error: Error) => { | ||
| 28 | + fail(error.message) | ||
| 29 | + Logger.debug("LoginViewModel:error ", error.toString()) | ||
| 30 | + }) | ||
| 31 | + }) | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + //{"phone":"13625644528","loginType":2,"deviceId":"60da5af6-9c59-3566-8622-8c6c00710994","verificationCode":"644528"} | ||
| 37 | + appLogin(phone: string, loginType: number, verificationCode: string) { | ||
| 38 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 39 | + let bean: Record<string, Object> = {}; | ||
| 40 | + bean['phone'] = phone | ||
| 41 | + bean['loginType'] = loginType | ||
| 42 | + bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994' | ||
| 43 | + bean['verificationCode'] = verificationCode | ||
| 44 | + return new Promise<LoginBean>((success, fail) => { | ||
| 45 | + HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => { | ||
| 46 | + Logger.debug("LoginViewModel:success2 ", data.message) | ||
| 47 | + if (!data || !data.data) { | ||
| 48 | + fail("数据为空") | ||
| 49 | + return | ||
| 50 | + } | ||
| 51 | + if (data.code != 0) { | ||
| 52 | + fail(data.message) | ||
| 53 | + return | ||
| 54 | + } | ||
| 55 | + success(data.data) | ||
| 56 | + }, (error: Error) => { | ||
| 57 | + fail(error.message) | ||
| 58 | + Logger.debug("LoginViewModel:error2 ", error.toString()) | ||
| 59 | + }) | ||
| 60 | + }) | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"} | ||
| 64 | + appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | ||
| 65 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 66 | + let bean: Record<string, string | number> = {}; | ||
| 67 | + bean['phone'] = phone | ||
| 68 | + bean['loginType'] = loginType | ||
| 69 | + bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994' | ||
| 70 | + bean['password'] = password | ||
| 71 | + bean['oldPassword'] = oldPassword | ||
| 72 | + return new Promise<LoginBean>((success, fail) => { | ||
| 73 | + HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => { | ||
| 74 | + Logger.debug("LoginViewModel:success2 ", data.message) | ||
| 75 | + if (!data || !data.data) { | ||
| 76 | + fail("数据为空") | ||
| 77 | + return | ||
| 78 | + } | ||
| 79 | + if (data.code != 0) { | ||
| 80 | + fail(data.message) | ||
| 81 | + return | ||
| 82 | + } | ||
| 83 | + success(data.data) | ||
| 84 | + }, (error: Error) => { | ||
| 85 | + Logger.debug("LoginViewModel:error2 ", error.toString()) | ||
| 86 | + fail(error.message) | ||
| 87 | + }) | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + //忘记密码 校验验证码 {"verifyCode":"644528","phone":"13625644528"} 去除头部cookie 可以正常访问 | ||
| 92 | + checkVerifyCode(phone: string, verifyCode: string) { | ||
| 93 | + let bean: Record<string, Object> = {}; | ||
| 94 | + bean['verifyCode'] = verifyCode | ||
| 95 | + bean['phone'] = phone | ||
| 96 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 97 | + return new Promise<CheckVerifyBean>((success, fail) => { | ||
| 98 | + HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeUrl(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => { | ||
| 99 | + Logger.debug("LoginViewModel:success2 ", data.message) | ||
| 100 | + if (!data || !data.data) { | ||
| 101 | + fail("数据为空") | ||
| 102 | + return | ||
| 103 | + } | ||
| 104 | + if (data.code != 0) { | ||
| 105 | + fail(data.message) | ||
| 106 | + return | ||
| 107 | + } | ||
| 108 | + success(data.data) | ||
| 109 | + }, (error: Error) => { | ||
| 110 | + Logger.debug("LoginViewModel:error2 ", error.toString()) | ||
| 111 | + fail(error.message) | ||
| 112 | + }) | ||
| 113 | + }) | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | + |
| 1 | +import { Logger } from 'wdKit/src/main/ets/utils/Logger' | ||
| 2 | +import { CustomProtocolDialog } from './CustomProtocolDialog' | ||
| 3 | +import router from '@ohos.router' | ||
| 4 | +import { LoginViewModel } from './LoginViewModel' | ||
| 5 | +import { LoginInputComponent } from './LoginInputComponent' | ||
| 6 | +import promptAction from '@ohos.promptAction' | ||
| 7 | +import { SPHelper } from 'wdKit' | ||
| 8 | +import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; | ||
| 9 | +import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; | ||
| 10 | + | ||
| 11 | +@Extend(Row) | ||
| 12 | +function otherStyle() { | ||
| 13 | + .backgroundImageSize(ImageSize.Cover) | ||
| 14 | + .layoutWeight(1) | ||
| 15 | + .height("100%") | ||
| 16 | + .justifyContent(FlexAlign.Center) | ||
| 17 | + .alignItems(VerticalAlign.Center) | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +function isEmpty(obj: undefined | string | null): boolean { | ||
| 21 | + return (obj == undefined || obj == null || obj == ''); | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +const TAG = "LoginPage" | ||
| 25 | + | ||
| 26 | +@Preview | ||
| 27 | +@Entry | ||
| 28 | +@Component | ||
| 29 | +struct LoginPage { | ||
| 30 | + @State codeBtnState: boolean = false | ||
| 31 | + @State timeCount: number = 60 | ||
| 32 | + phoneController: TextInputController = new TextInputController() | ||
| 33 | + codeSendText = "" | ||
| 34 | + @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码是否发送 | ||
| 35 | + @State phoneContent: string = "" //手机号 | ||
| 36 | + @State codeContent: string = "" //验证码 | ||
| 37 | + @State protocolState: boolean = false //协议勾选状态 | ||
| 38 | + accountContent = '' //账号 | ||
| 39 | + passwordContent = '' | ||
| 40 | + @State isSubmit: boolean = false | ||
| 41 | + @State checkCodePage: boolean = true //判断是否是验证码页面 默认验证码登录 | ||
| 42 | + @State passwordSwitch: boolean = true //密码显示 | ||
| 43 | + // @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录 | ||
| 44 | + | ||
| 45 | + dialogController: CustomDialogController = new CustomDialogController({ | ||
| 46 | + builder: CustomProtocolDialog({ | ||
| 47 | + cancel: () => { | ||
| 48 | + | ||
| 49 | + }, | ||
| 50 | + confirm: () => { | ||
| 51 | + this.requestLogin() | ||
| 52 | + } | ||
| 53 | + }), | ||
| 54 | + customStyle: true, | ||
| 55 | + alignment:DialogAlignment.Center | ||
| 56 | + }) | ||
| 57 | + loginViewModel = new LoginViewModel() | ||
| 58 | + | ||
| 59 | + onCodeSend() { | ||
| 60 | + Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") | ||
| 61 | + if (this.isCodeSend) { | ||
| 62 | + this.sendVerifyCode() | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + aboutToAppear() { | ||
| 67 | + Logger.debug(TAG, "aboutToAppear:" + this.isCodeSend + "") | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + onPageShow() { | ||
| 71 | + Logger.debug(TAG, "onPageShow:" + this.isCodeSend + "") | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + build() { | ||
| 75 | + RelativeContainer() { | ||
| 76 | + | ||
| 77 | + //注册内容 | ||
| 78 | + Column() { | ||
| 79 | + Image($r("app.media.login_logo")) | ||
| 80 | + .width(120) | ||
| 81 | + .height(66) | ||
| 82 | + .margin({ top: 78 }) | ||
| 83 | + .align(Alignment.Center) | ||
| 84 | + | ||
| 85 | + if (this.checkCodePage) { | ||
| 86 | + LoginInputComponent({ | ||
| 87 | + phoneContent: $phoneContent, | ||
| 88 | + codeContent: $codeContent, | ||
| 89 | + isSubmit: $isSubmit, | ||
| 90 | + isCodeSend: $isCodeSend | ||
| 91 | + }) | ||
| 92 | + } else { | ||
| 93 | + this.addPassword() | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + Row() { | ||
| 98 | + // Checkbox().selectedColor("#ED2800").onChange((value) => { | ||
| 99 | + // this.protocolState = value | ||
| 100 | + // }) | ||
| 101 | + Image(this.protocolState ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected')) | ||
| 102 | + .width(15) | ||
| 103 | + .height(15) | ||
| 104 | + .onClick(() => { | ||
| 105 | + this.protocolState = !this.protocolState | ||
| 106 | + }) | ||
| 107 | + | ||
| 108 | + Text() { | ||
| 109 | + Span("我已阅读并同意").fontColor("#999999").fontSize(12) | ||
| 110 | + Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { | ||
| 111 | + //todo 协议 | ||
| 112 | + }) | ||
| 113 | + Span("及").fontColor("#999999").fontSize(12) | ||
| 114 | + Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { | ||
| 115 | + //todo 协议 | ||
| 116 | + }) | ||
| 117 | + } | ||
| 118 | + }.margin({ top: 28 }).alignItems(VerticalAlign.Center) | ||
| 119 | + | ||
| 120 | + Row() { | ||
| 121 | + Button("登录", { type: ButtonType.Normal }) | ||
| 122 | + .borderRadius(4) | ||
| 123 | + .fontSize(20) | ||
| 124 | + .fontWeight(FontWeight.Medium) | ||
| 125 | + .margin({ top: 20 }) | ||
| 126 | + .height(44) | ||
| 127 | + .opacity(this.isSubmit ? 1 : 0.6) | ||
| 128 | + .enabled(this.isSubmit ? true : false) | ||
| 129 | + .width("100%") | ||
| 130 | + .backgroundColor("#ED2800") | ||
| 131 | + .onClick(() => { | ||
| 132 | + //todo 登录 | ||
| 133 | + this.loginSubmit() | ||
| 134 | + | ||
| 135 | + }) | ||
| 136 | + }.padding({ left: 25, right: 25 }).width('100%') | ||
| 137 | + | ||
| 138 | + | ||
| 139 | + if (!this.checkCodePage) { | ||
| 140 | + Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 }) | ||
| 141 | + .onClick(() => { | ||
| 142 | + // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' }) | ||
| 143 | + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) | ||
| 144 | + }) | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + }.width("100%") | ||
| 148 | + .alignRules({ | ||
| 149 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 150 | + }).id("register") | ||
| 151 | + | ||
| 152 | + //其他登录方式 | ||
| 153 | + Column() { | ||
| 154 | + this.addOtherLogin() | ||
| 155 | + }.width('100%') | ||
| 156 | + .alignRules({ | ||
| 157 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 158 | + }).id("other") | ||
| 159 | + | ||
| 160 | + //关闭按钮 | ||
| 161 | + Image($r('app.media.login_closed')) | ||
| 162 | + .width(24) | ||
| 163 | + .height(24) | ||
| 164 | + .margin({ top: 10, right: 15 }) | ||
| 165 | + .alignRules({ | ||
| 166 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 167 | + right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 168 | + }) | ||
| 169 | + .onClick(() => { | ||
| 170 | + router.back() | ||
| 171 | + }) | ||
| 172 | + .id('id_close') | ||
| 173 | + | ||
| 174 | + }.width('100%').height('100%') | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + @Builder | ||
| 178 | + addPassword() { | ||
| 179 | + Column() { | ||
| 180 | + TextInput({ placeholder: "请输入账号", controller: this.phoneController }) | ||
| 181 | + .fontSize(16) | ||
| 182 | + .height(48) | ||
| 183 | + .backgroundColor("#F5F5F5") | ||
| 184 | + .borderRadius(4) | ||
| 185 | + .type(InputType.PhoneNumber) | ||
| 186 | + .onChange((content) => { | ||
| 187 | + this.accountContent = content | ||
| 188 | + this.isSubmit = (this.accountContent.length >= 11 && this.passwordContent.length >= 6) | ||
| 189 | + }) | ||
| 190 | + | ||
| 191 | + RelativeContainer() { | ||
| 192 | + if (this.passwordSwitch) { | ||
| 193 | + this.addPasswordInputLayout() | ||
| 194 | + } else { | ||
| 195 | + this.addPasswordInputLayout() | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + Image(this.passwordSwitch ? $r('app.media.login_password_off') : $r('app.media.login_password_on')) | ||
| 199 | + .onClick(() => { | ||
| 200 | + this.passwordSwitch = !this.passwordSwitch | ||
| 201 | + }) | ||
| 202 | + .width(24) | ||
| 203 | + .height(24) | ||
| 204 | + .alignRules({ | ||
| 205 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 206 | + center: { anchor: '__container__', align: VerticalAlign.Center } | ||
| 207 | + }) | ||
| 208 | + .margin({ right: 12 }) | ||
| 209 | + .id("password_icon") | ||
| 210 | + | ||
| 211 | + }.margin({ top: 12 }) | ||
| 212 | + .height(61) | ||
| 213 | + .width('100%') | ||
| 214 | + }.padding({ left: 32, right: 32 }).width('100%').margin({ top: 46 }) | ||
| 215 | + | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + @Builder | ||
| 219 | + addPasswordInputLayout() { | ||
| 220 | + TextInput({ placeholder: "请输入密码", text: this.passwordContent }) | ||
| 221 | + .layoutWeight(1) | ||
| 222 | + .fontSize(16) | ||
| 223 | + .height(48) | ||
| 224 | + .fontColor("#222222") | ||
| 225 | + .backgroundColor("#F5F5F5") | ||
| 226 | + .type(this.passwordSwitch ? InputType.Password : InputType.Normal) | ||
| 227 | + .showPasswordIcon(false) | ||
| 228 | + .borderRadius({ topLeft: 4, bottomLeft: 4 }) | ||
| 229 | + .alignRules({ | ||
| 230 | + // top:{anchor:"__container__",align:VerticalAlign.Top} , | ||
| 231 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 232 | + | ||
| 233 | + }) | ||
| 234 | + .onChange((value) => { | ||
| 235 | + // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | ||
| 236 | + this.passwordContent = value | ||
| 237 | + this.isSubmit = (this.accountContent.length >= 11 && this.passwordContent.length >= 6) | ||
| 238 | + }) | ||
| 239 | + .id("password") | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + @Builder | ||
| 243 | + addOtherLogin() { | ||
| 244 | + Column() { | ||
| 245 | + Row() { | ||
| 246 | + Divider().layoutWeight(1).margin({ left: 25 }) | ||
| 247 | + Text('其他登录方式').margin({ left: 16, right: 16 }).fontSize(14).fontColor("#666666") | ||
| 248 | + Divider().layoutWeight(1).margin({ right: 25 }) | ||
| 249 | + }.width('100%') | ||
| 250 | + | ||
| 251 | + Row() { | ||
| 252 | + Row() { | ||
| 253 | + Image($r('app.media.login_wx')) | ||
| 254 | + .width(20).height(20) | ||
| 255 | + }.backgroundImage($r('app.media.login_other_left'), ImageRepeat.NoRepeat) | ||
| 256 | + .otherStyle() | ||
| 257 | + | ||
| 258 | + Row() { | ||
| 259 | + Image($r('app.media.login_qq')).size({ width: 20, height: 20 }) | ||
| 260 | + }.backgroundImage($r('app.media.login_other_middle'), ImageRepeat.NoRepeat) | ||
| 261 | + .otherStyle() | ||
| 262 | + | ||
| 263 | + Row() { | ||
| 264 | + Image($r('app.media.login_wb')).size({ width: 20, height: 20 }) | ||
| 265 | + }.backgroundImage($r('app.media.login_other_middle'), ImageRepeat.NoRepeat) | ||
| 266 | + .otherStyle() | ||
| 267 | + | ||
| 268 | + Row() { | ||
| 269 | + Image(this.checkCodePage ? $r('app.media.login_qt') : $r('app.media.login_other_password')) | ||
| 270 | + .size({ width: 20, height: 20 }) | ||
| 271 | + }.backgroundImage($r('app.media.login_other_right'), ImageRepeat.NoRepeat) | ||
| 272 | + .otherStyle().onClick(() => { | ||
| 273 | + this.checkCodePage = !this.checkCodePage; | ||
| 274 | + this.passwordContent = '' | ||
| 275 | + this.passwordSwitch = true | ||
| 276 | + this.isSubmit = false | ||
| 277 | + }) | ||
| 278 | + | ||
| 279 | + }.height(36) | ||
| 280 | + .width('100%') | ||
| 281 | + .padding({ left: 25, right: 25 }) | ||
| 282 | + // .justifyContent(FlexAlign.SpaceEvenly) | ||
| 283 | + .margin({ top: 24 }) | ||
| 284 | + }.width('100%').margin({ bottom: 40 }) | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + //发送验证码 | ||
| 288 | + sendVerifyCode() { | ||
| 289 | + this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { | ||
| 290 | + promptAction.showToast({ message: "验证码已发送成功" }) | ||
| 291 | + Logger.debug(TAG, "sendVerifyCode: " + verifyCode) | ||
| 292 | + }).catch((message:string)=>{ | ||
| 293 | + Logger.debug(TAG, "sendVerifyCode: " + message) | ||
| 294 | + }) | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + requestLogin() { | ||
| 298 | + Logger.debug('LoginViewModel', "requestLogin") | ||
| 299 | + if (this.checkCodePage) { | ||
| 300 | + this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => { | ||
| 301 | + Logger.debug(TAG, "requestLogin: " + data.jwtToken) | ||
| 302 | + let dd = SPHelper.default.get('userName', 'dd').then((value) => { | ||
| 303 | + Logger.debug(TAG, 'SP:' + value) | ||
| 304 | + }) | ||
| 305 | + router.back() | ||
| 306 | + }) | ||
| 307 | + } else { | ||
| 308 | + this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { | ||
| 309 | + Logger.debug(TAG, "requestLogin: " + data.jwtToken) | ||
| 310 | + let dd = SPHelper.default.get('userName', 'dd').then((value) => { | ||
| 311 | + Logger.debug(TAG, 'SP:' + value) | ||
| 312 | + }) | ||
| 313 | + promptAction.showToast({ message: '登录成功' }) | ||
| 314 | + router.back() | ||
| 315 | + }).catch((value: string) => { | ||
| 316 | + promptAction.showToast({ message: value }) | ||
| 317 | + }) | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + //登录 | ||
| 323 | + loginSubmit() { | ||
| 324 | + Logger.debug(TAG, "loginSubmit " + this.checkCodePage) | ||
| 325 | + //todo 判断是验证码登录还是密码登录 | ||
| 326 | + if (this.checkCodePage) { | ||
| 327 | + if (isEmpty(this.phoneContent)) { | ||
| 328 | + Logger.debug(TAG, "手机号为空") | ||
| 329 | + return | ||
| 330 | + } | ||
| 331 | + if (isEmpty(this.codeContent)) { | ||
| 332 | + Logger.debug(TAG, "验证码为空") | ||
| 333 | + return | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + } else { | ||
| 337 | + if (isEmpty(this.accountContent)) { | ||
| 338 | + Logger.debug(TAG, "账号为空") | ||
| 339 | + return | ||
| 340 | + } | ||
| 341 | + if (isEmpty(this.passwordContent)) { | ||
| 342 | + Logger.debug(TAG, "密码为空") | ||
| 343 | + return | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + if (this.protocolState) { | ||
| 347 | + this.requestLogin() | ||
| 348 | + } else { | ||
| 349 | + this.dialogController.open() | ||
| 350 | + } | ||
| 351 | + | ||
| 352 | + } | ||
| 353 | +} |
| 1 | +import { Logger } from 'wdKit/src/main/ets/utils/Logger' | ||
| 2 | +import { LoginModel } from './LoginModel' | ||
| 3 | +import { LoginBean } from './LoginBean' | ||
| 4 | +import { SPHelper } from 'wdKit' | ||
| 5 | +import { CheckVerifyBean } from './CheckVerifyBean' | ||
| 6 | +import cryptoFramework from '@ohos.security.cryptoFramework' | ||
| 7 | +import buffer from '@ohos.buffer' | ||
| 8 | + | ||
| 9 | +const TAG = "LoginViewModel" | ||
| 10 | + | ||
| 11 | +export class LoginViewModel { | ||
| 12 | + loginModel: LoginModel | ||
| 13 | + | ||
| 14 | + constructor() { | ||
| 15 | + this.loginModel = new LoginModel() | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + //发送验证码 | ||
| 19 | + sendVerifyCode(number: string) { | ||
| 20 | + return new Promise<string>((success, fail) => { | ||
| 21 | + this.loginModel.sendVerifyCode(number).then((data) => { | ||
| 22 | + success(data) | ||
| 23 | + }).catch((message: string) => { | ||
| 24 | + fail(message) | ||
| 25 | + }) | ||
| 26 | + }) | ||
| 27 | + | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + appLogin(phone: string, loginType: number, verificationCode: string) { | ||
| 31 | + | ||
| 32 | + return new Promise<LoginBean>((success, fail) => { | ||
| 33 | + this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { | ||
| 34 | + //todo 保存登录数据 | ||
| 35 | + SPHelper.default.save("firstMark", data.firstMark) | ||
| 36 | + SPHelper.default.save("id", data.id) | ||
| 37 | + SPHelper.default.save("jwtToken", data.jwtToken) | ||
| 38 | + SPHelper.default.save("longTimeNoLoginMark", data.longTimeNoLoginMark) | ||
| 39 | + SPHelper.default.save("refreshToken", data.refreshToken) | ||
| 40 | + SPHelper.default.save("status", data.status) | ||
| 41 | + SPHelper.default.save("userType", data.userType) | ||
| 42 | + SPHelper.default.save("userName", data.userName) | ||
| 43 | + | ||
| 44 | + success(data) | ||
| 45 | + }).catch(() => { | ||
| 46 | + fail() | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | ||
| 52 | + | ||
| 53 | + return new Promise<LoginBean>(async (success, fail) => { | ||
| 54 | + let passwordNew = await this.doMd(password) | ||
| 55 | + Logger.debug(TAG, "PASSWORD:" + passwordNew) | ||
| 56 | + this.loginModel.appLoginByPassword(phone, loginType, passwordNew, oldPassword).then((data: LoginBean) => { | ||
| 57 | + //todo 保存登录数据 | ||
| 58 | + SPHelper.default.save("userName", data.userName) | ||
| 59 | + | ||
| 60 | + success(data) | ||
| 61 | + }).catch((value: string) => { | ||
| 62 | + fail(value) | ||
| 63 | + }) | ||
| 64 | + }) | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + //{"code":"0","data":{"tempToken":"eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDQ2ODE5NCwidXNlcklkIjpudWxsLCJ1c2VyVmVyc2lvbiI6Im51bGxfbnVsbCIsInVzZXJOYW1lIjpudWxsLCJ1c2VyVHlwZSI6bnVsbCwiY3JlYXRvcklkIjpudWxsLCJ1c2VySWRaaCI6bnVsbH0.R5gv44Gyni3QTxtWvSxYn0eMuUD5_bI1hh9TaThq25g","jwtToken":"eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDY0NzU5NCwidXNlcklkIjo1NjkzNTAwNzk4ODk2NjksInVzZXJWZXJzaW9uIjoiNTY5MzUwMDc5ODg5NjY5XzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QjJrRDJ4VyIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.Ai19vg8-rhJNXt2nwFTfir7s01eLfTtOCKcptIpeyG0"},"message":"Success","success":true,"timestamp":1710467595186} | ||
| 68 | + checkVerifyCode(phone: string, verifyCode: string) { | ||
| 69 | + return new Promise<CheckVerifyBean>((success, reject) => { | ||
| 70 | + this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => { | ||
| 71 | + //todo 保存数据 | ||
| 72 | + SPHelper.default.save("tempToken", data.temToken) | ||
| 73 | + SPHelper.default.save("jwtToken", data.jwtToken) | ||
| 74 | + success(data) | ||
| 75 | + | ||
| 76 | + }, (value: string) => { | ||
| 77 | + reject(value) | ||
| 78 | + }) | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + async doMd(content: string): Promise<string> { | ||
| 84 | + let mdAlgName = 'SHA256'; // 摘要算法名 | ||
| 85 | + let message = content; // 待摘要的数据 | ||
| 86 | + let md = cryptoFramework.createMd(mdAlgName); | ||
| 87 | + // 数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 | ||
| 88 | + await md.update({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) }); | ||
| 89 | + let mdResult = await md.digest(); | ||
| 90 | + console.info('Md result:' + mdResult.data); | ||
| 91 | + return this.byte2Hex(mdResult.data) | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + byte2Hex(data: Uint8Array): string { | ||
| 95 | + let bufferStr = '' | ||
| 96 | + for (let i = 0; i < data.length; i++) { | ||
| 97 | + let temp = data[i].toString(16) | ||
| 98 | + if (temp.length == 1) { | ||
| 99 | + temp = "0"+temp | ||
| 100 | + } | ||
| 101 | + bufferStr += temp | ||
| 102 | + | ||
| 103 | + } | ||
| 104 | + console.info('Md result2:' + bufferStr); | ||
| 105 | + return bufferStr; | ||
| 106 | + | ||
| 107 | + } | ||
| 108 | +} |
6.63 KB
431 Bytes
861 Bytes
sight_harmony/features/wdLogin/src/main/resources/base/media/login_checkbox_unselected.png
0 → 100644
1015 Bytes
618 Bytes
2.18 KB
2.18 KB
17.9 KB
1.14 KB
1.33 KB
493 Bytes
1.12 KB
1.13 KB
1.39 KB
1.67 KB
794 Bytes
1.67 KB
1.31 KB
11.1 KB
| 1 | +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; | ||
| 2 | + | ||
| 3 | +export default function localUnitTest() { | ||
| 4 | + describe('localUnitTest',() => { | ||
| 5 | + // Defines a test suite. Two parameters are supported: test suite name and test suite function. | ||
| 6 | + beforeAll(() => { | ||
| 7 | + // Presets an action, which is performed only once before all test cases of the test suite start. | ||
| 8 | + // This API supports only one parameter: preset action function. | ||
| 9 | + }); | ||
| 10 | + beforeEach(() => { | ||
| 11 | + // Presets an action, which is performed before each unit test case starts. | ||
| 12 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
| 13 | + // This API supports only one parameter: preset action function. | ||
| 14 | + }); | ||
| 15 | + afterEach(() => { | ||
| 16 | + // Presets a clear action, which is performed after each unit test case ends. | ||
| 17 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
| 18 | + // This API supports only one parameter: clear action function. | ||
| 19 | + }); | ||
| 20 | + afterAll(() => { | ||
| 21 | + // Presets a clear action, which is performed after all test cases of the test suite end. | ||
| 22 | + // This API supports only one parameter: clear action function. | ||
| 23 | + }); | ||
| 24 | + it('assertContain', 0, () => { | ||
| 25 | + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. | ||
| 26 | + let a = 'abc'; | ||
| 27 | + let b = 'b'; | ||
| 28 | + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. | ||
| 29 | + expect(a).assertContain(b); | ||
| 30 | + expect(a).assertEqual(a); | ||
| 31 | + }); | ||
| 32 | + }); | ||
| 33 | +} |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit" | ||
| 9 | - }, | ||
| 10 | - "packages": { | ||
| 11 | - "wdKit@../../commons/wdKit": { | ||
| 12 | - "name": "wdkit", | ||
| 13 | - "resolved": "../../commons/wdKit", | ||
| 14 | - "registryType": "local" | ||
| 15 | - } | ||
| 16 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 17 | } | 6 | } |
| 1 | { | 1 | { |
| 2 | - "hvigorVersion": "file:../dependencies/hvigor-4.1.1.tgz", | 2 | + "hvigorVersion": "file:../dependencies/hvigor-3.0.10-s.tgz", |
| 3 | "dependencies": { | 3 | "dependencies": { |
| 4 | - "@ohos/hvigor-ohos-plugin": "file:../dependencies/hvigor-ohos-plugin-4.1.1.tgz" | 4 | + "@ohos/hvigor-ohos-plugin": "file:../dependencies/hvigor-ohos-plugin-3.0.10-s.tgz", |
| 5 | + "rollup": "file:../dependencies/rollup.tgz", | ||
| 5 | }, | 6 | }, |
| 6 | "execution": { | 7 | "execution": { |
| 7 | - // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */ | ||
| 8 | - // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ | ||
| 9 | - // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ | ||
| 10 | - // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ | ||
| 11 | - // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ | 8 | + // "daemon": true, /* Enable daemon compilation. Default: true */ |
| 9 | + // "incremental": true, /* Enable incremental compilation. Default: true */ | ||
| 10 | + // "parallel": true, /* Enable parallel compilation. Default: true */ | ||
| 11 | + // "typeCheck": false, /* Enable typeCheck. Default: false */ | ||
| 12 | }, | 12 | }, |
| 13 | "logging": { | 13 | "logging": { |
| 14 | // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ | 14 | // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ |
| 15 | }, | 15 | }, |
| 16 | "debugging": { | 16 | "debugging": { |
| 17 | - // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ | ||
| 18 | - }, | ||
| 19 | - "nodeOptions": { | ||
| 20 | - // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */ | 17 | + // "stacktrace": false /* Disable stacktrace compilation. Default: false */ |
| 21 | } | 18 | } |
| 22 | } | 19 | } |
This diff could not be displayed because it is too large.
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 4 | "specifiers": { |
| 8 | "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16" | 5 | "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16" |
| 9 | }, | 6 | }, |
| 10 | "packages": { | 7 | "packages": { |
| 11 | "@ohos/hypium@1.0.16": { | 8 | "@ohos/hypium@1.0.16": { |
| 12 | - "name": "@ohos/hypium", | ||
| 13 | - "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", | ||
| 14 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.16.har", | 9 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.16.har", |
| 15 | - "registryType": "ohpm" | 10 | + "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==" |
| 16 | } | 11 | } |
| 17 | } | 12 | } |
| 18 | } | 13 | } |
| 1 | { | 1 | { |
| 2 | - "meta": { | ||
| 3 | - "stableOrder": true | ||
| 4 | - }, | ||
| 5 | - "lockfileVersion": 3, | 2 | + "lockfileVersion": 1, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | - "specifiers": { | ||
| 8 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.1.1", | ||
| 9 | - "wdBean@../../../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 10 | - "wdBean@../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 11 | - "wdComponent@../../../../features/wdComponent": "wdComponent@../../features/wdComponent", | ||
| 12 | - "wdComponent@../../features/wdComponent": "wdComponent@../../features/wdComponent", | ||
| 13 | - "wdConstant@../../../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 14 | - "wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | ||
| 15 | - "wdJsBridge@../../../wdJsBridge": "wdJsBridge@../../commons/wdJsBridge", | ||
| 16 | - "wdKit@../../../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 17 | - "wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit", | ||
| 18 | - "wdNetwork@../../../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 19 | - "wdNetwork@../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork", | ||
| 20 | - "wdRouter@../../../../commons/wdRouter": "wdRouter@../../commons/wdRouter", | ||
| 21 | - "wdRouter@../../commons/wdRouter": "wdRouter@../../commons/wdRouter", | ||
| 22 | - "wdWebComponent@../../../../commons/wdWebComponent": "wdWebComponent@../../commons/wdWebComponent", | ||
| 23 | - "wdWebComponent@../../commons/wdWebComponent": "wdWebComponent@../../commons/wdWebComponent" | ||
| 24 | - }, | ||
| 25 | - "packages": { | ||
| 26 | - "@ohos/axios@2.1.1": { | ||
| 27 | - "name": "@ohos/axios", | ||
| 28 | - "integrity": "sha512-EQax257+eKKT0Rx7h6N6xvmKbDRWDjCCWOP2vyyktySFwvjtypXuXmQKEvRjmAalR6cqf8mbfhWmpg0bD9OQ3w==", | ||
| 29 | - "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.1.1.har", | ||
| 30 | - "registryType": "ohpm" | ||
| 31 | - }, | ||
| 32 | - "wdBean@../../features/wdBean": { | ||
| 33 | - "name": "wdbean", | ||
| 34 | - "resolved": "../../features/wdBean", | ||
| 35 | - "registryType": "local" | ||
| 36 | - }, | ||
| 37 | - "wdComponent@../../features/wdComponent": { | ||
| 38 | - "name": "wdcomponent", | ||
| 39 | - "resolved": "../../features/wdComponent", | ||
| 40 | - "registryType": "local", | ||
| 41 | - "dependencies": { | ||
| 42 | - "wdConstant": "file:../../commons/wdConstant", | ||
| 43 | - "wdKit": "file:../../commons/wdKit", | ||
| 44 | - "wdWebComponent": "file:../../commons/wdWebComponent", | ||
| 45 | - "wdBean": "file:../../features/wdBean", | ||
| 46 | - "wdRouter": "file:../../commons/wdRouter", | ||
| 47 | - "wdNetwork": "file:../../commons/wdNetwork" | ||
| 48 | - } | ||
| 49 | - }, | ||
| 50 | - "wdConstant@../../commons/wdConstant": { | ||
| 51 | - "name": "wdconstant", | ||
| 52 | - "resolved": "../../commons/wdConstant", | ||
| 53 | - "registryType": "local" | ||
| 54 | - }, | ||
| 55 | - "wdJsBridge@../../commons/wdJsBridge": { | ||
| 56 | - "name": "wdjsbridge", | ||
| 57 | - "resolved": "../../commons/wdJsBridge", | ||
| 58 | - "registryType": "local" | ||
| 59 | - }, | ||
| 60 | - "wdKit@../../commons/wdKit": { | ||
| 61 | - "name": "wdkit", | ||
| 62 | - "resolved": "../../commons/wdKit", | ||
| 63 | - "registryType": "local" | ||
| 64 | - }, | ||
| 65 | - "wdNetwork@../../commons/wdNetwork": { | ||
| 66 | - "name": "wdnetwork", | ||
| 67 | - "resolved": "../../commons/wdNetwork", | ||
| 68 | - "registryType": "local", | ||
| 69 | - "dependencies": { | ||
| 70 | - "wdConstant": "file:../wdConstant", | ||
| 71 | - "wdKit": "file:../wdKit", | ||
| 72 | - "@ohos/axios": "^2.1.1" | ||
| 73 | - } | ||
| 74 | - }, | ||
| 75 | - "wdRouter@../../commons/wdRouter": { | ||
| 76 | - "name": "wdrouter", | ||
| 77 | - "resolved": "../../commons/wdRouter", | ||
| 78 | - "registryType": "local", | ||
| 79 | - "dependencies": { | ||
| 80 | - "wdKit": "file:../wdKit", | ||
| 81 | - "wdBean": "file:../../features/wdBean" | ||
| 82 | - } | ||
| 83 | - }, | ||
| 84 | - "wdWebComponent@../../commons/wdWebComponent": { | ||
| 85 | - "name": "wdwebcomponent", | ||
| 86 | - "resolved": "../../commons/wdWebComponent", | ||
| 87 | - "registryType": "local", | ||
| 88 | - "dependencies": { | ||
| 89 | - "wdConstant": "file:../wdConstant", | ||
| 90 | - "wdKit": "file:../wdKit", | ||
| 91 | - "wdJsBridge": "file:../wdJsBridge", | ||
| 92 | - "wdBean": "file:../../features/wdBean", | ||
| 93 | - "wdRouter": "file:../wdRouter" | ||
| 94 | - } | ||
| 95 | - } | ||
| 96 | - } | 4 | + "specifiers": {}, |
| 5 | + "packages": {} | ||
| 97 | } | 6 | } |
-
Please register or login to post a comment