Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-webview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
mall-webview
Commits
6667dce2
Commit
6667dce2
authored
May 22, 2026
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2026-05-08-wechat-transfer' of…
Merge branch 'feature/2026-05-08-wechat-transfer' of
https://dev.jiuaoedu.com/wykolor/mall-webview
into test
parents
93957db6
22918c9f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
26 deletions
+4
-26
use-native-bridge.ts
src/util/use-native-bridge.ts
+4
-26
No files found.
src/util/use-native-bridge.ts
View file @
6667dce2
...
@@ -20,10 +20,10 @@ const isAndroid = () => {
...
@@ -20,10 +20,10 @@ const isAndroid = () => {
window
.
$geek_excuteJS
=
function
(
args
:
any
)
{
window
.
$geek_excuteJS
=
function
(
args
:
any
)
{
try
{
try
{
console
.
log
(
'$geek_excuteJS'
,
args
)
const
params
=
JSON
.
parse
(
args
)
const
params
=
JSON
.
parse
(
args
)
eventBus
.
emit
<
NativeInvokeFuncParams
>
(
GEEK_NATIVE_NAME
,
params
)
eventBus
.
emit
<
NativeInvokeFuncParams
>
(
GEEK_NATIVE_NAME
,
params
)
}
catch
(
error
)
{
}
catch
(
error
:
any
)
{
console
.
log
(
'error in $geek_excuteJS'
,
error
.
message
,
error
.
stack
)
eventBus
.
emit
<
NativeInvokeFuncParams
>
(
GEEK_NATIVE_NAME
,
args
)
eventBus
.
emit
<
NativeInvokeFuncParams
>
(
GEEK_NATIVE_NAME
,
args
)
}
}
}
}
...
@@ -103,7 +103,6 @@ function invokeNativeMethod<T = any, P = any> (arg: { type: string; data?: P },
...
@@ -103,7 +103,6 @@ function invokeNativeMethod<T = any, P = any> (arg: { type: string; data?: P },
eventBus
.
on
(
GEEK_NATIVE_NAME
,
onCallback
)
eventBus
.
on
(
GEEK_NATIVE_NAME
,
onCallback
)
function
onCallback
(
params
?:
NativeInvokeFuncParams
)
{
function
onCallback
(
params
?:
NativeInvokeFuncParams
)
{
console
.
log
(
'onCallback'
,
params
)
if
(
params
?.
method
===
callbackName
)
{
if
(
params
?.
method
===
callbackName
)
{
if
(
timer
)
{
if
(
timer
)
{
clearTimeout
(
timer
)
clearTimeout
(
timer
)
...
@@ -117,8 +116,6 @@ function invokeNativeMethod<T = any, P = any> (arg: { type: string; data?: P },
...
@@ -117,8 +116,6 @@ function invokeNativeMethod<T = any, P = any> (arg: { type: string; data?: P },
}
}
}
}
console
.
log
(
'sendNativeMessage'
,
{
...
arg
,
__callback__
:
callbackName
})
sendNativeMessage
({
...
arg
,
__callback__
:
callbackName
})
sendNativeMessage
({
...
arg
,
__callback__
:
callbackName
})
})
})
}
}
...
@@ -156,25 +153,6 @@ export interface RequestMerchantTransferParams {
...
@@ -156,25 +153,6 @@ export interface RequestMerchantTransferParams {
package
:
string
;
package
:
string
;
}
}
/** 微信各回调中常见的 errCode / errStr 结构 */
export
function
requestMerchantTransfer
(
params
:
RequestMerchantTransferParams
)
{
export
interface
WechatBaseResp
{
return
invokeNativeMethod
<
string
,
RequestMerchantTransferParams
>
({
type
:
'requestMerchantTransfer'
,
data
:
params
},
-
1
)
errCode
:
number
;
errStr
?:
string
;
/** 其他字段因场景而异 */
[
key
:
string
]:
unknown
;
}
/** WXOpenBusinessView 回调(如商家转账确认) */
export
interface
WechatOpenBusinessViewResp
extends
WechatBaseResp
{
type
?:
'WXOpenBusinessView.Resp'
;
businessType
?:
string
;
/** JSON 字符串,如 `{"result":"success"}`;result 可能为 success | fail | cancel */
extMsg
?:
string
;
}
export
async
function
requestMerchantTransfer
(
params
:
RequestMerchantTransferParams
)
{
const
result
=
await
invokeNativeMethod
<
WechatOpenBusinessViewResp
,
RequestMerchantTransferParams
>
({
type
:
'requestMerchantTransfer'
,
data
:
params
},
-
1
)
console
.
log
(
'requestMerchantTransfer result'
,
result
)
return
result
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment