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
1007be26
Commit
1007be26
authored
Mar 29, 2021
by
wykolor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2021_03_12_bonus' of dev.jiuaoedu.com:wykolor/GeekBonusH5…
Merge branch 'feature/2021_03_12_bonus' of dev.jiuaoedu.com:wykolor/GeekBonusH5 into feature/2021_03_12_bonus
parents
29080f33
38fa81e4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
use-native-bridge.ts
src/util/use-native-bridge.ts
+5
-5
index.vue
src/views/bonus/index.vue
+6
-5
No files found.
src/util/use-native-bridge.ts
View file @
1007be26
...
@@ -28,7 +28,7 @@ window.$geek_excuteJS = function (args) {
...
@@ -28,7 +28,7 @@ window.$geek_excuteJS = function (args) {
}
}
};
};
const
sendNativeMessage
=
(
data
:
{
type
:
string
;
data
?:
any
})
=>
{
const
sendNativeMessage
=
(
data
:
{
type
:
string
;
data
?:
any
;
__callback__
?:
string
})
=>
{
if
(
isAndroid
())
{
if
(
isAndroid
())
{
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
.
onMessage
&&
window
.
ReactNativeWebView
.
onMessage
&&
...
@@ -90,7 +90,7 @@ const INVOKE_NATIVE_METHOD_TIMEOUT = 10000;
...
@@ -90,7 +90,7 @@ const INVOKE_NATIVE_METHOD_TIMEOUT = 10000;
function
invokeNativeMethod
<
T
=
any
,
P
=
any
>
(
arg
:
{
type
:
string
;
data
?:
P
}):
Promise
<
T
>
{
function
invokeNativeMethod
<
T
=
any
,
P
=
any
>
(
arg
:
{
type
:
string
;
data
?:
P
}):
Promise
<
T
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
callbackName
=
`
${
arg
.
type
}
_callback
`
;
const
callbackName
=
`
${
arg
.
type
}
_callback
_
${
Math
.
random
()}
`
.
replace
(
/
\.
/
,
""
)
;
const
timer
=
setTimeout
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
reject
(
new
Error
(
`invoke
${
arg
.
type
}
timeout`
));
reject
(
new
Error
(
`invoke
${
arg
.
type
}
timeout`
));
...
@@ -111,7 +111,7 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
...
@@ -111,7 +111,7 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
}
}
}
}
sendNativeMessage
(
arg
);
sendNativeMessage
(
{
...
arg
,
__callback__
:
callbackName
}
);
});
});
}
}
...
@@ -119,12 +119,12 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
...
@@ -119,12 +119,12 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
* 微信登录
* 微信登录
*/
*/
export
function
bindWeChat
()
{
export
function
bindWeChat
()
{
return
invokeNativeMethod
<
{
code
:
string
}
>
({
type
:
"bindWeC
hat"
});
return
invokeNativeMethod
<
{
code
:
string
;
userId
:
string
}
>
({
type
:
"bindWec
hat"
});
}
}
/**
/**
* 打电话
* 打电话
*/
*/
export
function
make
c
all
(
phone
:
string
)
{
export
function
make
C
all
(
phone
:
string
)
{
return
invokeNativeMethod
<
null
,
string
>
({
type
:
"makecall"
,
data
:
phone
});
return
invokeNativeMethod
<
null
,
string
>
({
type
:
"makecall"
,
data
:
phone
});
}
}
src/views/bonus/index.vue
View file @
1007be26
...
@@ -172,7 +172,7 @@ import { Dialog, Button, Col, Row, Cell, List, Loading } from "vant";
...
@@ -172,7 +172,7 @@ import { Dialog, Button, Col, Row, Cell, List, Loading } from "vant";
import
{
BonusAccountResponse
,
WithdrawListParams
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
BonusAccountResponse
,
WithdrawListParams
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
bonusModel
}
from
"@/server/api"
;
import
{
bonusModel
}
from
"@/server/api"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
bindWeChat
,
useNativeBridge
}
from
"@/util/use-native-bridge"
;
import
{
bindWeChat
,
useNativeBridge
,
makeCall
}
from
"@/util/use-native-bridge"
;
import
{
formatBonusTipTxt
}
from
"@/util/formatBonusTipTxt"
;
import
{
formatBonusTipTxt
}
from
"@/util/formatBonusTipTxt"
;
interface
BonusState
{
interface
BonusState
{
...
@@ -253,10 +253,11 @@ const Bonus = defineComponent({
...
@@ -253,10 +253,11 @@ const Bonus = defineComponent({
state
.
showWithdrawRules
=
true
;
state
.
showWithdrawRules
=
true
;
};
};
const
phoneCall
=
()
=>
{
const
phoneCall
=
()
=>
{
sendNativeMessage
({
makeCall
(
"400—8777389"
)
type
:
"phoneCall"
,
// sendNativeMessage({
data
:
"400—8777389"
// type: "phoneCall",
});
// data: "400—8777389"
// });
};
};
const
bindWeiChat
=
()
=>
{
const
bindWeiChat
=
()
=>
{
state
.
binding
=
true
;
state
.
binding
=
true
;
...
...
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