Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
frontend
/
qqxb-self-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
abcf6ef9
authored
Jun 29, 2020
by
cocomilk2012
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
b8299181
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
1 deletions
src/main.ts
src/utils/JsBridge.js
src/views/SelectIdentity.vue
src/main.ts
View file @
abcf6ef9
...
...
@@ -7,6 +7,9 @@ import server from '@/services/install';
// import FastClick from 'fastclick'
import
'@/assets/css/index.less'
;
import
*
as
filters
from
'@/utils/filters'
;
//@ts-ignore
import
initJsBridge
from
"@/utils/JsBridge.js"
;
Vue
.
config
.
productionTip
=
false
;
// FastClick.attach(document.body);
...
...
@@ -16,6 +19,34 @@ Object.keys(filters).forEach((key: string) => {
Vue
.
use
(
server
);
Vue
.
prototype
.
closeWebView
=
function
()
{
try
{
initJsBridge
(()
=>
{
//@ts-ignore
window
.
WebViewJavascriptBridge
.
callHandler
(
"ready"
,
null
,
function
(
//@ts-ignore
response
)
{
try
{
//@ts-ignore
window
.
WebViewJavascriptBridge
.
callHandler
(
"closeWebView"
,
null
,
//@ts-ignore
function
(
response
)
{
console
.
log
(
"closeWebView 来自 ios/android的回传数据:"
,
response
);
}
);
}
catch
(
err
)
{
console
.
log
(
"closeWebView is error"
);
}
});
});
}
catch
(
err
)
{
console
.
log
(
"setPageNavState is error"
);
}
};
if
(
process
.
env
.
NODE_ENV
===
'development'
||
process
.
env
.
NODE_ENV
===
'staging'
...
...
src/utils/JsBridge.js
0 → 100644
View file @
abcf6ef9
function
initJsBridge
(
readyCallback
)
{
var
u
=
navigator
.
userAgent
;
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
)
}
else
{
document
.
addEventListener
(
'WebViewJavascriptBridgeReady'
,
function
()
{
callback
(
WebViewJavascriptBridge
)
},
false
);
}
return
;
}
if
(
isiOS
)
{
if
(
window
.
WebViewJavascriptBridge
)
{
return
callback
(
WebViewJavascriptBridge
);
}
if
(
window
.
WVJBCallbacks
)
{
return
window
.
WVJBCallbacks
.
push
(
callback
);
}
window
.
WVJBCallbacks
=
[
callback
];
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
)
}
}
// 调用注册方法
connectWebViewJavascriptBridge
(
function
(
bridge
)
{
if
(
isAndroid
)
{
bridge
.
init
(
'reloadTXLContact'
,
function
(
data
,
responseCallback
)
{
//store.dispatch('changeTxlMember', data);
// data=JSON.parse(data);
// const date=Date.now();
// router.replace({ name: "addmembermanual", query: { name: data.name, linkway: data.linkway,date } });
responseCallback
(
'received from native data:'
,
data
);
});
}
bridge
.
registerHandler
(
'reloadTXLContact'
,
function
(
data
,
responseCallback
)
{
//store.dispatch('changeTxlMember', data);
// data=JSON.parse(data);
// const date=Date.now();
// router.replace({ name: "addmembermanual", query: { name: data.name, linkway: data.linkway,date } });
responseCallback
(
'received from native data:'
+
data
);
});
readyCallback
();
});
}
export
default
initJsBridge
;
\ No newline at end of file
src/views/SelectIdentity.vue
View file @
abcf6ef9
...
...
@@ -91,7 +91,7 @@ export default class SelectIdentity extends Vue {
private
async
getUserInfo
()
{
await
this
.
$server
.
EmployeeService
.
getUserInfo
({})
.
then
(
res
=>
{
if
(
res
.
data
&&
res
.
data
.
uthStatus
&&
res
.
data
.
uthStatus
>
0
)
{
if
(
false
&&
res
.
data
&&
res
.
data
.
uthStatus
&&
res
.
data
.
uthStatus
>
0
)
{
console
.
log
(
res
);
this
.
id_no
=
res
.
data
.
personalIdCardNo
;
...
...
@@ -104,6 +104,10 @@ export default class SelectIdentity extends Vue {
this
.
no_data
=
true
;
Dialog
.
alert
({
message
:
"您还未实名认证,不可进行查询,请先去【我】的页面,点击头像,进行实名认证后再查询"
}).
then
(()
=>
{
console
.
log
(
'close webview'
);
//@ts-ignore
this
.
closeWebView
();
});
}
})
...
...
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