You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
5.7 KiB
167 lines
5.7 KiB
<!DOCTYPE html> |
|
<html> |
|
|
|
<head> |
|
<meta charset="utf-8"> |
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> |
|
<title>身份认证</title> |
|
<!--REM自适应布局JS--> |
|
<link rel="stylesheet" type="text/css" href="../../../lib/css/mui.min.css"> |
|
<link rel="stylesheet" type="text/css" href="../../../lib/css/basic.css"/> |
|
<link rel="stylesheet" type="text/css" href="../../css/base.css" /> |
|
<script src="../../../lib/js/mui.min.js"></script> |
|
<script src="../../../lib/js/vue.js"></script> |
|
<script src="../../../lib/js/app.js"></script> |
|
<script src="../../js/base/rem-layout.js"></script> |
|
<script type="text/javascript" src="../../js/my/my_ajax.js"></script> |
|
<script src="../../../lib/js/require2.1.11.js"></script> |
|
</head> |
|
<style> |
|
|
|
</style> |
|
|
|
<body> |
|
<div id="data-info"> |
|
<header class="mui-bar mui-bar-nav app-header app-header-darkly"> |
|
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> |
|
<h1 class="mui-title">{{langue.MyIdentityNextTitle}}</h1> |
|
</header> |
|
<div class="mui-content"> |
|
<div class="app-input-group app-input-group-darkly"> |
|
<div class="app-input-row-list"> |
|
<label class="mui-text-left">{{langue.MyIdentityNextName}}</label> |
|
<input class="app-input" type="text" v-model="real_name" :placeholder="langue.MyIdentityNextNamePlaceholder" /> |
|
</div> |
|
<div class="app-input-row-list"> |
|
<label class="mui-text-left">{{langue.MyIdentityNextID}}</label> |
|
<input class="app-input" type="text" v-model="identity_id" :placeholder="langue.MyIdentityNextIDPlaceholder" /> |
|
</div> |
|
</div> |
|
<button id="affrim-btn" class="app-btn app-btn-darkly">{{langue.NotarizeText2}}</button> |
|
</div> |
|
</div> |
|
</body> |
|
|
|
</html> |
|
|
|
<script> |
|
// 国际化 |
|
var langues = { |
|
zh_CN: { |
|
MyIdentityNextTitle: "身份认证", |
|
MyIdentityNextName: "姓名", |
|
MyIdentityNextNamePlaceholder: "请输入您的姓名", |
|
MyIdentityNextID: "身份证号", |
|
MyIdentityNextIDPlaceholder: "请输入您的身份证号", |
|
MyIdentityNextAlert1: "请输入您的姓名和身份证!", |
|
MyIdentityNextAlert2: "请输正确格式的身份证!", |
|
NotarizeText2: "确定", |
|
SubmitSuccessMsg: "提交成功!", |
|
authenticationSuccess: "认证成功!", |
|
}, |
|
zh_HK: { |
|
MyIdentityNextTitle: "身份認證", |
|
MyIdentityNextName: "姓名", |
|
MyIdentityNextNamePlaceholder: "請輸入您的姓名", |
|
MyIdentityNextID: "身份證號", |
|
MyIdentityNextIDPlaceholder: "請輸入您的身份證號", |
|
MyIdentityNextAlert1: "請輸入您的姓名和身份證!", |
|
MyIdentityNextAlert2: "請輸正確格式的身份證!", |
|
NotarizeText2: "確定", |
|
SubmitSuccessMsg: "提交成功!", |
|
authenticationSuccess: "認證成功!", |
|
}, |
|
en_US: { |
|
MyIdentityNextTitle: "Authentication", |
|
MyIdentityNextName: "Name", |
|
MyIdentityNextNamePlaceholder: "Input your name", |
|
MyIdentityNextID: "Number", |
|
MyIdentityNextIDPlaceholder: "Input your ID card number", |
|
MyIdentityNextAlert1: "Please enter your name and id card.", |
|
MyIdentityNextAlert2: "Please enter your id card in the correct format.", |
|
NotarizeText2: "Confirm", |
|
SubmitSuccessMsg: "Submit successfully!", |
|
authenticationSuccess: "Authentication success!", |
|
} |
|
} |
|
</script> |
|
<script> |
|
var identityInfo = new Vue({ |
|
el: "#data-info", |
|
data: { |
|
langue: langues[app.getLanguageLocalStorage()], |
|
real_name: '', |
|
identity_id: '', |
|
} |
|
}); |
|
|
|
var self = null; |
|
mui.plusReady(function() { |
|
self = plus.webview.currentWebview(); |
|
console.log(self.national_src + "," + self.portrait_src); |
|
//校验数据 |
|
document.getElementById("affrim-btn").addEventListener("tap", function() { |
|
if('' == identityInfo.real_name || '' == identityInfo.identity_id) { |
|
mui.toast(identityInfo.langue.MyIdentityNextAlert1); |
|
} else if(identityInfo.identity_id.length > 18) { |
|
mui.toast(identityInfo.langue.MyIdentityNextAlert2); |
|
} else { |
|
saveIdentity(self.national_src + "," + self.portrait_src); |
|
} |
|
}); |
|
}); |
|
|
|
//保存用户信息接口 |
|
function saveIdentity(img_url) { |
|
plus.nativeUI.showWaiting(identityInfo.langue.ShowWaiting); |
|
mui.ajax(myAjaxJs.AJAX_SAVE_IDENTITY_INFO.getUrl, { |
|
headers: { |
|
"X-Requested-Token": app.getTokenStorage(), // token头部 |
|
"locale": app.getLanguageLocalStorage() // 语种头部 |
|
}, |
|
data: { |
|
realName: identityInfo.real_name, |
|
idNumber: identityInfo.identity_id, |
|
imgs: img_url |
|
}, |
|
dataType: 'json', //服务器返回json格式数据 |
|
type: myAjaxJs.AJAX_SAVE_IDENTITY_INFO.getType, //HTTP请求类型 |
|
timeout: 10000, |
|
success: function(data) { |
|
if(data.code == "200") { |
|
plus.nativeUI.closeWaiting(); |
|
var userData = app.getUserLocalStorage(); |
|
userData.lowAuth = 'W'; |
|
app.setUserLocalStorage(userData); |
|
mui.toast(identityInfo.langue.authenticationSuccess, identityInfo.langue.AlertMsg); |
|
// var wallet_my = plus.webview.getWebviewById("mine/html/wallet_my.html"); |
|
//wallet_my.show(); |
|
var realname_identity = plus.webview.getWebviewById("mine/html/my/realname_identity.html"); |
|
realname_identity.evalJS("saveUserInfoData();"); |
|
realname_identity.show(); |
|
var _opener = self.opener(); |
|
self.close(); |
|
_opener.close(); |
|
} else if(data.code == "201" || data.code == "202") { //未登录 |
|
plus.nativeUI.closeWaiting(); |
|
mui.openWindow({ |
|
id: "mine/html/wallet_login.html", |
|
url: "../wallet_login.html" |
|
}); |
|
} else { |
|
plus.nativeUI.closeWaiting(); |
|
mui.toast(data.msg); |
|
} |
|
}, |
|
error: function(xhr, type, errorThrown) { |
|
plus.nativeUI.closeWaiting(); |
|
// mui.alert(langue.AjaxError2, langue.AlertMsg); |
|
} |
|
}); |
|
} |
|
|
|
// 国际化统一方法 |
|
window.addEventListener('switchLangueData', function(e) { |
|
dataInfo.langue = langues[e.detail]; |
|
}); |
|
</script> |