Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yuzhilin
2024-05-13 09:19:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d838144ec16d09814ff577996e9045af65fdee42
d838144e
1 parent
5c6a4983
fix:17329 人民号稿件详情页-点击关注按钮一直卡在加载中
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
View file @
d838144
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
import { WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (data?.data?.method === 'get') {
let queryString: string = ''
let parameters = data?.data?.parameters
if (parameters) {
queryString = Object.keys(parameters)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`)
.join('&');
}
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if(queryString){
url +`?${queryString}}`
}
WDHttp.get(url).then((res) => {
callback(JSON.stringify(res))
})
}
if (data?.data?.method === 'post') {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
WDHttp.post(url, data?.data?.parameters).then((res) => {
callback(JSON.stringify({
netError: '0',
responseMap
} as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
// if (data?.data?.method === 'get') {
// WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
// callback(JSON.stringify(res))
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
responseMap: res
}))
})
}
}
...
...
Please
register
or
login
to post a comment