Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
7 changed files
with
103 additions
and
15 deletions
| @@ -40,4 +40,6 @@ export class WDRouterPage { | @@ -40,4 +40,6 @@ export class WDRouterPage { | ||
| 40 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | 40 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); |
| 41 | //我的 关注 | 41 | //我的 关注 |
| 42 | static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); | 42 | static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); |
| 43 | + | ||
| 44 | + static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | ||
| 43 | } | 45 | } |
| 1 | +import { Logger, StringUtils } from 'wdKit' | ||
| 1 | import { WDRouterPage, WDRouterRule } from 'wdRouter' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' |
| 2 | 3 | ||
| 3 | @Component | 4 | @Component |
| 4 | export default struct MinePageUserSimpleInfoUI { | 5 | export default struct MinePageUserSimpleInfoUI { |
| 5 | @Prop isLogin:boolean | 6 | @Prop isLogin:boolean |
| 6 | @Prop userName:string | 7 | @Prop userName:string |
| 7 | - | 8 | + @Consume('isLogin')@Watch('loginChange') isLogin2:Record<string,string> |
| 9 | + loginChange(){ | ||
| 10 | + Logger.debug("isLogin",'MinePageUserSimpleInfoUI') | ||
| 11 | + if(this.isLogin2){ | ||
| 12 | + this.isLogin=true | ||
| 13 | + this.userName=this.isLogin2['userName'] | ||
| 14 | + } | ||
| 15 | + } | ||
| 8 | 16 | ||
| 9 | build(){ | 17 | build(){ |
| 10 | Row(){ | 18 | Row(){ |
| 1 | +import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage' | ||
| 2 | +import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule' | ||
| 3 | +import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index' | ||
| 4 | + | ||
| 1 | @CustomDialog | 5 | @CustomDialog |
| 2 | export struct CustomProtocolDialog { | 6 | export struct CustomProtocolDialog { |
| 3 | controller: CustomDialogController | 7 | controller: CustomDialogController |
| @@ -19,9 +23,15 @@ export struct CustomProtocolDialog { | @@ -19,9 +23,15 @@ export struct CustomProtocolDialog { | ||
| 19 | .margin({ top: 20 }) | 23 | .margin({ top: 20 }) |
| 20 | Text() { | 24 | Text() { |
| 21 | Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | 25 | Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") |
| 22 | - Span("《用户协议》").fontSize(14).fontColor("#ED2800") | 26 | + Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(()=>{ |
| 27 | + let bean={contentId:"1",pageID:""} as Params | ||
| 28 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 29 | + }) | ||
| 23 | Span("及").fontSize(14).fontColor("#666666") | 30 | Span("及").fontSize(14).fontColor("#666666") |
| 24 | - Span("《隐私政策》").fontSize(14).fontColor("#ED2800") | 31 | + Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(()=>{ |
| 32 | + let bean={contentId:"2",pageID:""} as Params | ||
| 33 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 34 | + }) | ||
| 25 | Span("后进行登录").fontSize(14).fontColor("#666666") | 35 | Span("后进行登录").fontSize(14).fontColor("#666666") |
| 26 | }.margin({ top: 12, left: 16, right: 16 }) | 36 | }.margin({ top: 12, left: 16, right: 16 }) |
| 27 | 37 |
| @@ -7,6 +7,7 @@ import promptAction from '@ohos.promptAction' | @@ -7,6 +7,7 @@ import promptAction from '@ohos.promptAction' | ||
| 7 | import { SPHelper } from 'wdKit' | 7 | import { SPHelper } from 'wdKit' |
| 8 | import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; | 8 | import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; |
| 9 | import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; | 9 | import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; |
| 10 | +import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params' | ||
| 10 | 11 | ||
| 11 | @Extend(Row) | 12 | @Extend(Row) |
| 12 | function otherStyle() { | 13 | function otherStyle() { |
| @@ -95,9 +96,6 @@ struct LoginPage { | @@ -95,9 +96,6 @@ struct LoginPage { | ||
| 95 | 96 | ||
| 96 | 97 | ||
| 97 | Row() { | 98 | 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')) | 99 | Image(this.protocolState ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected')) |
| 102 | .width(15) | 100 | .width(15) |
| 103 | .height(15) | 101 | .height(15) |
| @@ -109,10 +107,14 @@ struct LoginPage { | @@ -109,10 +107,14 @@ struct LoginPage { | ||
| 109 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) | 107 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) |
| 110 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { | 108 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 111 | //todo 协议 | 109 | //todo 协议 |
| 110 | + let bean={contentId:"1",pageID:""} as Params | ||
| 111 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 112 | }) | 112 | }) |
| 113 | Span("及").fontColor("#999999").fontSize(12) | 113 | Span("及").fontColor("#999999").fontSize(12) |
| 114 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { | 114 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 115 | //todo 协议 | 115 | //todo 协议 |
| 116 | + let bean={contentId:"2",pageID:""} as Params | ||
| 117 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 116 | }) | 118 | }) |
| 117 | } | 119 | } |
| 118 | }.margin({ top: 28 }).alignItems(VerticalAlign.Center) | 120 | }.margin({ top: 28 }).alignItems(VerticalAlign.Center) |
| @@ -299,19 +301,22 @@ struct LoginPage { | @@ -299,19 +301,22 @@ struct LoginPage { | ||
| 299 | if (this.checkCodePage) { | 301 | if (this.checkCodePage) { |
| 300 | this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => { | 302 | this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => { |
| 301 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) | 303 | 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() | 304 | + router.back({ |
| 305 | + params: { userName: data.userName, | ||
| 306 | + userId:data.id}, | ||
| 307 | + url: 'pages/MainPage' | ||
| 308 | + } | ||
| 309 | + ) | ||
| 306 | }) | 310 | }) |
| 307 | } else { | 311 | } else { |
| 308 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { | 312 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { |
| 309 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) | 313 | 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 | promptAction.showToast({ message: '登录成功' }) |
| 314 | - router.back() | 315 | + router.back({ |
| 316 | + params: { userName: data.userName, | ||
| 317 | + userId:data.id}, | ||
| 318 | + url: 'pages/MainPage' | ||
| 319 | + }) | ||
| 315 | }).catch((value: string) => { | 320 | }).catch((value: string) => { |
| 316 | promptAction.showToast({ message: value }) | 321 | promptAction.showToast({ message: value }) |
| 317 | }) | 322 | }) |
| 1 | +import router from '@ohos.router'; | ||
| 2 | +import webview from '@ohos.web.webview'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +const TAG = 'LoginProtocolWebview'; | ||
| 8 | + | ||
| 9 | +@Entry | ||
| 10 | +@Component | ||
| 11 | +struct LoginProtocolWebview { | ||
| 12 | + webUrl: string = '' | ||
| 13 | + webviewController: webview.WebviewController = new webview.WebviewController() | ||
| 14 | + | ||
| 15 | + aboutToAppear() { | ||
| 16 | + if (router.getParams()) { | ||
| 17 | + let params = router.getParams() as Params | ||
| 18 | + if (params.contentID == "1") { | ||
| 19 | + this.webUrl = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" | ||
| 20 | + } else { | ||
| 21 | + this.webUrl = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html" | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + build() { | ||
| 28 | + | ||
| 29 | + Column() { | ||
| 30 | + Row() { | ||
| 31 | + Image($r("app.media.login_back_icon")) | ||
| 32 | + .width(24) | ||
| 33 | + .aspectRatio(1) | ||
| 34 | + .onClick(() => { | ||
| 35 | + router.back(); | ||
| 36 | + }).margin({left:16}) | ||
| 37 | + Text() | ||
| 38 | + } | ||
| 39 | + .alignItems(VerticalAlign.Center) | ||
| 40 | + .width('100%') | ||
| 41 | + .height(44) | ||
| 42 | + | ||
| 43 | + Web({ src: this.webUrl, controller: this.webviewController }) | ||
| 44 | + .domStorageAccess(true) | ||
| 45 | + .databaseAccess(true) | ||
| 46 | + .javaScriptAccess(true) | ||
| 47 | + .zoomAccess(false) | ||
| 48 | + .horizontalScrollBarAccess(false) | ||
| 49 | + .verticalScrollBarAccess(false) | ||
| 50 | + .onHttpErrorReceive((event) => { | ||
| 51 | + //TODO 页面加载不成功的时候处理 | ||
| 52 | + Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl()); | ||
| 53 | + Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode()); | ||
| 54 | + }) | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | +} |
| @@ -2,12 +2,15 @@ import { BottomNavigationComponent} from 'wdComponent'; | @@ -2,12 +2,15 @@ import { BottomNavigationComponent} from 'wdComponent'; | ||
| 2 | import { BreakpointConstants } from 'wdConstant'; | 2 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | import { BreakpointSystem, Logger } from 'wdKit'; | 4 | import { BreakpointSystem, Logger } from 'wdKit'; |
| 5 | +import router from '@ohos.router'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'MainPage'; | 7 | const TAG = 'MainPage'; |
| 7 | 8 | ||
| 8 | @Entry | 9 | @Entry |
| 9 | @Component | 10 | @Component |
| 10 | struct MainPage { | 11 | struct MainPage { |
| 12 | + @Provide('isLogin') isLogin:Record<string,string>={} | ||
| 13 | + | ||
| 11 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() | 14 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() |
| 12 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 15 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; |
| 13 | 16 | ||
| @@ -27,6 +30,8 @@ struct MainPage { | @@ -27,6 +30,8 @@ struct MainPage { | ||
| 27 | 30 | ||
| 28 | onPageShow() { | 31 | onPageShow() { |
| 29 | Logger.info(TAG, 'onPageShow'); | 32 | Logger.info(TAG, 'onPageShow'); |
| 33 | + let params=router.getParams() as Record<string,string> | ||
| 34 | + this.isLogin=params | ||
| 30 | } | 35 | } |
| 31 | 36 | ||
| 32 | onPageHide() { | 37 | onPageHide() { |
-
Please register or login to post a comment