好友
阅读权限25
听众
最后登录1970-1-1
|
我用4.9的这个替换了还是下载不了
// widget
function widget_ri(){
'use strict';
// 文章购买按钮 go-pay
$(".click-pay").on("click",function(){
var _this = $(this)
var deft = _this.html()
var post_id = $(this).data("postid")
var nonce = $(this).data("nonce")
var price = $(this).data("price")
_this.html(iconspin+deft)
Swal.fire({
// title: '购买确认',
text: "购买此资源将消耗【"+price+"】",
type: 'question',
showCancelButton: true,
confirmButtonText: '购买',
cancelButtonText: '取消',
reverseButtons: true,
onClose: () => {
_this.html(deft)
}
}).then((result) => {
if (result.value) {
// 开始请求
Swal.fire({
allowOutsideClick:false,
width: 200,
timer: 60000,
onBeforeOpen: () => {
Swal.showLoading()
$.post(caozhuti.ajaxurl, {
"action": "add_pay_post",
"post_id": post_id,
"nonce": nonce
}, function(data) {
if (data.status == 1) {
Swal.fire({
title: data.msg,
type: 'success',
}).then((result) => {
if (result.value) {
location.reload()
}
})
}else{
Swal.fire({
type: 'warning',
html: data.msg,
})
// Swal.fire('',data.msg,'error')
}
});
},
})
}
})
});
//下载文件
$(".go-down").one("click",function(){
var _this = $(this);
var deft = _this.html()
var deftext = _this.text()
var post_id = _this.data("id")
//tanchuang
_this.html(iconspin+deftext)
Swal.fire({
allowOutsideClick:false,
width: 200,
timer: 60000,
onBeforeOpen: () => {
Swal.showLoading()
$.post(caozhuti.ajaxurl, {
"action": "user_down_ajax",
"post_id": post_id
}, function(data) {
if (data.status == 1) {
_this.html(deft)
Swal.fire({
title: '下载地址获取成功',
// text: "点击立即下载跳转到下载页面",
type: 'success',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '立即下载',
cancelButtonText: '关闭',
}).then((result) => {
if (result.value) {
window.open(data.msg)
location.reload()
}else{
location.reload()
}
})
}else{
_this.html(deft)
Swal.fire({
type: 'warning',
html: data.msg,
}).then((result) => {
location.reload()
})
}
});
},
})
});
} |
|