Commit abcf6ef9 by cocomilk2012

update

parent b8299181
......@@ -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'
......
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
......@@ -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();
});
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment