$(document).ready(function() { $(".onlogin .headnavbtn li.mywork").addClass("navcurrent"); $(".workmenu>ul>li:contains('需求')").addClass("nowLi"); loginStatus(); //判断个人是否登录 valUser(); var userid = $.cookie("userid"); var statusN=""; myDemandList(true, 1, 10); var sureOrg ='

请先确认您的所在机构:(建议填写正式全称)

'+ '

50字以内

'+ '

注:

1. 只能发布您所在机构的需求。

2. 当您在资料中变更了所在机构后,该需求将会自动关闭。

'; var seleTime = '

请设置需求的有效期:

'+ '
'+ ''+ ''+ ''+ ''+ '
'+ ''+ '
' $(".setTimeBlock").on("focus",".sureOrg",function(){ $(".msg-warning").show(); }).on("blur",".sureOrg",function(){ $(".msg-warning").hide(); }).on("keyup",".sureOrg",function(){ if($(this).val().length>0){ $(".setTimeBlock").find(".mb_btnOkpub").removeAttr("disabled"); }else{ $(".setTimeBlock").find(".mb_btnOkpub").attr("disabled",true) } }) $(".issueSpanBlock").on("click",".issueSpan",function(){ window.open("postDemand.html"); }); $("#myneedList").on("click",".delayThis",function(){//延期 var dataId=$(this).parents("li").find(".urlHref").attr("data-id"); $(".blackcover2").fadeIn(); var btnOk='' $(".mb_btnOk").remove(); $("#promotGt").prepend(btnOk); $(".modelContain").show(); $("body").addClass("modelOpen"); $(".mb-listR").remove(); $("#promotTh").append(seleTime);//时间选择器 var a = new Date(); var c = a.getFullYear() + "-" + (Number(a.getMonth()) + 1) + "-" + (Number(a.getDate()) + 1); $(".mb-listR .form_datetime").datetimepicker({ language: 'ch', format: 'yyyy-mm-dd', weekStart: 0, todayBtn: false, autoclose: 1, todayHighlight: 1, startView: 2, minView: 2, forceParse: 0, startDate: getNowFormatDate(), oflag: 1, startDate: c, }); $(".mb-listR .form_datetime").val(getNowFormatDate(1)); $(".mb_btnOkset").on("click", function() { var delayTime=$(".mb-listR .form_datetime .fColor").val(); $.ajax({ "url": "/ajax/demand/defer", "type": "POST", "async": true, "data":{ "id":dataId, "uid":userid, "day":st6This(delayTime) }, "success": function(data) { if(data.success && data.data) { $(".blackcover2").fadeOut(); $(".modelContain").hide(); $("body").removeClass("modelOpen"); myDemandList(true,1,10); } } }); }) }) $("#myneedList").on("click",".updateThis",function(){//修改 var dataId=$(this).parents("li").find(".urlHref").attr("data-id"); window.open("demandModify.html?demandId="+dataId) }) $("#myneedList").on("click",".overThis",function(){//完成 var dataId=$(this).parents("li").find(".urlHref").attr("data-id"); $.MsgBox.Confirm("提示", "确认该需求已解决?",function(){ $.ajax({ "url": "/ajax/demand/over", "type": "POST", "async": true, "data":{ "id":dataId, "uid":userid }, "success": function(data) { if(data.success && data.data) { console.log(data); $(".madiaEdit").remove(); myDemandList(true,1, 10); } } }); }); }) /*我的需求列表*/ function myDemandList(isbind, page, pageNum) { $.ajax({ url: "/ajax/demand/pq", type: "GET", timeout: 10000, dataType: "json", traditional:true, data: { "state": [0,1,2,3], "uid": userid, "pageNo": page, "pageSize": pageNum }, beforeSend: function() { $("#myneedList").append(''); }, success: function(data) { if(data.success) { $("#myneedList").html(""); var $info = data.data.data; console.log(data) if($info.length > 0){ for(var i = 0; i < $info.length; i++) { var liStr=$("
  • ").appendTo("#myneedList"); demandHtml($info[i],liStr); if($info[i].state==0 || $info[i].state==1){ liStr.find(".urlHref").attr("href","demandModify.html?demandId="+$info[i].id); }else{ liStr.find(".urlHref").attr("href","demandShow.html?demandId="+$info[i].id); } } if(isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / pageNum), current: data.data.pageNo, backFn: function(p) { $("#myneedList").html(""); myDemandList(false, p, 10); document.body.scrollTop = document.documentElement.scrollTop = 0; } }); } }else{ $("#myneedList").parent().find(".nodatabox").removeClass("displayNone") } } $(".loading").remove(); }, error: function() { } }) } function demandHtml($data,liStr) { var sowU=""; if($data.pageViews!=0){ sowU='
  • 浏览量 '+$data.pageViews+'
  • ' } var statusU=""; var dateGap = delayDay($data.invalidDay); if($data.state==1 && dateGap=="1"){ statusU='
  • 即将于 '+TimeTr($data.invalidDay)+' 过期
  • ' } if($data.state==0){ statusU='
  • 已于 '+TimeTr($data.invalidDay)+' 过期
  • ' }else if($data.state==2){ statusU='
  • 已于 '+TimeTr($data.modifyTime)+' 完成
  • ' }else if($data.state==3){ statusU='
  • 已于 '+TimeTr($data.modifyTime)+' 关闭
  • ' } var closStr='',pdRight=""; if($data.state==1 && dateGap=="0"){ pdRight="padding-right:170px"; closStr += '' }else if($data.state==0 || ($data.state==1 && dateGap=="1")){ pdRight="padding-right:260px"; closStr += '' } var strCon=''; strCon+='' strCon+='

    '+ $data.title +'

    ' strCon+='' strCon+='
    '+closStr $(strCon).appendTo(liStr); } //修改机构名称 function updateOrgName(newName){ $.ajax({ "url": "/ajax/professor/org", "type": "POST", "async": true, "data":{ "id":userid, "name":newName }, "success": function(data) { if(data.success && data.data) { console.log(data) $.MsgBox.Confirm("提示", "机构名称修改成功",function(){ location.href="postDemand.html"; }); $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain'); } } }); } function delayDay(startTime){ var dateToday = new Date(); var dateInvalid = new Date(); dateInvalid.setFullYear(parseInt(startTime.substring(0, 4))); dateInvalid.setMonth(parseInt(startTime.substring(4, 6)) - 1); dateInvalid.setDate(parseInt(startTime.substring(6, 8))); var dateGap = Math.abs(dateToday.getTime() - dateInvalid.getTime()); var ifDelay="0"; if(dateGap < 604800000){ ifDelay="1"; } return ifDelay; } function st6This(osr) { var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10) ; return tim; } })