123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- $(document).ready(function(){
- $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
- loginStatus();
- var userid = $.cookie("userid");
- var resourceId;
-
- function getRecourceMe(n,isbind) {
- var resourceNameVa=$("#resouceName").val();
- var $info={};
- $info.professorId=userid;
- $info.pageSize=10;
- if(resourceNameVa !="") {
- $info.key=resourceNameVa;
- }
- $info.pageNo=n;
- $.ajax({
- "url": "/ajax/resTmp/pq",
- "type": "GET",
- "success": function(data) {
- console.log(data)
- if(data.success) {
- $(".importUl").html("");
- if(data.data.data.length==0) {
- $("#noresource").removeClass("displayNone");
- 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);
- }
- });
- }
- }
- },
- "data": $info,
- dataType: "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
- getRecourceMe(1,true);
- function resourceHtml($data) {
- for(var i = 0; i < $data.length; i++) {
- var imgSrc = "../images/default-resource.jpg";
- var oSpec="",orgName="",domain="";
- if($data[i].img) {
- imgSrc = "/data/resource/" + $data[i].img;
- }
- if($data[i].spec) {
- oSpec="厂商型号:"+$data[i].spec
- }
- if($data[i].orgName) {
- orgName="所属机构:"+$data[i].orgName;
- }
- if($data[i].domain) {
- domain="关键词:"+$data[i].domain;
- }
- var oString = '<li>' +
- '<a class="flexCenter">' +
- '<div class="madiaHead resouseHead" style="background-image: url('+imgSrc+');"></div>' +
- '<div class="madiaInfo">' +
- '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>' +
- '<p class="h2Font ellipsisSty">'+oSpec+'</p>' +
- '<p class="h2Font ellipsisSty">'+orgName+'</p>' +
- '<p class="h2Font ellipsisSty">'+domain+'</p>' +
- '</div>' +
- '</a>' +
- '<div class="importBtn">' +
- '<span class="importSpan-1">导入</span>' +
- '<span class="importSpan-2">重新导入</span>' +
- '<span class="importSpan-3">已导入</span>' +
- '</div>' +
- '</li>'
- $(".importUl").append(oString);
- }
- }
-
- $("#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);
- })
- })
|