Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
X
XiTianSenMall
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
leiqingsong
XiTianSenMall
Commits
b122638b
Commit
b122638b
authored
Mar 06, 2021
by
leiqingsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加公共路径
parent
db7069e2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
459 additions
and
320 deletions
+459
-320
webviewJavaScriptBridge.js
H5/public/vendors/webviewJavaScriptBridge.js
+134
-0
wallet.js
H5/src/api/wallet.js
+26
-26
bridge.js
H5/src/utils/bridge.js
+38
-39
request.js
H5/src/utils/request.js
+2
-3
customer-service.vue
H5/src/views/customer-service.vue
+54
-60
register.vue
H5/src/views/register.vue
+204
-192
vue.config.js
H5/vue.config.js
+1
-0
No files found.
H5/public/vendors/webviewJavaScriptBridge.js
0 → 100644
View file @
b122638b
//notation: js file can only use this kind of comments
//since comments will cause error when use in webview.loadurl,
//comments will be remove by java use regexp
(
function
()
{
if
(
window
.
WebViewJavascriptBridge
)
{
return
;
}
var
receiveMessageQueue
=
[];
var
messageHandlers
=
{};
var
responseCallbacks
=
{};
var
uniqueId
=
1
;
//set default messageHandler 初始化默认的消息线程
function
init
(
messageHandler
)
{
if
(
WebViewJavascriptBridge
.
_messageHandler
)
{
throw
new
Error
(
'WebViewJavascriptBridge.init called twice'
);
}
WebViewJavascriptBridge
.
_messageHandler
=
messageHandler
;
var
receivedMessages
=
receiveMessageQueue
;
receiveMessageQueue
=
null
;
for
(
var
i
=
0
;
i
<
receivedMessages
.
length
;
i
++
)
{
_dispatchMessageFromNative
(
receivedMessages
[
i
]);
}
}
// 发送
function
send
(
data
,
responseCallback
)
{
_doSend
(
'send'
,
data
,
responseCallback
);
}
// 注册线程 往数组里面添加值
function
registerHandler
(
handlerName
,
handler
)
{
messageHandlers
[
handlerName
]
=
handler
;
}
// 调用线程
function
callHandler
(
handlerName
,
data
,
responseCallback
)
{
_doSend
(
handlerName
,
data
,
responseCallback
);
}
//sendMessage add message, 触发native处理 sendMessage
function
_doSend
(
handlerName
,
message
,
responseCallback
)
{
var
callbackId
;
if
(
typeof
responseCallback
===
'string'
){
callbackId
=
responseCallback
;
}
else
if
(
responseCallback
)
{
callbackId
=
'cb_'
+
(
uniqueId
++
)
+
'_'
+
new
Date
().
getTime
();
responseCallbacks
[
callbackId
]
=
responseCallback
;
}
else
{
callbackId
=
''
;
}
try
{
var
fn
=
eval
(
'window.android.'
+
handlerName
);
}
catch
(
e
)
{
console
.
log
(
e
);
}
if
(
typeof
fn
===
'function'
){
var
responseData
=
fn
.
call
(
this
,
JSON
.
stringify
(
message
),
callbackId
);
if
(
responseData
){
console
.
log
(
'response message: '
+
responseData
);
responseCallback
=
responseCallbacks
[
callbackId
];
if
(
!
responseCallback
)
{
return
;
}
responseCallback
(
responseData
);
delete
responseCallbacks
[
callbackId
];
}
}
}
//提供给native使用,
function
_dispatchMessageFromNative
(
messageJSON
)
{
setTimeout
(
function
()
{
var
message
=
JSON
.
parse
(
messageJSON
);
var
responseCallback
;
//java call finished, now need to call js callback function
if
(
message
.
responseId
)
{
responseCallback
=
responseCallbacks
[
message
.
responseId
];
if
(
!
responseCallback
)
{
return
;
}
responseCallback
(
message
.
responseData
);
delete
responseCallbacks
[
message
.
responseId
];
}
else
{
//直接发送
if
(
message
.
callbackId
)
{
var
callbackResponseId
=
message
.
callbackId
;
responseCallback
=
function
(
responseData
)
{
_doSend
(
'response'
,
responseData
,
callbackResponseId
);
};
}
var
handler
=
WebViewJavascriptBridge
.
_messageHandler
;
if
(
message
.
handlerName
)
{
handler
=
messageHandlers
[
message
.
handlerName
];
}
//查找指定handler
try
{
handler
(
message
.
data
,
responseCallback
);
}
catch
(
exception
)
{
if
(
typeof
console
!=
'undefined'
)
{
console
.
log
(
"WebViewJavascriptBridge: WARNING: javascript handler threw."
,
message
,
exception
);
}
}
}
});
}
//提供给native调用,receiveMessageQueue 在会在页面加载完后赋值为null,所以
function
_handleMessageFromNative
(
messageJSON
)
{
console
.
log
(
'handle message: '
+
messageJSON
);
if
(
receiveMessageQueue
)
{
receiveMessageQueue
.
push
(
messageJSON
);
}
_dispatchMessageFromNative
(
messageJSON
);
}
var
WebViewJavascriptBridge
=
window
.
WebViewJavascriptBridge
=
{
init
:
init
,
send
:
send
,
registerHandler
:
registerHandler
,
callHandler
:
callHandler
,
_handleMessageFromNative
:
_handleMessageFromNative
};
var
doc
=
document
;
var
readyEvent
=
doc
.
createEvent
(
'Events'
);
readyEvent
.
initEvent
(
'WebViewJavascriptBridgeReady'
);
readyEvent
.
bridge
=
WebViewJavascriptBridge
;
doc
.
dispatchEvent
(
readyEvent
);
})();
H5/src/api/wallet.js
View file @
b122638b
...
...
@@ -9,7 +9,7 @@ export function getMoneyPackage(params) {
url
:
"/wallet/getMoneyPackage"
,
method
:
"get"
,
params
})
});
}
/**
...
...
@@ -21,7 +21,7 @@ export function getWithdrawalAmount(params) {
url
:
"getWithdrawalAmount"
,
method
:
"get"
,
params
})
});
}
/**
...
...
@@ -34,7 +34,7 @@ export function getWithdrawalRecord(params) {
url
:
"/wallet/getWithdrawalRecord"
,
method
:
"get"
,
params
})
});
}
/**
...
...
@@ -46,7 +46,7 @@ export function queryIncomeDetail(params) {
url
:
"/wallet/queryIncomeDetail"
,
method
:
"get"
,
params
})
});
}
/**
...
...
@@ -59,5 +59,5 @@ export function showIncomeRecord(params) {
url
:
"/wallet/showIncomeRecord"
,
method
:
"get"
,
params
})
});
}
H5/src/utils/bridge.js
View file @
b122638b
var
u
=
navigator
.
userAgent
;
var
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
;
//android终端
var
isAndroid
=
u
.
indexOf
(
"Android"
)
>
-
1
||
u
.
indexOf
(
"Adr"
)
>
-
1
;
//android终端
var
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
// 注册jsbridge
function
connectWebViewJavascriptBridge
(
callback
)
{
if
(
isAndroid
)
{
if
(
window
.
WebViewJavascriptBridge
)
{
callback
(
WebViewJavascriptBridge
)
callback
(
WebViewJavascriptBridge
);
}
else
{
document
.
addEventListener
(
'WebViewJavascriptBridgeReady'
,
function
()
{
callback
(
WebViewJavascriptBridge
)
"WebViewJavascriptBridgeReady"
,
function
()
{
callback
(
WebViewJavascriptBridge
);
},
false
);
...
...
@@ -25,21 +25,20 @@ function connectWebViewJavascriptBridge(callback) {
return
window
.
WVJBCallbacks
.
push
(
callback
);
}
window
.
WVJBCallbacks
=
[
callback
];
var
WVJBIframe
=
document
.
createElement
(
'iframe'
);
WVJBIframe
.
style
.
display
=
'none'
;
WVJBIframe
.
src
=
'https://__bridge_loaded__'
;
var
WVJBIframe
=
document
.
createElement
(
"iframe"
);
WVJBIframe
.
style
.
display
=
"none"
;
WVJBIframe
.
src
=
"https://__bridge_loaded__"
;
document
.
documentElement
.
appendChild
(
WVJBIframe
);
setTimeout
(
function
()
{
document
.
documentElement
.
removeChild
(
WVJBIframe
)
},
0
)
setTimeout
(
function
()
{
document
.
documentElement
.
removeChild
(
WVJBIframe
);
},
0
);
}
}
// 调用注册方法
connectWebViewJavascriptBridge
(
function
(
bridge
)
{
connectWebViewJavascriptBridge
(
function
(
bridge
)
{
if
(
isAndroid
)
{
bridge
.
init
(
function
(
message
,
responseCallback
)
{
bridge
.
init
(
function
(
message
,
responseCallback
)
{
responseCallback
(
data
);
});
}
});
H5/src/utils/request.js
View file @
b122638b
...
...
@@ -4,14 +4,13 @@ import { Toast } from "vant";
let
loading
=
null
;
const
service
=
axios
.
create
({
baseURL
:
"http://
192.168.204.152
:8997"
,
baseURL
:
"http://
8.131.244.76
:8997"
,
timeout
:
5000
});
service
.
interceptors
.
request
.
use
(
config
=>
{
config
.
headers
[
"Authorization"
]
=
"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJpZFwiOjEsXCJpbnZpdGVDb2RlXCI6XCIxXCIsXCJwYXNzd29yZFwiOlwiMTIzXCIsXCJ1c2VySWRcIjpcIjFcIixcInVzZXJMZXZlbFwiOjR9IiwiaWF0IjoxNjE0MzI3OTY0fQ.f9RPBOMo0BMMbWPnQIhvfLe535as60dk_SZoXMYOT3bHYjoYST-mivTcKC-u4grEpYZMax9RgyuHXCYydZPzQw"
;
config
.
headers
[
"Authorization"
]
=
"b6cd4e221fdc4e46a6825c236c912fa6"
;
if
(
!
config
.
loading
)
{
loading
=
Toast
.
loading
({
forbidClick
:
true
,
...
...
H5/src/views/customer-service.vue
View file @
b122638b
...
...
@@ -12,7 +12,7 @@
<div
class=
"panel-box"
>
<div
class=
"panel-content"
>
<div
class=
"title"
>
客服二维码
</div>
<img
src=
"@/assets/images/logo.png"
class=
"qrCode"
alt=
""
>
<img
src=
"@/assets/images/logo.png"
class=
"qrCode"
alt=
""
/
>
<div
class=
"save-code"
>
<p>
保存二维码
</p>
<p>
打开微信扫一扫添加客服
</p>
...
...
@@ -20,7 +20,6 @@
<van-button>
保存
</van-button>
</div>
</div>
</div>
</
template
>
...
...
@@ -28,9 +27,7 @@
export
default
{
name
:
"customerService"
,
data
()
{
return
{
};
return
{};
},
methods
:
{
handleUrl
(
urlName
)
{
...
...
@@ -70,20 +67,19 @@ $white: #ffffff;
font-size
:
16px
;
}
}
.panel-box
{
.panel-box
{
height
:
calc
(
100vh
-
86px
);
padding
:
0
15px
;
margin-top
:
15px
;
.panel-content
{
.panel-content
{
width
:
100%
;
height
:
100%
;
background-color
:
#ffffff
;
box-shadow
:
0px
2px
12px
0px
rgba
(
6
,
0
,
1
,
0
.04
);
box-shadow
:
0px
2px
12px
0px
rgba
(
6
,
0
,
1
,
0
.04
);
border-radius
:
4px
;
padding-top
:
45px
;
box-sizing
:
border-box
;
.title
{
.title
{
font-size
:
18px
;
font-weight
:
normal
;
font-stretch
:
normal
;
...
...
@@ -92,13 +88,13 @@ $white: #ffffff;
color
:
#333333
;
text-align
:
center
;
}
.qrCode
{
.qrCode
{
width
:
128px
;
height
:
130px
;
margin
:
80px
auto
30px
;
display
:
block
;
}
.save-code
{
.save-code
{
font-size
:
14px
;
font-weight
:
normal
;
font-stretch
:
normal
;
...
...
@@ -106,19 +102,17 @@ $white: #ffffff;
letter-spacing
:
0px
;
color
:
#999999
;
}
.van-button
{
.van-button
{
width
:
160px
;
height
:
36px
;
background-color
:
#88c678
;
border-radius
:
4px
;
font-size
:
18px
;
color
:
#ffffff
;
margin
:
85px
auto
0
;
margin
:
85px
auto
0
;
display
:
block
;
}
}
}
}
</
style
>
H5/src/views/register.vue
View file @
b122638b
<
template
>
<div
class=
"register-container"
>
<div
class=
"register-container"
>
<van-icon
name=
"arrow-left"
@
click=
"$router.go(-1)"
/>
<img
src=
"@/assets/images/logo.png"
class=
"logo-img"
alt=
""
>
<img
src=
"@/assets/images/logo.png"
class=
"logo-img"
alt=
""
/
>
<div
class=
"form-content"
>
<van-cell-group>
<van-field
...
...
@@ -10,7 +10,12 @@
:border=
"hasBorder"
bind:change=
"onChange"
>
<img
class=
"icon-user"
src=
"@/assets/images/icon-user.png"
slot=
"left-icon"
alt=
""
>
<img
class=
"icon-user"
src=
"@/assets/images/icon-user.png"
slot=
"left-icon"
alt=
""
/>
</van-field>
<van-field
:value=
"value"
...
...
@@ -18,8 +23,19 @@
:border=
"hasBorder"
bind:change=
"onChange"
>
<img
class=
"icon-user"
src=
"@/assets/images/icon-code.png"
slot=
"left-icon"
alt=
""
>
<van-button
slot=
"button"
size=
"small"
type=
"primary"
class=
"verify-code"
>
发送验证码
</van-button>
<img
class=
"icon-user"
src=
"@/assets/images/icon-code.png"
slot=
"left-icon"
alt=
""
/>
<van-button
slot=
"button"
size=
"small"
type=
"primary"
class=
"verify-code"
>
发送验证码
</van-button
>
</van-field>
<van-field
:value=
"value"
...
...
@@ -27,55 +43,56 @@
:border=
"hasBorder"
bind:change=
"onChange"
>
<img
class=
"icon-user"
src=
"@/assets/images/icon-invite-code.png"
slot=
"left-icon"
alt=
""
>
<img
class=
"icon-user"
src=
"@/assets/images/icon-invite-code.png"
slot=
"left-icon"
alt=
""
/>
</van-field>
</van-cell-group>
<van-button
class=
"btn-submit"
@
click=
"register"
>
注册
</van-button>
</div>
<van-overlay
:show=
"show"
class-name=
"registerEorr"
@
click=
"onClickHide"
>
<van-overlay
:show=
"show"
class-name=
"registerEorr"
@
click=
"onClickHide"
>
<div
class=
"wrapper"
@
click
.
stop
>
<div
class=
"title"
>
{{
title
}}
</div>
<div
class=
"title"
>
{{
title
}}
</div>
<div
class=
"error-tip"
></div>
<div
class=
"tip"
>
{{
tip
}}
</div>
<div
class=
"tip"
>
{{
tip
}}
</div>
<van-button>
确定
</van-button>
</div>
</van-overlay>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'register'
,
data
()
{
name
:
"register"
,
data
()
{
return
{
value
:
''
,
hasBorder
:
false
,
value
:
""
,
hasBorder
:
false
,
show
:
true
,
title
:
'注册失败'
,
tip
:
'该推荐人邀请码不存在,请重新填写'
}
title
:
"注册失败"
,
tip
:
"该推荐人邀请码不存在,请重新填写"
};
},
methods
:
{
register
()
{
register
()
{
// this.show = true
},
onClickHide
(){
this
.
show
=
false
}
onClickHide
()
{
this
.
show
=
false
;
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.register-container
{
.register-container
{
height
:
100vh
;
background-color
:
#ffffff
;
padding
:
54px
15px
0
15px
;
box-sizing
:
border-box
;
overflow
:
hidden
;
.van-icon-arrow-left
{
.van-icon-arrow-left
{
position
:
absolute
;
left
:
15px
;
top
:
9px
;
...
...
@@ -84,62 +101,57 @@ export default {
// color: #333;
// margin: 13px 0 0 15px;
}
.logo-img
{
.logo-img
{
width
:
102px
;
height
:
102px
;
display
:
block
;
margin
:
0
auto
50px
;
}
.form-content
{
.form-content
{
padding
:
0
15px
;
.van-field__left-icon
{
.van-field__left-icon
{
display
:
flex
;
align-items
:
center
;
}
.
van-cell-group
:
:
after
{
.
van-cell-group
:
:
after
{
display
:
none
;
}
.van-cell
{
.van-cell
{
background-color
:
#f9f9f9
;
border-radius
:
25px
;
margin-bottom
:
20px
;
}
}
.icon-user
{
.icon-user
{
width
:
18px
;
height
:
18px
;
height
:
18px
;
}
.icon-code
{
.icon-code
{
width
:
16px
;
height
:
18px
;
height
:
18px
;
}
.icon-code
{
.icon-code
{
width
:
17px
;
height
:
17px
;
height
:
17px
;
}
.btn-submit
{
.btn-submit
{
width
:
100%
;
height
:
44px
;
background-image
:
linear-gradient
(
72deg
,
#88c678
0%
,
#95e87f
100%
)
,
linear-gradient
(
#999999
,
#999999
);
background-blend-mode
:
normal
,
normal
;
background-image
:
linear-gradient
(
72deg
,
#88c678
0%
,
#95e87f
100%
)
,
linear-gradient
(
#999999
,
#999999
);
background-blend-mode
:
normal
,
normal
;
border-radius
:
22px
;
color
:
#ffffff
;
font-size
:
18px
;
margin-top
:
20px
;
}
.verify-code
{
.verify-code
{
background-color
:
transparent
;
border
:
none
;
color
:
#88c677
;
}
.van-overlay.registerEorr
{
.wrapper
{
.van-overlay.registerEorr
{
.wrapper
{
width
:
315px
;
height
:
293px
;
position
:
absolute
;
...
...
@@ -151,7 +163,7 @@ export default {
text-align
:
center
;
box-sizing
:
border-box
;
border-radius
:
4px
;
.title
{
.title
{
font-size
:
20px
;
font-weight
:
normal
;
font-stretch
:
normal
;
...
...
@@ -159,43 +171,44 @@ export default {
letter-spacing
:
0px
;
color
:
#333333
;
}
.error-tip
{
.error-tip
{
width
:
72px
;
height
:
72px
;
border
:
6px
solid
#ff0000
;
border-radius
:
50%
;
font-size
:
48px
;
font-weight
:
bold
;
font-weight
:
bold
;
color
:
#ff0000
;
margin
:
25px
auto
;
position
:
relative
;
&
:before
,
&
:after
{
&
:before
,
&
:after
{
content
:
""
;
display
:
inline-block
;
width
:
6px
;
height
:
30px
;
background-color
:
#ff0000
;
border-radius
:
4px
;
transform-origin
:center
;
transform-origin
:
center
;
position
:
absolute
;
left
:
50%
;
top
:
50%
;
}
&
:before
{
transform
:translate
(
-50
%
,
-50
%
)
rotate
(
45deg
)
;
&
:before
{
transform
:
translate
(
-50%
,
-50%
)
rotate
(
45deg
);
}
&
:after
{
transform
:translate
(
-50
%
,
-50
%
)
rotate
(
-45deg
)
;
&
:after
{
transform
:
translate
(
-50%
,
-50%
)
rotate
(
-45deg
);
}
}
.tip
{
.tip
{
font-size
:
14px
;
font-weight
:
normal
;
font-stretch
:
normal
;
line-height
:
20px
;
color
:
#999999
;
}
.van-button
{
.van-button
{
width
:
160px
;
height
:
36px
;
background-color
:
#88c678
;
...
...
@@ -204,7 +217,6 @@ export default {
margin-top
:
25px
;
}
}
}
}
</
style
>
H5/vue.config.js
View file @
b122638b
const
name
=
"西田森App"
;
module
.
exports
=
{
publicPath
:
"/font"
,
css
:
{
loaderOptions
:
{
postcss
:
{
...
...
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