支付宝验证
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == -10000) {
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往用户主页实名认证。');
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往 电脑端 用户主页实名认证。');
|
||||
window.location.href="/User/Index";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == -10000) {
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往用户主页实名认证。');
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往 电脑端 用户主页实名认证。');
|
||||
window.location.href="/User/Index";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<!-- 账户信息 -->
|
||||
<div class="accout_tit"><span class="lineBar"></span>账户信息 <button class="btnXq" onclick="$('#infoBox').show()">完善信息</button>
|
||||
<button class="btnXq" onclick="$('#pwdBox').show()">修改密码</button>
|
||||
<button class="btnXq" id="real-name-confirm" onclick="$('#real-name').show()">实名认证</button>
|
||||
<!-- <button class="btnXq" id="real-name-confirm" onclick="$('#real-name').show()">实名认证</button> -->
|
||||
</div>
|
||||
<div class="model">
|
||||
<div class="item">
|
||||
@@ -328,6 +328,8 @@
|
||||
<div id="aliPayBox" style="display:none"></div>
|
||||
|
||||
<script>
|
||||
|
||||
var t1 = null;
|
||||
/** 表单序列化成json字符串的方法 */
|
||||
function form2JsonString(formId) {
|
||||
var paramArray = $('#' + formId).serializeArray();
|
||||
@@ -414,6 +416,45 @@
|
||||
});
|
||||
}
|
||||
|
||||
// function realname(){
|
||||
// let id_code = $('#real-name-code').val(),
|
||||
// name = $('#real-name-name').val();
|
||||
|
||||
// if(id_code.length <= 0){
|
||||
// alert("抱歉!请重新输入身份证号!");
|
||||
// return;
|
||||
// }
|
||||
// if(name.length <= 0){
|
||||
// alert("抱歉!请重新输入姓名!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let data = {
|
||||
// cookie:document.cookie,
|
||||
// id_code: id_code,
|
||||
// name: name
|
||||
// }
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: 'http://php-api.juip.com/api/Realname/index',
|
||||
// dataType: "json",
|
||||
// contentType: "application/json",
|
||||
// data: JSON.stringify(data),
|
||||
// beforeSend: function(xhr) {
|
||||
// xhr.withCredentials = true;
|
||||
// },
|
||||
// crossDomain: true,
|
||||
// success: function (res) {
|
||||
// if (res.Code == 10000) {
|
||||
// $('.real-name').hide();
|
||||
// alert('实名认证成功。');
|
||||
// } else {
|
||||
// alert('请正确填写姓名和身份证号码。');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
function realname(){
|
||||
let id_code = $('#real-name-code').val(),
|
||||
name = $('#real-name-name').val();
|
||||
@@ -426,15 +467,17 @@
|
||||
alert("抱歉!请重新输入姓名!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let data = {
|
||||
cookie:document.cookie,
|
||||
id_code: id_code,
|
||||
name: name
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://php-api.juip.com/api/Realname/index',
|
||||
url: 'http://php-api.juip.com/api/test/aliverify',
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
@@ -444,13 +487,65 @@
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == 10000) {
|
||||
$('.real-name').hide();
|
||||
alert('实名认证成功。');
|
||||
const certifyUrl = 'alipays://platformapi/startapp?appId=20000067&url='+encodeURIComponent(res.url);
|
||||
window.location.href=certifyUrl
|
||||
// t1 = window.setInterval(get_verify_res,1500);
|
||||
|
||||
} else {
|
||||
alert('请正确填写姓名和身份证号码。');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// let data = {
|
||||
// cookie:document.cookie,
|
||||
// id_code: id_code,
|
||||
// name: name
|
||||
// }
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: 'http://php-api.juip.com/api/Realname/index',
|
||||
// dataType: "json",
|
||||
// contentType: "application/json",
|
||||
// data: JSON.stringify(data),
|
||||
// beforeSend: function(xhr) {
|
||||
// xhr.withCredentials = true;
|
||||
// },
|
||||
// crossDomain: true,
|
||||
// success: function (res) {
|
||||
// if (res.Code == 10000) {
|
||||
// $('.real-name').hide();
|
||||
// alert('实名认证成功。');
|
||||
// } else {
|
||||
// alert('请正确填写姓名和身份证号码。');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function get_verify_res(){
|
||||
let data = {
|
||||
cookie:document.cookie
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://php-api.juip.com/api/test/aliGetResult',
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
beforeSend: function(xhr) {
|
||||
xhr.withCredentials = true;
|
||||
},
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == 10000) {
|
||||
clearInterval(t1);
|
||||
window.location.href='/User/Index';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cash_out() {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == -10000) {
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往用户主页实名认证。');
|
||||
alert('接主管部门要求,账号需要实名认证方可使用主要功能,请前往 电脑端 用户主页实名认证。');
|
||||
window.location.href="/User/Index";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@
|
||||
}
|
||||
.real-name {
|
||||
position: fixed;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
top: 20%;
|
||||
margin-left: -200px;
|
||||
margin-top: -160px;
|
||||
z-index: 3;
|
||||
@@ -237,7 +237,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="real-name">
|
||||
<form>
|
||||
<form id="id-cert">
|
||||
<p>接主管部门要求,注册账号需要实名认证方可使用主要功能,请仔细阅读</p>
|
||||
<p>1、为了你的帐号安全请勿使用他人手机号或身份信息</p>
|
||||
<p>2、平台保护隐私,未经法定程序其他个人和组织无法获取实名信息</p>
|
||||
@@ -256,6 +256,8 @@
|
||||
<button type="button" class="btn btn-danger quxiao" style="margin-left:20px;" onclick="$('.real-name').hide()">取消</button>
|
||||
</p>
|
||||
</form>
|
||||
<h3 id="verify-info" style="display:none;text-align: center;">请打开 支付宝 扫码进行认证认证</h3>
|
||||
<div id="qrcode"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -431,8 +433,39 @@
|
||||
<!-- 支付弹窗结束 -->
|
||||
|
||||
<div id="aliPayBox" style="display:none"></div>
|
||||
|
||||
<script type="text/javascript" src="https://static.runoob.com/assets/qrcode/qrcode.min.js"></script>
|
||||
<script>
|
||||
var t1 = null;
|
||||
|
||||
function ready( callback ) {
|
||||
// 如果jsbridge已经注入则直接调用
|
||||
if ( window.AlipayJSBridge ) {
|
||||
callback && callback ();
|
||||
} else {
|
||||
// 如果没有注入则监听注入的事件
|
||||
document . addEventListener ( 'AlipayJSBridgeReady' , callback , false );
|
||||
}
|
||||
}
|
||||
|
||||
// startBizService 接口仅在支付宝 10.0.15 及以上支持
|
||||
// 需要接入者自行做下版本兼容处理 !!
|
||||
function startAPVerify ( options , callback ) {
|
||||
AlipayJSBridge . call ( 'startBizService' , {
|
||||
name : 'open-certify' ,
|
||||
param : JSON . stringify ( options ),
|
||||
}, callback );
|
||||
}
|
||||
|
||||
/**
|
||||
* 唤起认证流程
|
||||
* 参数: certifyId、url 需要通过支付宝 openapi 开放平台网关接口获取
|
||||
* 详细说明可查看文档下方的参数说明
|
||||
**/
|
||||
// 需要确保在 AlipayJSBridge ready 之后才调用
|
||||
|
||||
|
||||
|
||||
|
||||
/** 表单序列化成json字符串的方法 */
|
||||
function form2JsonString(formId) {
|
||||
var paramArray = $('#' + formId).serializeArray();
|
||||
@@ -524,15 +557,88 @@
|
||||
alert("抱歉!请重新输入姓名!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
||||
if(reg.test(id_code) === false)
|
||||
{
|
||||
alert("身份证输入不合法");
|
||||
return false;
|
||||
}
|
||||
|
||||
let data = {
|
||||
cookie:document.cookie,
|
||||
id_code: id_code,
|
||||
name: name
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://php-api.juip.com/api/Realname/index',
|
||||
url: 'http://php-api.juip.com/api/test/aliverify',
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
beforeSend: function(xhr) {
|
||||
xhr.withCredentials = true;
|
||||
},
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == 20000) {
|
||||
alert('已经认证成功');
|
||||
window.location.href='/User/Index';
|
||||
return ;
|
||||
}
|
||||
if (res.Code == 10000) {
|
||||
$('#id-cert').hide();
|
||||
$('#verify-info').show();
|
||||
new QRCode(document.getElementById("qrcode"), {
|
||||
text: res.url,
|
||||
width : 550,
|
||||
height : 550
|
||||
});
|
||||
t1 = window.setInterval(get_verify_res,1500);
|
||||
|
||||
} else {
|
||||
alert('请正确填写姓名和身份证号码。');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// let data = {
|
||||
// cookie:document.cookie,
|
||||
// id_code: id_code,
|
||||
// name: name
|
||||
// }
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: 'http://php-api.juip.com/api/Realname/index',
|
||||
// dataType: "json",
|
||||
// contentType: "application/json",
|
||||
// data: JSON.stringify(data),
|
||||
// beforeSend: function(xhr) {
|
||||
// xhr.withCredentials = true;
|
||||
// },
|
||||
// crossDomain: true,
|
||||
// success: function (res) {
|
||||
// if (res.Code == 10000) {
|
||||
// $('.real-name').hide();
|
||||
// alert('实名认证成功。');
|
||||
// } else {
|
||||
// alert('请正确填写姓名和身份证号码。');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function get_verify_res(){
|
||||
let data = {
|
||||
cookie:document.cookie
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://php-api.juip.com/api/test/aliGetResult',
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
@@ -542,13 +648,11 @@
|
||||
crossDomain: true,
|
||||
success: function (res) {
|
||||
if (res.Code == 10000) {
|
||||
$('.real-name').hide();
|
||||
alert('实名认证成功。');
|
||||
} else {
|
||||
alert('请正确填写姓名和身份证号码。');
|
||||
clearInterval(t1);
|
||||
window.location.href='/User/Index';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cash_out() {
|
||||
|
||||
Reference in New Issue
Block a user