Showing
8 changed files
with
77 additions
and
10 deletions
| @@ -9,5 +9,8 @@ export class SpConstants{ | @@ -9,5 +9,8 @@ export class SpConstants{ | ||
| 9 | static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark" | 9 | static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark" |
| 10 | static USER_STATUS="user_status" | 10 | static USER_STATUS="user_status" |
| 11 | static USER_TEMP_TOKEN="tempToken" | 11 | static USER_TEMP_TOKEN="tempToken" |
| 12 | + //协议相关 | ||
| 13 | + static USER_PROTOCOL = "user_protocol" //用户协议 | ||
| 14 | + static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 | ||
| 12 | 15 | ||
| 13 | } | 16 | } |
| @@ -423,6 +423,10 @@ export class HttpUrlUtils { | @@ -423,6 +423,10 @@ export class HttpUrlUtils { | ||
| 423 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; | 423 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; |
| 424 | return url; | 424 | return url; |
| 425 | } | 425 | } |
| 426 | + static getAgreement() { | ||
| 427 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement"; | ||
| 428 | + return url; | ||
| 429 | + } | ||
| 426 | 430 | ||
| 427 | static getCheckVerifyByTokenCodeUrl() { | 431 | static getCheckVerifyByTokenCodeUrl() { |
| 428 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; | 432 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; |
| @@ -105,12 +105,12 @@ struct LoginPage { | @@ -105,12 +105,12 @@ struct LoginPage { | ||
| 105 | Text() { | 105 | Text() { |
| 106 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) | 106 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) |
| 107 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { | 107 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 108 | - let bean={contentId:"1",pageID:""} as Params | 108 | + let bean={contentID:"1",pageID:""} as Params |
| 109 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 109 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 110 | }) | 110 | }) |
| 111 | Span("及").fontColor("#999999").fontSize(12) | 111 | Span("及").fontColor("#999999").fontSize(12) |
| 112 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { | 112 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 113 | - let bean={contentId:"2",pageID:""} as Params | 113 | + let bean={contentID:"2",pageID:""} as Params |
| 114 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 114 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 115 | }) | 115 | }) |
| 116 | } | 116 | } |
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | import webview from '@ohos.web.webview'; | 2 | import webview from '@ohos.web.webview'; |
| 3 | -import { Logger } from 'wdKit'; | 3 | +import { SpConstants } from 'wdConstant/Index'; |
| 4 | +import { Logger, SPHelper } from 'wdKit'; | ||
| 4 | import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'; | 5 | import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'; |
| 5 | 6 | ||
| 6 | 7 | ||
| @@ -11,14 +12,20 @@ const TAG = 'LoginProtocolWebview'; | @@ -11,14 +12,20 @@ const TAG = 'LoginProtocolWebview'; | ||
| 11 | struct LoginProtocolWebview { | 12 | struct LoginProtocolWebview { |
| 12 | webUrl: string = '' | 13 | webUrl: string = '' |
| 13 | webviewController: webview.WebviewController = new webview.WebviewController() | 14 | webviewController: webview.WebviewController = new webview.WebviewController() |
| 15 | + userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" | ||
| 16 | + privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html' | ||
| 14 | 17 | ||
| 15 | - aboutToAppear() { | 18 | + async aboutToAppear() { |
| 16 | if (router.getParams()) { | 19 | if (router.getParams()) { |
| 17 | let params = router.getParams() as Params | 20 | let params = router.getParams() as Params |
| 21 | + Logger.info(TAG, 'params.contentID:' + params.contentID); | ||
| 18 | if (params.contentID == "1") { | 22 | if (params.contentID == "1") { |
| 19 | - this.webUrl = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" | 23 | + this.webUrl = await SPHelper.default.get(SpConstants.USER_PROTOCOL, this.userProtocol) as string |
| 24 | + this.webviewController.loadUrl(this.webUrl) | ||
| 25 | + | ||
| 20 | } else { | 26 | } else { |
| 21 | - this.webUrl = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html" | 27 | + this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string |
| 28 | + this.webviewController.loadUrl(this.webUrl) | ||
| 22 | } | 29 | } |
| 23 | } | 30 | } |
| 24 | 31 | ||
| @@ -33,7 +40,7 @@ struct LoginProtocolWebview { | @@ -33,7 +40,7 @@ struct LoginProtocolWebview { | ||
| 33 | .aspectRatio(1) | 40 | .aspectRatio(1) |
| 34 | .onClick(() => { | 41 | .onClick(() => { |
| 35 | router.back(); | 42 | router.back(); |
| 36 | - }).margin({left:16}) | 43 | + }).margin({ left: 16 }) |
| 37 | Text() | 44 | Text() |
| 38 | } | 45 | } |
| 39 | .alignItems(VerticalAlign.Center) | 46 | .alignItems(VerticalAlign.Center) |
| @@ -8,6 +8,7 @@ import preferences from '@ohos.data.preferences' | @@ -8,6 +8,7 @@ import preferences from '@ohos.data.preferences' | ||
| 8 | import { GlobalContext } from '../../utils/GlobalContext' | 8 | import { GlobalContext } from '../../utils/GlobalContext' |
| 9 | import { WDRouterRule } from 'wdRouter'; | 9 | import { WDRouterRule } from 'wdRouter'; |
| 10 | import { WDRouterPage } from 'wdRouter'; | 10 | import { WDRouterPage } from 'wdRouter'; |
| 11 | +import { LaunchModel } from '../viewModel/LaunchModel' | ||
| 11 | 12 | ||
| 12 | @Entry | 13 | @Entry |
| 13 | @Component | 14 | @Component |
| @@ -85,6 +86,7 @@ struct LaunchPage { | @@ -85,6 +86,7 @@ struct LaunchPage { | ||
| 85 | // let isJumpPrivacy: boolean = globalThis.isJumpPrivacy ?? false; | 86 | // let isJumpPrivacy: boolean = globalThis.isJumpPrivacy ?? false; |
| 86 | // let isJumpPrivacy: boolean = (GlobalContext.getContext().getObject('isJumpPrivacy') as boolean) ?? false; | 87 | // let isJumpPrivacy: boolean = (GlobalContext.getContext().getObject('isJumpPrivacy') as boolean) ?? false; |
| 87 | //if (!isJumpPrivacy) { | 88 | //if (!isJumpPrivacy) { |
| 89 | + this.requestAgreement() | ||
| 88 | this.dialogController.open(); | 90 | this.dialogController.open(); |
| 89 | // } | 91 | // } |
| 90 | } else { | 92 | } else { |
| @@ -146,6 +148,10 @@ struct LaunchPage { | @@ -146,6 +148,10 @@ struct LaunchPage { | ||
| 146 | 148 | ||
| 147 | } | 149 | } |
| 148 | 150 | ||
| 149 | - | 151 | + requestAgreement() { |
| 152 | + //请求隐私协议接口 | ||
| 153 | + let launchModel = new LaunchModel() | ||
| 154 | + launchModel.getAgreement() | ||
| 155 | + } | ||
| 150 | 156 | ||
| 151 | } | 157 | } |
| @@ -83,7 +83,7 @@ export default struct CustomDialogComponent { | @@ -83,7 +83,7 @@ export default struct CustomDialogComponent { | ||
| 83 | .fontColor(Color.Red) | 83 | .fontColor(Color.Red) |
| 84 | .onClick(() => { | 84 | .onClick(() => { |
| 85 | 85 | ||
| 86 | - let bean={contentId:"1",pageID:""} as Params | 86 | + let bean={contentID:"2",pageID:""} as Params |
| 87 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 87 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 88 | 88 | ||
| 89 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); | 89 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); |
| @@ -100,7 +100,7 @@ export default struct CustomDialogComponent { | @@ -100,7 +100,7 @@ export default struct CustomDialogComponent { | ||
| 100 | .fontColor(Color.Red) | 100 | .fontColor(Color.Red) |
| 101 | .onClick(() => { | 101 | .onClick(() => { |
| 102 | 102 | ||
| 103 | - let bean={contentId:"2",pageID:""} as Params | 103 | + let bean={contentID:"1",pageID:""} as Params |
| 104 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 104 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 105 | 105 | ||
| 106 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); | 106 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); |
| 1 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 2 | +import { HashMap } from '@kit.ArkTS'; | ||
| 3 | +import { AgreementBean } from '../launchPage/AgreementBean'; | ||
| 4 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 5 | +import { Logger, SPHelper } from 'wdKit/Index'; | ||
| 6 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +export class LaunchModel { | ||
| 9 | + getAgreement() { | ||
| 10 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 11 | + return new Promise<AgreementBean>((success, fail) => { | ||
| 12 | + HttpRequest.get<ResponseDTO<Array<AgreementBean>>>(HttpUrlUtils.getAgreement(), headers).then((data: ResponseDTO<Array<AgreementBean>>) => { | ||
| 13 | + if (!data || !data.data) { | ||
| 14 | + fail("数据为空") | ||
| 15 | + return | ||
| 16 | + } | ||
| 17 | + if (data.code != 0) { | ||
| 18 | + fail(data.message) | ||
| 19 | + return | ||
| 20 | + } | ||
| 21 | + Logger.debug("LaunchModel:success2 ", JSON.stringify(data)) | ||
| 22 | + //保存数据 | ||
| 23 | + for (let i = 0; i < data.data.length; i++) { | ||
| 24 | + if (data.data[i].type == 1) { | ||
| 25 | + SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl) | ||
| 26 | + } else if (data.data[i].type == 2) { | ||
| 27 | + SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl) | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + }, (error: Error) => { | ||
| 32 | + Logger.debug("LaunchModel:error2 ", error.toString()) | ||
| 33 | + fail(error.message) | ||
| 34 | + }) | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | +} |
-
Please register or login to post a comment