portal html css js resource

unPatentImport.js 5.4KB

    $(document).ready(function () { $(".onlogin .headnavbtn li.mywork").addClass("navcurrent"); $(".workmenu>ul>li:contains('成果')").addClass("nowLi"); loginStatus(); //判断个人是否登录 valUser(); var userid = $.cookie("userid"); var userName = $.cookie("userName"); /*资源列表查询*/ function getRecourceMe(n, isbind, num) { var resourceNameVa = $("#patentName").val(); var $info = {}; $info.pageSize = 10; if (resourceNameVa != "") { $info.key = resourceNameVa; } $info.pageNo = n; $info.status = 1; $info.id = userid $.ajax({ // 获取所有非专数据 "url": "/ajax/resResult/pq", "type": "GET", "success": function (data) { if (data.success) { $(".importUl").html(""); if (num == 1) { if (data.data.data.length == 0) { $("#noresource").removeClass("displayNone"); $(".noContip").text("没有需要导入的非专"); return; } else { $("#noresource").addClass("displayNone"); } } else { if (data.data.data.length == 0) { $("#noresource").removeClass("displayNone"); $(".noContip").text("没有符合该搜索条件的内容"); return; } else { $("#noresource").addClass("displayNone"); } } resourceHtml(data.data.data); if (isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / data.data.pageSize), current: data.data.pageNo, backFn: function (p) { getRecourceMe(p, false); document.body.scrollTop = document.documentElement.scrollTop = 0; } }); } } }, "data": $info, 'type': "get", 'error': function () { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); } getRecourceMe(1, true, 1); function resourceHtml($data) { //导入数据 for (var i = 0; i < $data.length; i++) { test($data[i]) } } function test($data) { //获取专家名称 $.ajax({ 'url': '/ajax/resResult/researcher', 'type': 'get', 'data': { id: $data.id }, success: function (res) { var arr = [] //研究者名 var dom = [] //判断导入的id for (var i = 0; i < res.data.length; i++) { arr.push(res.data[i].name) dom.push(res.data[i].professorId) } $.ajax({ //导入状态数据 'url': '/ajax/resResult/selectbyidandPid', 'data': { id: $data.id, pid: userid }, 'type': 'get', success: function (res) { console.log(res) var cc = res.data //状态值 [] if ($data.name) { //分隔数组[] oSpec = "研究者:" + arr.join(','); } // var cc = dom.join(',') var oT, oText, cs; if (cc.length != 0) { //判断状态如果长度不等于0证明已经导入 oT = "importSpan-3"; oText = "已导入"; cs = "auto" } else { oT = "importSpan-1"; oText = "导入"; cs = "pointer"; } var oString = '<li>' + '<a class="flexCenter">' + '<div class="madiaHead patentHead"></div>' + '<div class="madiaInfo">' + '<p class="h1Font ellipsisSty">' + $data.name + '</p>' + '<p class="h2Font ellipsisSty">' + oSpec + '</p>' + '<p class="h2Font ellipsisSty">应用领域:' + $data.subject + '</p>' + // '<p class="h2Font ellipsisSty">所属部门:' + $data.department + '</p>' + '<p class="h2Font ellipsisSty">' + '</p>' + '</div>' + '</a>' + '<div class="importBtn">' + '<span class="importResource ' + oT + '" data-id="' + $data.id + '" style="cursor:' + cs + '">' + oText + '</span>' + /*'<span class="importSpan-2">再次导入</span>' + '<span class="importSpan-3">已导入</span>' +*/ '</div>' + '</li>' var list = $(oString) $(".importUl").append(oString); console.log($data.orgId) if($data.orgId) { orgname($data.orgId,list) } } }) } }) } //所属机构 function orgname(par, $pa) { $.ajax({ "url": "ajax/org/" + par, "type": "GET", "success": function (data) { console.log(par) if (data.success) { $pa.find('.hu1').append('<li>所属机构:' + data.data.name+ '</li>') } }, "data": { "id": par }, dataType: "json", 'error': function () { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); } /*输入资源名称限制字数*/ $("#resouceName").bind({ keyup: function () { if ($(this).val().length > 30) { $(this).val($(this).val().substr(0, 30)); } } }); /*点击搜索*/ $(".searchSpan").click(function () { $(".tcdPageCode").remove(); $(".aboutRes").append('<div class="tcdPageCode"></div>'); getRecourceMe(1, true); }) /*导入资源*/ $(".importUl").on("click", ".importSpan-1", function () { var oF = $(this).attr("flag"); var $this = $(this); $.ajax({ "url": "/ajax/resResult/ass", "type": "POST", "success": function (data) { console.log(data) if (data.success) { if (data.data > 0) { $this.text("导入成功").addClass("importSpan-3").removeClass("importSpan-1").removeClass("importSpan-2").css("cursor", "auto"); } } }, "data": { id: $(this).attr("data-id"), // uid: userid, // author: userName, researcher: userid }, dataType: "json", 'error': function () { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); }); })