﻿$(document).ready(function(){$(".ilist div").mouseover(function(){$(this).addClass("omo")});$(".ilist div").mouseout(function(){$(this).removeClass("omo")});$(".mblist").mouseover(function(){$(this).addClass("omo")});$(".mblist").mouseout(function(){$(this).removeClass("omo")})});var locationUrl='';var deleteId=0;function ViewClick(id){$.ajax({type:"POST",url:"/Members/Ajax/Templete.aspx",data:"TID="+id+"&act=v",success:function(){}})}function AddTemplete(id){showloading("正在处理...");$.ajax({type:"post",dataType:"html",url:"/Members/Ajax/Templete.aspx",data:"oper=add&id="+id+"",error:function(){hideloading();ymPrompt.errorInfo("读取数据有误,请稍候重试")},success:function(d){switch(d){case'Guest':hideloading();locationUrl='';ymPrompt.errorInfo({message:'您还没有登陆，请先登录'});$("#loginFm").click();break;case"NoVip":hideloading();locationUrl='/Members/TryTWorld.aspx';ymPrompt.errorInfo({message:'您还没有开通模板天下，巴比豆累计付费24元以上终身免费，新会员免费试用7天。',handler:handler});break;case"VipEnd":hideloading();locationUrl='/Members/TryTWorld.aspx';ymPrompt.errorInfo({message:'您的模板服务已经到期了，巴比豆累计付费24元以上终身免费。',handler:handler});break;case"Prevent":hideloading();ymPrompt.errorInfo({message:'您的账号可能因违规已被停用，请联系巴比豆客服人员。'});break;case'success':hideloading();locationUrl='';$("#btnSelect"+id).attr({disabled:"disabled"});$("#btnSelect"+id).val("使用中");ymPrompt.succeedInfo("添加模板成功！<br />请到【我的模板】中使用。");break;case'exist':hideloading();locationUrl='';$("#btnSelect"+id).attr({disabled:"disabled"});$("#btnSelect"+id).val("使用中");ymPrompt.errorInfo("该模板您已经在使用了");break;case'more':hideloading();locationUrl='';ymPrompt.errorInfo("您使用中的模板已经达到了20个，<Br />请您先删除一些未使用的模板。");break}}})}function preDeleteTemplete(id){deleteId=id}function viewTemplete(ids){showloading("正在处理...");$.ajax({type:"post",dataType:"html",url:"/Members/Ajax/Templete.aspx",data:"oper=view&id="+ids+"",error:function(){hideloading();ymPrompt.errorInfo("读取数据有误,请稍候重试")},success:function(d){hideloading();ymPrompt.win({message:d,width:758,height:580,msgCls:'myContent',title:'预览模板',allowRightMenu:true,allowSelect:true})}})}function getTempleteDesign(ids){showloading("正在处理...");$.ajax({type:"post",dataType:"html",url:"/Members/Ajax/Templete.aspx",data:"oper=view&id="+ids+"",error:function(){hideloading();ymPrompt.errorInfo("读取数据有误,请稍候重试")},success:function(d){hideloading();preCopy(d);ymPrompt.succeedInfo("操作成功！<br />模板已经成功复制到您的剪切板，<br />请粘贴到淘宝网宝贝描述中。")}})}function getTempleteCode(ids){showloading("正在处理...");$.ajax({type:"post",dataType:"html",url:"/Members/Ajax/Templete.aspx",data:"oper=view&id="+ids+"",error:function(){hideloading();ymPrompt.errorInfo("读取数据有误,请稍候重试")},success:function(d){hideloading();CopyCode(d);ymPrompt.succeedInfo("操作成功！<br />代码已经成功复制到您的剪切板，<br />请粘贴到淘宝网宝贝描述代码中。")}})}function CopyCode(A){clipboardData.setData("text",A)}function handler1(tp){if(tp=='ok'){showloading("正在处理...");$.ajax({type:"post",dataType:"html",url:"/Members/Ajax/Templete.aspx",data:"oper=del&id="+deleteId+"",error:function(){hideloading();ymPrompt.errorInfo("读取数据有误,请稍候重试")},success:function(d){switch(d){case'success':hideloading();$("#mbid"+deleteId+"").css("display","none");ymPrompt.succeedInfo("删除成功！");break;default:hideloading();ymPrompt.errorInfo({message:d});break}}})}}function handler(tp){if(tp=='ok'){okFn()}}function okFn(){top.location.href=locationUrl}