function logined(type){
try {
var url = frontAppContxtAddr +'member/logined?timestamp='
+ new Date().getTime();
loadJs(url, function() {
if (typeof result != 'undefined') {
if (result.IsLogin) {
$("#span_login").css("display","none");
if (result.ID == '0') {
$("#span_branchlogout").css("display", "");
$("#span_logout").css("display", "none");
$("#comment").css("display", "none");
$("#breanchaddfavorite").css("display", "none");
$(".login_branchusername").html(result.branchUserName);
} else {
if(result.manager==true){
$("#span_branchManage").css("display", "");
}
$("#span_branchlogout").css("display", "none");
$("#span_logout").css("display", "");
$("a.login_username").html(result.UserName);
}
}else{
$("#span_login").css("display","");
$("#span_logout").css("display", "none");
$("#span_branchlogout").css("display", "none");
}
} else {
$("#span_login").css("display", "");
$("#span_logout").css("display", "none");
$("#span_branchlogout").css("display", "none");
}
});
} catch (e) {
$SSO.autoLogin(frontAppContxtAddr+"ssologin?plat="+type);
}
}
var temp;
var bkID;
function checkPriv(bookID,contentId,type,url){
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;
if(result=='free'){
if(url=='1'){
//pdf下载
window.location.href = frontAppContxtAddr +"multimedia/download?ID="+contentId+"&siteid="+siteid+"&Type="+type;
}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{
//在线阅读
window.location.href =url;
}
}
}else if(result=='buy'){
if(status=='Y')
{
if(flag){
var dlg1 = new Dialog({
title : "温馨提示",
html : '
该资源需要支付
'+price+'元,请购买后阅读!
当前优惠活动:
'+description+'折扣:
'+percent+'立即购买>> ',
width: 320,
height: 180,
draggable: false
});
}else{
var dlg1 = new Dialog({
title : "温馨提示",
html : '该资源需要支付
'+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();
}
});
}