好友
阅读权限10
听众
最后登录1970-1-1
|
本帖最后由 sv8887 于 2019-10-17 21:55 编辑
请问吾爱里的大佬知道怎么弄
我看别人都跳转了
这里部分代码 可以该代码实现跳转吗
</div>
</div>
<div class="foot">
<div class="inner">
<div id="J_downloadInteraction" class="download-interaction download-interaction-opening">
<div class="inner-interaction">
<p class="download-opening">正在打开支付宝<span class="download-opening-1">.</span><span class="download-opening-2">.</span><span class="download-opening-3">.</span></p>
<p class="download-asking">如果没有打开支付宝,<a id="J_downloadBtn" href="javascript:;" onclick="openAli();">请点此重新唤起</a></p>
</div>
</div>
</div>
</div>
<script src="//cdn.staticfile.org/jquery/1.12.4/jquery.min.js"></script>
<script src="//cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var code_url = '<?php echo $code_url?>';
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
// 检查是否支付完成
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "getshop.php",
timeout: 10000, //ajax请求超时时间10s
data: {type: "wxpay", trade_no: "<?php echo $row['trade_no']?>"}, //post数据
success: function (data, textStatus) {
//从服务器得到数据,显示数据并继续查询
if (data.code == 1) {
if (confirm("您已支付完成,需要跳转到订单页面吗?")) {
window.location.href=data.backurl;
} else {
// 用户取消
}
}else{
setTimeout("loadmsg()", 4000);
}
},
//Ajax请求超时,继续查询
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus == "timeout") {
setTimeout("loadmsg()", 1000);
} else { //异常
setTimeout("loadmsg()", 4000);
}
}
});
}
window.onload = loadmsg();
</script>
<script>
if (typeof AlipayWallet !== 'object') {
AlipayWallet = {};
}
(function () {
var ua = navigator.userAgent.toLowerCase(),
locked = false,
domLoaded = document.readyState === 'complete',
delayToRun;
//alert(ua);
function customClickEvent() {
var clickEvt;
if (window.CustomEvent) {
clickEvt = new window.CustomEvent('click', {
canBubble: true,
cancelable: true
});
} else {
clickEvt = document.createEvent('Event');
clickEvt.initEvent('click', true, true);
}
return clickEvt;
}
function getAndroidVersion() {
var match = ua.match(/android\s([0-9\.]*)/);
return match ? match[1] : false;
}
var noIntentTest = /aliapp|360 aphone|weibo|windvane|ucbrowser|baidubrowser/.test(ua);
var hasIntentTest = /chrome|samsung/.test(ua);
var isAndroid = /android|adr/.test(ua) && !(/windows phone/.test(ua));
var canIntent = !noIntentTest && hasIntentTest && isAndroid;
var openInIfr = /weibo|m353/.test(ua);
var inWeibo = ua.indexOf('weibo') > -1;
if (ua.indexOf('m353') > -1 && !noIntentTest) {
canIntent = false;
}
// 是否在 webview
var inWebview = '';
if (inWebview) {
canIntent = false;
}
/**
* 打开钱包
* @@param {string} params 唤起钱包的参数设置('alipays://platformapi/startapp?'后面的值)
* @@param {boolean} jumpUrl 唤起钱包后,android下要跳转到的URL;
* 若传"default",则为https://d.alipay.com/i/index.htm?nojump=1#once
*/
AlipayWallet.open = function (params, jumpUrl) {
//alert(domLoaded);
//alert(canIntent);
//alert(ua.indexOf('360 aphone'));
if (!domLoaded && (ua.indexOf('360 aphone') > -1 || canIntent)) {
var arg = arguments;
delayToRun = function () {
AlipayWallet.open.apply(null, arg);
delayToRun = null;
};
return;
}
// 唤起锁定,避免重复唤起
if (locked) {
return;
}
locked = true;
var o;
// 参数容错
if (typeof params === 'object') {
o = params;
} else {
o = {
params: params,
jumpUrl: jumpUrl
};
}
// 参数容错
if (typeof o.params !== 'string') {
o.params = '';
}
if (typeof o.openAppStore !== 'boolean') {
o.openAppStore = true;
}
o.params = o.params || 'appId=20000001';
o.params = o.params + '';
o.params = o.params + '&_t=' + (new Date() - 0);
if (o.params.indexOf('startapp?') > -1) {
o.params = o.params.split('startapp?')[1];
} else if (o.params.indexOf('startApp?') > -1) {
o.params = o.params.split('startApp?')[1];
}
// 是否为RC环境
var isRc = '';
// 是否唤起re包
var isRe = '';
if (typeof o.isRe === 'undefined') {
o.isRe = !!isRe;
}
// 通过alipays协议唤起钱包
var schemePrefix;
if (ua.indexOf('mac os') > -1 && ua.indexOf('mobile') > -1) {
// IOS RC包前缀为 alipaysrc
if (isRc) {
if (o.isRe) {
schemePrefix = 'alipayrerc';
} else {
schemePrefix = 'alipaysrc';
}
}
}
if (!schemePrefix && o.isRe) {
schemePrefix = 'alipayre';
}
schemePrefix = schemePrefix || 'alipays';
// 由于历史原因,对 alipayqr 前缀做特殊处理
if (location.href.indexOf('scheme=alipayqr') > -1) {
schemePrefix = 'alipayqr';
isRc = false;
}
if (!canIntent) {
var alipaysUrl = schemePrefix + '://platformapi/startapp?' + o.params;
if (ua.indexOf('qq/') > -1 || (ua.indexOf('safari') > -1 && (ua.indexOf('os 9_') > -1 || ua.indexOf('os 10_') > -1))) {
var openSchemeLink = document.getElementById('openSchemeLink');
if (!openSchemeLink) {
openSchemeLink = document.createElement('a');
openSchemeLink.id = 'openSchemeLink';
openSchemeLink.style.display = 'none';
document.body.appendChild(openSchemeLink);
}
openSchemeLink.href = alipaysUrl;
// 执行click
openSchemeLink.dispatchEvent(customClickEvent());
} else {
var ifr = document.createElement('iframe');
ifr.src = alipaysUrl;
ifr.style.display = 'none';
document.body.appendChild(ifr);
}
} else {
// android 下 chrome 浏览器通过 intent 协议唤起钱包
var packageKey = 'AlipayGphone';
if (isRc) {
packageKey = 'AlipayGphoneRC';
}
var intentUrl = 'intent://platformapi/startapp?' + o.params + '#Intent;scheme=' + schemePrefix + ';package=com.eg.android.' + packageKey + ';end';
var openIntentLink = document.getElementById('openIntentLink');
if (!openIntentLink) {
openIntentLink = document.createElement('a');
openIntentLink.id = 'openIntentLink';
openIntentLink.style.display = 'none';
document.body.appendChild(openIntentLink);
}
openIntentLink.href = intentUrl;
// 执行click
openIntentLink.dispatchEvent(customClickEvent());
}
// 延迟移除用来唤起钱包的IFRAME并跳转到下载页
setTimeout(function () {
if (typeof o.jumpUrl !== 'string') {
o.jumpUrl = '';
}
// URL白名单
var urlPattern = /^http(s)?:\/\/([a-z0-9_\-]+\.)*(alipay|taobao|alibaba|alibaba-inc|tmall|koubei)\.(com|net|cn|com\.cn)(:\d+)?([/;?].*)?$/;
// 默认跳转地址
if (o.jumpUrl === 'default') {
o.jumpUrl = 'https://ds.alipay.com/?nojump=true';
}
if (o.jumpUrl && typeof o.jumpUrl === 'string' && urlPattern.test(o.jumpUrl)) {
location.href = o.jumpUrl;
}
}, 1000)
// 唤起加锁,避免短时间内被重复唤起
setTimeout(function () {
locked = false;
}, 2500)
}
if (!domLoaded) {
document.addEventListener('DOMContentLoaded', function () {
domLoaded = true;
if (typeof delayToRun === 'function') {
delayToRun();
}
}, false);
}
})();
</script>
<script type="text/javascript">
(function () {
var schemeParam = 'saId=10000007&clientVersion=3.7.0.0718&qrcode='+code_url+'?_s=web-other';
schemeParam = schemeParam.replace(/&/ig, '&');
if (!location.hash) {
AlipayWallet.open({
params: schemeParam,
jumpUrl: '',
openAppStore: false
});
}
function pageFuntion() {
var interactionNode = document.getElementById('J_downloadInteraction');
setTimeout(function () {
interactionNode.className = "download-interaction download-interaction-asking";
}, 3000);
}
if (/complete|loaded|interactive/.test(document.readyState && document.body)) {
pageFuntion();
} else {
document.addEventListener('DOMContentLoaded', function () {
pageFuntion();
}, true);
}
})();
function openAli()
{
var schemeParam = 'saId=10000007&clientVersion=3.7.0.0718&qrcode='+code_url+'?_s=web-other';
schemeParam = schemeParam.replace(/&/ig, '&');
if (!location.hash) {
AlipayWallet.open({
params: schemeParam,
jumpUrl: '',
openAppStore: false
});
}
}
</script>
</body>
</html> |
-
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|