function logined(type){
try {
var url = frontAppContxtAddr +'member/logined?timestamp='
+ new Date().getTime();
loadJs(url, function() {
if (typeof result != 'undefined') {
if (result.IsLogin==false) {
$SSO.autoLogin(frontAppContxtAddr+"ssologin?plat="+type);
}
} else {
$SSO.autoLogin(frontAppContxtAddr+"ssologin?plat="+type);
}
});
} catch (e) {
$SSO.autoLogin(frontAppContxtAddr+"ssologin?plat="+type);
}
}
var temp;
var bkID;
function checkPriv(bookID,contentId,type,url, title){
bkID = bookID;
var dc={"contentId":contentId,"contentType":type,"siteId":shopSiteID,"memberid":memberid};
var name="literature";
var price;
var status;
crossdLoad(uri,dc,function(data){
price = data.price;
status = data.status;
var description = data.description;
var percent = data.percent;
var flag = data.flag;
dc.siteId = siteid;
Server.sendRequest("CommonPriv.checkMemberPriv",dc,function(response){
var result = response.result;
var imgCount=response.ImgCount;
if(result=='free' || result=='free_limited'){
if (url == '1') {
//pdf下载
if (result == 'free_limited') {
Server.sendRequest("CommonPriv.checkMemberDownloadPriv", dc, function (response) {
result = response.result;
if (result == 'free') {
name = encodeURI(name);
name = encodeURI(name);
//pdf下载
setTimeout(function () {
window.location.href = frontAppContxtAddr + "multimedia/download?ID=" + contentId + "&siteid=" + siteid + "&Type=" + type;
}, 100);
} else if (result == 'buy') {
var diag = new Dialog({
title: "温馨提示",
html: '
此资源在线阅读、原版阅读可享免费,是否继续付费下载?
',
width: 320,
height: 80,
draggable: false,
});
diag.addButton("b1", "否", function () {
diag.close();
});
diag.addButton("b", "是", function () {
diag.close();
if (status == 'Y') {
if (flag) {
var dlg1 = new Dialog({
title: "温馨提示",
html: typeof (imgCount) != "undefined" ? '该资源需要支付
' + price + '元,请购买后阅读!(共' + imgCount + '张图片)
当前优惠活动:
' + description + '折扣:
' + percent + '立即购买>> '
: '该资源需要支付
' + price + '元,请购买后阅读!
当前优惠活动:
' + description + '折扣:
' + percent + '立即购买>> ',
width: 320,
height: 180,
draggable: false
});
} else {
var dlg1 = new Dialog({
title: "温馨提示",
html: typeof (imgCount) != "undefined" ? '该资源需要支付
' + price + '元,请购买后阅读!(共' + imgCount + '张图片)
立即购买>> '
: '该资源需要支付
' + price + '元,请购买后阅读!
立即购买>> ',
width: 320,
height: 180,
draggable: false
});
}
} else {
var dlg1 = new Dialog({
title: "温馨提示",
html: '该资源已下线
',
width: 320,
height: 180,
draggable: false
});
}
dlg1.show();
});
diag.show();
}
});
}
}else if(url=='2'){
//原版阅读
window.open(frontAppContxtAddr+"ultimedia/OnlineRead?ID="+contentId+"&siteid="+siteid+"&Type="+type,'_blank');
//window.location.href = "${Site.FrontAppContxtAddr}multimedia/OnlineRead?ID="+contentId+"&siteid=${Site.ID}&Type="+type;
}else{
if(type=='literature'){
window.location.href =frontAppContxtAddr + "databasedetail?bookID="+bookID+"&SiteID="+siteid+"&contentId="+contentId+"&contentType=literature&type="+name;
}else if(type=='ManuScript'){
window.location.href =frontAppContxtAddr + "manuscript/detail?SiteID="+siteid+"&MID="+contentId;
}else{
//在线阅读
window.location.href =url;
}
}
}else if(result=='buy'){
if(status=='Y')
{
if(flag){
var dlg1 = new Dialog({
title : "温馨提示",
html : typeof(imgCount) != "undefined"?'该资源需要支付
'+price+'元,请购买后阅读!(共'+imgCount+'张图片)
当前优惠活动:
'+description+'折扣:
'+percent+'立即购买>> '
: '该资源需要支付
'+price+'元,请购买后阅读!
当前优惠活动:
'+description+'折扣:
'+percent+'立即购买>> ',
width: 320,
height: 180,
draggable: false
});
}else{
var dlg1 = new Dialog({
title : "温馨提示",
html : typeof(imgCount) != "undefined"?'该资源需要支付
'+price+'元,请购买后阅读!(共'+imgCount+'张图片)
立即购买>> '
: '该资源需要支付
'+price+'元,请购买后阅读!
立即购买>> ',
width: 320,
height: 180,
draggable: false
});
}
}else{
var dlg1 = new Dialog({
title : "温馨提示",
html : '该资源已下线
',
width: 320,
height: 180,
draggable: false
});
}
dlg1.show();
}else if(result=='branchNo'){
var dlg2 = new Dialog({
title : "温馨提示",
html : '您所在的机构无该资源使用权限,
请切换为个人用户查看或购买!
',
width: 320,
height: 180,
draggable: false
});
dlg2.show();
}else if(result=='order'){
var dlg = new Dialog({
title : "温馨提示",
html : '',
width: 320,
height: 180,
draggable: false
});
dlg.show();
}else{
var dlg3 = new Dialog({
title : "温馨提示",
html : '',
width: 320,
height: 180,
draggable: false
});
dlg3.show();
}
});
});
}
function checkAccount(contentId,type,dealType,siteId,goodsAmount,url){
Dialog.Manager.closeAll();
var dc = new DataCollection();
dc.add("contentId",contentId);
dc.add("contentType",type);
dc.add("siteId",siteId);
var name="报告";
Server.sendRequest("CommonPriv.checkAccount",dc,function(response){
var result = response.result;
var productId = response.productId;
if(result=='free'){
if(url=='1'){
//pdf下载
window.location.href = frontAppContxtAddr+ "multimedia/download?ID="+contentId+"&siteid="+siteId+"&Type="+type;
}else if(url=='2'){
//原版阅读
window.location.href =frontAppContxtAddr+ "multimedia/OnlineRead?ID="+contentId+"&siteid="+siteId+"&Type="+type;
}else{
window.location.href =url;
}
//window.location.href = "${Site.FrontAppContxtAddr}book/initChapterDetail?siteId=${Site.ID}&contentId="+contentId+"&contentType="+type;
}else if(result=='yes'){
var json=response.list;
var obj = jQuery.parseJSON(json);
var data = obj.data;
if(data.length>=1){
var accountTypeHtml = "";
var dlg4 = new Dialog({
title : "请选择支付账户",
html: accountTypeHtml,
width: 320,
height: 180,
draggable: false
});
dlg4.show();
}else{
var accountType = obj.data[0].accountType;
if(accountType==''){
Dialog.Manager.closeAll();
var dlg = new Dialog({
title : "温馨提示",
html:'网络错误,请刷新重试
',
//html:'购买失败,请稍后重试!',
width: 320,
height: 180,
draggable: false
});
dlg.show();
}else{
orderSubmit(productId,type,dealType,siteId,goodsAmount,contentId,accountType,url);
}
}
}else{
orderSubmit(productId,type,dealType,siteId,goodsAmount,contentId,null,url);
}
});
}
//productId,type,dealType,siteId,goodsAmount,contentId
function checkAccountType(productId,type,dealType,siteId,goodsAmount,contentId,url){
var accountType = $("input[name='accountType']:checked").val();
if(typeof(accountType) == "undefined"){
var dlg = new Dialog({
title : "温馨提示",
html:'请选择支付方式
',
//html:'购买失败,请稍后重试!',
width: 240,
height: 140,
draggable: false
});
dlg.show();
return;
}else{
orderSubmit(productId,type,dealType,siteId,goodsAmount,contentId,accountType,url);
}
}
function orderSubmit(productId,type,dealType,siteId,goodsAmount,contentId,accountType,url){
var dc = new DataCollection();
dc.add("ProductID",productId);
dc.add("SiteID",siteId);
dc.add("GoodsDealType",dealType);
dc.add("GoodsAmount",goodsAmount);
dc.add("count",1);
dc.add("contentType",type);
dc.add("accountType",accountType);
if(accountType!=null){
dc.add("IsUserAccount","Y");
}else{
dc.add("IsUserAccount","N");
}
Server.sendRequest("order/ordersubmit3",dc,function(data1){
var result = data1.result;
if(result=='ok'){
if(url=='1'){
//pdf下载
window.location.href = frontAppContxtAddr + "multimedia/download?ID="+id+"&siteid="+siteId+"&Type="+type;
}else if(url=='2'){
//原版阅读
window.location.href = frontAppContxtAddr + "multimedia/OnlineRead?ID="+contentId+"&siteid="+siteId+"&Type="+type;
}else{
if(type=='literature'){
window.location.href =frontAppContxtAddr + "databasedetail?bookID="+bkID+"&SiteID="+siteid+"&contentId="+contentId+"&contentType=literature&type="+name;
}else{
//在线阅读
window.location.href =url;
}
}
//window.location.href = "${Site.FrontAppContxtAddr}book/initChapterDetail?siteId=${Site.ID}&contentId="+contentId+"&contentType="+type;
}else if(result=='submit'){
var dlg = new Dialog({
title : "温馨提示",
html:'',
//html:'购买失败,请稍后重试!',
width: 320,
height: 180,
draggable: false
});
dlg.show();
}else{
var dlg = new Dialog({
title : "温馨提示",
html:'购买失败请刷新重试
',
//html:'购买失败,请稍后重试!',
width: 320,
height: 180,
draggable: false
});
dlg.show();
}
});
}