Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
6 changed files
with
38 additions
and
14 deletions
| 1 | import { Action } from './Action'; | 1 | import { Action } from './Action'; |
| 2 | + | ||
| 2 | interface dataObject { | 3 | interface dataObject { |
| 3 | // dataSource: | 4 | // dataSource: |
| 4 | // 1、图文详情数据 | 5 | // 1、图文详情数据 |
| @@ -17,7 +18,11 @@ interface dataObject { | @@ -17,7 +18,11 @@ interface dataObject { | ||
| 17 | webViewHeight?: string | 18 | webViewHeight?: string |
| 18 | dataJson?: string | 19 | dataJson?: string |
| 19 | appInnerLink?: string | 20 | appInnerLink?: string |
| 21 | + method?: string | ||
| 22 | + url?: string | ||
| 23 | + parameters?: object | ||
| 20 | } | 24 | } |
| 25 | + | ||
| 21 | /** | 26 | /** |
| 22 | * 消息Message | 27 | * 消息Message |
| 23 | */ | 28 | */ |
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | "wdKit": "file:../wdKit", | 11 | "wdKit": "file:../wdKit", |
| 12 | "wdJsBridge": "file:../wdJsBridge", | 12 | "wdJsBridge": "file:../wdJsBridge", |
| 13 | "wdBean": "file:../../features/wdBean", | 13 | "wdBean": "file:../../features/wdBean", |
| 14 | - "wdRouter": "file:../wdRouter" | 14 | + "wdRouter": "file:../wdRouter", |
| 15 | + "wdNetwork": "file:../wdNetwork" | ||
| 15 | } | 16 | } |
| 16 | } | 17 | } |
| @@ -10,6 +10,7 @@ export class H5CallNativeType { | @@ -10,6 +10,7 @@ export class H5CallNativeType { | ||
| 10 | static jsCall_callAppService = 'jsCall_callAppService' | 10 | static jsCall_callAppService = 'jsCall_callAppService' |
| 11 | static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' | 11 | static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' |
| 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' | 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' |
| 13 | + static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo' | ||
| 13 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 14 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 14 | 15 | ||
| 15 | static { | 16 | static { |
| @@ -19,6 +20,8 @@ export class H5CallNativeType { | @@ -19,6 +20,8 @@ export class H5CallNativeType { | ||
| 19 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) | 20 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) |
| 20 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) | 21 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) |
| 21 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) | 22 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) |
| 23 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo) | ||
| 24 | + | ||
| 22 | } | 25 | } |
| 23 | } | 26 | } |
| 24 | 27 |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 1 | import { Callback } from 'wdJsBridge'; | 2 | import { Callback } from 'wdJsBridge'; |
| 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 3 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 3 | import { Logger } from 'wdKit'; | 4 | import { Logger } from 'wdKit'; |
| @@ -8,6 +9,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -8,6 +9,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 8 | import router from '@ohos.router'; | 9 | import router from '@ohos.router'; |
| 9 | import Url from '@ohos.url' | 10 | import Url from '@ohos.url' |
| 10 | import { ContentDTO } from 'wdBean/Index'; | 11 | import { ContentDTO } from 'wdBean/Index'; |
| 12 | +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; | ||
| 11 | 13 | ||
| 12 | const TAG = 'JsBridgeBiz' | 14 | const TAG = 'JsBridgeBiz' |
| 13 | 15 | ||
| @@ -37,7 +39,9 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -37,7 +39,9 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 37 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: | 39 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: |
| 38 | break; | 40 | break; |
| 39 | case H5CallNativeType.jsCall_callAppService: | 41 | case H5CallNativeType.jsCall_callAppService: |
| 40 | - handleJsCallCallAppService(data) | 42 | + handleJsCallCallAppService(data, (res: string) => { |
| 43 | + call(res) | ||
| 44 | + }) | ||
| 41 | break; | 45 | break; |
| 42 | case H5CallNativeType.jsCall_receiveH5Data: | 46 | case H5CallNativeType.jsCall_receiveH5Data: |
| 43 | handleJsCallReceiveH5Data(data) | 47 | handleJsCallReceiveH5Data(data) |
| @@ -60,6 +64,21 @@ function handleJsCallCurrentPageOperate(data: Message) { | @@ -60,6 +64,21 @@ function handleJsCallCurrentPageOperate(data: Message) { | ||
| 60 | } | 64 | } |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 67 | +function handleJsCallCallAppService(data: Message, callback: (res: string) => void) { | ||
| 68 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 69 | + let url: string = HttpUrlUtils.getHost() + data?.data?.url | ||
| 70 | + if (data?.data?.method === 'get') { | ||
| 71 | + WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => { | ||
| 72 | + callback(JSON.stringify(res)) | ||
| 73 | + }) | ||
| 74 | + } | ||
| 75 | + if (data?.data?.method === 'post') { | ||
| 76 | + WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => { | ||
| 77 | + callback(JSON.stringify(res)) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | + | ||
| 63 | /** | 82 | /** |
| 64 | * 获取App公共信息 | 83 | * 获取App公共信息 |
| 65 | */ | 84 | */ |
| @@ -87,19 +106,14 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -87,19 +106,14 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 87 | } | 106 | } |
| 88 | } | 107 | } |
| 89 | 108 | ||
| 90 | -function handleJsCallCallAppService(data: Message) { | ||
| 91 | - | ||
| 92 | -} | ||
| 93 | - | ||
| 94 | function handleJsCallAppInnerLinkMethod(data: Message) { | 109 | function handleJsCallAppInnerLinkMethod(data: Message) { |
| 95 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); | 110 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); |
| 96 | let urlParams = new Url.URLParams(urlObject.search); | 111 | let urlParams = new Url.URLParams(urlObject.search); |
| 97 | - console.log('urlObject:', `${JSON.stringify(urlParams)}`) | ||
| 98 | let content: ContentDTO = { | 112 | let content: ContentDTO = { |
| 99 | objectId: urlParams.get('contentId') || '', | 113 | objectId: urlParams.get('contentId') || '', |
| 100 | relId: urlParams.get('relId') || '', | 114 | relId: urlParams.get('relId') || '', |
| 101 | relType: urlParams.get('relType') || '', | 115 | relType: urlParams.get('relType') || '', |
| 102 | - pageId:urlParams.get('pageId') || '', | 116 | + pageId: urlParams.get('pageId') || '', |
| 103 | objectType: '' | 117 | objectType: '' |
| 104 | } as ContentDTO | 118 | } as ContentDTO |
| 105 | if (urlParams.get('skipType') === '1') { | 119 | if (urlParams.get('skipType') === '1') { |
| @@ -130,14 +144,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -130,14 +144,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 130 | ProcessUtils.processPage(content) | 144 | ProcessUtils.processPage(content) |
| 131 | break; | 145 | break; |
| 132 | case 'topic': | 146 | case 'topic': |
| 133 | - if(urlParams.get('subType') === 'h5'){ | 147 | + if (urlParams.get('subType') === 'h5') { |
| 134 | content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC | 148 | content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC |
| 135 | ProcessUtils.processPage(content) | 149 | ProcessUtils.processPage(content) |
| 136 | } | 150 | } |
| 137 | - if(urlParams.get('subType') === 'moring_evening_news'){ | 151 | + if (urlParams.get('subType') === 'moring_evening_news') { |
| 138 | ProcessUtils.gotoMorningEveningPaper() | 152 | ProcessUtils.gotoMorningEveningPaper() |
| 139 | } | 153 | } |
| 140 | - if(urlParams.get('subType') === 'electronic_newspapers'){ | 154 | + if (urlParams.get('subType') === 'electronic_newspapers') { |
| 141 | ProcessUtils.gotoENewsPaper() | 155 | ProcessUtils.gotoENewsPaper() |
| 142 | } | 156 | } |
| 143 | break; | 157 | break; |
| @@ -148,7 +162,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -148,7 +162,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 148 | case 'owner_page': | 162 | case 'owner_page': |
| 149 | let creatorId = urlParams.get('creatorId') || '' | 163 | let creatorId = urlParams.get('creatorId') || '' |
| 150 | ProcessUtils.gotoPeopleShipHomePage(creatorId) | 164 | ProcessUtils.gotoPeopleShipHomePage(creatorId) |
| 151 | - break; | 165 | + break; |
| 152 | default: | 166 | default: |
| 153 | break; | 167 | break; |
| 154 | } | 168 | } |
| @@ -6,7 +6,7 @@ import { | @@ -6,7 +6,7 @@ import { | ||
| 6 | H5ReceiveDetailBean, | 6 | H5ReceiveDetailBean, |
| 7 | ResponseBean | 7 | ResponseBean |
| 8 | } from 'wdBean'; | 8 | } from 'wdBean'; |
| 9 | -import { Logger, SPHelper } from 'wdKit'; | 9 | +import { Logger, SPHelper, NetworkUtil } from 'wdKit'; |
| 10 | import { SpConstants } from 'wdConstant'; | 10 | import { SpConstants } from 'wdConstant'; |
| 11 | import { WdWebLocalComponent } from 'wdWebComponent'; | 11 | import { WdWebLocalComponent } from 'wdWebComponent'; |
| 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| @@ -61,7 +61,7 @@ export struct ImageAndTextWebComponent { | @@ -61,7 +61,7 @@ export struct ImageAndTextWebComponent { | ||
| 61 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { | 61 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { |
| 62 | creatorId: creatorId, | 62 | creatorId: creatorId, |
| 63 | isLogin: isLogin, | 63 | isLogin: isLogin, |
| 64 | - networkStatus: 1, | 64 | + networkStatus: Number(NetworkUtil.isNetConnected()), |
| 65 | loadImageOnlyWifiSwitch: '2', | 65 | loadImageOnlyWifiSwitch: '2', |
| 66 | 66 | ||
| 67 | } as H5ReceiveDataExtraBean | 67 | } as H5ReceiveDataExtraBean |
| @@ -118,6 +118,7 @@ struct LaunchInterestsHobbiesPage { | @@ -118,6 +118,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 118 | // .rowsTemplate('1fr 1fr 1fr 1fr') | 118 | // .rowsTemplate('1fr 1fr 1fr 1fr') |
| 119 | .columnsGap('23lpx') | 119 | .columnsGap('23lpx') |
| 120 | .rowsGap('23lpx') | 120 | .rowsGap('23lpx') |
| 121 | + .scrollBar(BarState.Off) | ||
| 121 | 122 | ||
| 122 | Stack({alignContent:Alignment.Center}){ | 123 | Stack({alignContent:Alignment.Center}){ |
| 123 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') | 124 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') |
-
Please register or login to post a comment