DingChangSheng 4 gadi atpakaļ
vecāks
revīzija
3e3d67c7e8
2 mainītis faili ar 204 papildinājumiem un 238 dzēšanām
  1. 203 237
      src/web/staticres/js/index_content.js
  2. 1 1
      src/web/templates/common/pchead.html

+ 203 - 237
src/web/staticres/js/index_content.js

@@ -1,4 +1,8 @@
 var req_base = 'http://192.168.20.64:8081/';
+if(location.origin.indexOf('jianyu360.com') > 0 ){
+  req_base = location.origin + '/';
+}
+
 
 function changeHorse(timp) {
   return Math.floor(timp / 1000 / 60 / 60)
@@ -25,260 +29,222 @@ $(function () {
   });
  }
 
- function jyAreaDemo(result,index){
-  var str = ""
-  
-  var data = result.data
-  var keys = Object.keys(data)
-  var values = Object.values(data)
-  if(index == 1){
-    var firstStr = "<li class='zxs'>"
-    var endStr = ''
-    values.forEach(function(v,i){
-      if(v.length > 1){
-        endStr += `<li><strong>${keys[i]}</strong><div>`
-          v.forEach(function(el){
-            endStr += `<span><a href="${el.url}" target="_blank">${el.city}</a></span>`
-          })          
-          endStr += `</div></li>`
-      }else{
-        console.log('----v----',v);
-        firstStr += `<a href="${v[0].url}">${v[0].city}</a>`
+ function jyAreaDemo(result, index) {
+  var str = "";
+
+  var data = result.data;
+  var keys = Object.keys(data);
+  var values = Object.values(data);
+  if (index == 1) {
+    var firstStr = "<li class='zxs'>";
+    var endStr = '';
+    values.forEach(function (v, i) {
+      if (v.length > 1) {
+        endStr += "<li><strong>" + keys[i] + "</strong><div>";
+        v.forEach(function (el) {
+          endStr += "<span><a href=\"" + el.url + "\" target=\"_blank\">" + el.city + "</a></span>";
+        });
+        endStr += "</div></li>";
+      } else {
+        console.log('----v----', v);
+        firstStr += "<a href=\"" + v[0].url + "\">" + v[0].city + "</a>";
       }
-    })
-    firstStr += `</li>`
-    str = firstStr + endStr
+    });
+    firstStr += "</li>";
+    str = firstStr + endStr;
   }
- 
-  if(index == 2){
-    values.forEach(function(v,i){
-      if(v.length > 1){
-          str += ` <li><strong>${keys[i]}</strong><div>`
-          v.forEach(function(el){
-            str += `<span><a href="${el.url}" target="_blank">${el.key}</a></span>`
-          })          
-          str += `</div></li>`
-      }else{
-        str += `<li><strong><a href="${v[0].url}">${keys[i]}</a></strong></li>`
-     }
-    })
+
+  if (index == 2) {
+    values.forEach(function (v, i) {
+      if (v.length > 1) {
+        str += " <li><strong>" + keys[i] + "</strong><div>";
+        v.forEach(function (el) {
+          str += "<span><a href=\"" + el.url + "\" target=\"_blank\">" + el.key + "</a></span>";
+        });
+        str += "</div></li>";
+      } else {
+        str += "<li><strong><a href=\"" + v[0].url + "\">" + keys[i] + "</a></strong></li>";
+      }
+    });
   }
-  if(index == 3){
-    values.forEach(function(v,i){
-      if(v.length > 1){
-          str += ` <li><strong>${keys[i]}</strong><div>`
-          v.forEach(function(el){
-            str += `<span><a href="${el.url}" target="_blank">${el.key}</a></span>`
-          })          
-          str += `</div></li>`
-      }else{
-        str += `<li><strong><a href="${v[0].url}">${keys[i]}</a></strong></li>`
-     }
-    })
+  if (index == 3) {
+    values.forEach(function (v, i) {
+      if (v.length > 1) {
+        str += " <li><strong>" + keys[i] + "</strong><div>";
+        v.forEach(function (el) {
+          str += "<span><a href=\"" + el.url + "\" target=\"_blank\">" + el.key + "</a></span>";
+        });
+        str += "</div></li>";
+      } else {
+        str += "<li><strong><a href=\"" + v[0].url + "\">" + keys[i] + "</a></strong></li>";
+      }
+    });
   }
   var i = index - 1;
-  $(".jy-area .tab-content .tab-content-area").eq(i).find('ul').html(str)
- }
+  $(".jy-area .tab-content .tab-content-area").eq(i).find('ul').html(str);
+}
 
- getjyArea(1)
-$(".jy-area .tab-header span").on('click',function(){
-  $(".jy-area .tab-header span").removeClass('active')
-  $(this).addClass('active')
-  let i = $(this).index();
-  getjyArea(i+1)
+getjyArea(1);
+$(".jy-area .tab-header span").on('click', function () {
+  $(".jy-area .tab-header span").removeClass('active');
+  $(this).addClass('active');
+  var i = $(this).index();
+  getjyArea(i + 1);
   $(this).parent().find('i').animate({
-    left: 170+(400*i) +'px'
-  },200)
-  $("#index .jy-area .tab-content .tab-content-area").hide()
-  $("#index .jy-area .tab-content .tab-content-area").eq(i).show(300)
-})
-
-
-
-  // 最新公告
-  function getNewNotice(typ) {
-    $.ajax({
-      type: "POST",
-      url: req_base + 'newArticle',
-      data: {typ},
-      success: function (result) {
-        let str = ""
-        result.list.forEach(function (el, i) {
-          let times = changeHorse(el.publishtime)
-          let itemStr = `<li><a href=" /article/indexcontent/${el._id}.html" target="_blank">
-                            <p>${el.title}</p>
-                            <div>`
-          if (el.subtype) {
-            itemStr += `<span class="light">${el.subtype}</span>`
-          }
-          if (el.buyerclass) {
-            itemStr += `<span>${el.buyerclass}</span>`
-          }
-          if (el.industry) {
-            itemStr += `<span>${el.industry}</span>`
-          }
-          if (el.area) {
-            itemStr += `<span>${el.area}</span>`
-          }
-          if (el.city) {
-            itemStr += `<span>${el.city}</span>`
-          }
-          if(el.butget){
-            itemStr += `<span>${el.butget}</span>`
+    left: 170 + 400 * i + 'px'
+  }, 200);
+  $("#index .jy-area .tab-content .tab-content-area").hide();
+  $("#index .jy-area .tab-content .tab-content-area").eq(i).show(300);
+});
+
+// 最新公告
+function getNewNotice(typ) {
+  $.ajax({
+    type: "POST",
+    url: req_base + 'newArticle',
+    data: { typ: typ },
+    success: function success(result) {
+      var str = "";
+      result.list.forEach(function (el, i) {
+        var times = changeHorse(el.publishtime);
+        var itemStr = "<li><a href=\" /article/indexcontent/" + el._id + ".html\" target=\"_blank\">\n                            <p>" + el.title + "</p>\n                            <div>";
+        if (el.subtype) {
+          itemStr += "<span class=\"light\">" + el.subtype + "</span>";
+        }
+        if (el.buyerclass) {
+          itemStr += "<span>" + el.buyerclass + "</span>";
+        }
+        if (el.industry) {
+          itemStr += "<span>" + el.industry + "</span>";
+        }
+        if (el.area) {
+          itemStr += "<span>" + el.area + "</span>";
+        }
+        if (el.city) {
+          itemStr += "<span>" + el.city + "</span>";
+        }
+        if (el.butget) {
+          itemStr += "<span>" + el.butget + "</span>";
+        }
+        if (el.publishtime) {
+          itemStr += "<strong>" + times + "小时</strong>";
+        }
+        itemStr += "</div></a></li>";
+        str += itemStr;
+      });
+      var i = typ - 1;
+      $(".newNotice .tab-content-list").eq(i).find('ul').html(str);
+    },
+    error: function error(e) {
+      console.log('数据错误');
+    }
+  });
+}
+getNewNotice(1);
+//最新公告信息
+$(".newNotice .newNotice-header span").on('click', function () {
+
+  $(".newNotice .newNotice-header span").removeClass('active');
+  $(this).addClass('active');
+  var i = $(this).index();
+  getNewNotice(i + 1);
+  $(this).parent().find('i').animate({
+    left: 120 + 300 * i + 'px'
+  }, 200);
+  $("#index .newNotice .newNotice-content .tab-content-list").hide();
+  $("#index .newNotice .newNotice-content .tab-content-list").eq(i).show(300);
+});
+
+// 最新资讯
+function getNewLatest() {
+  $.ajax({
+    type: "POST",
+    url: req_base + 'newBlog',
+    data: "",
+    success: function success(result) {
+      console.log('----result.data----', result.data);
+
+      var str = "",
+          str1 = '<li class="newLatest-content-bottom">';
+      result.data.forEach(function (el, i) {
+        var times = el.l_createdate.split('-');
+        if (i < 3) {
+          if (i == 2) {
+            str += "<li class=\"newLatest-content-right\">";
+          } else {
+            str += "<li>";
           }
-          if (el.publishtime) {
-            itemStr += `<strong>${times}小时</strong>`
+          str += "<a href=\"/jyblog/" + el.id + ".html\">\n                      <div class=\"date\"><i>" + times[1] + "</i>/<span>" + times[2] + "</span></div>";
+          if (el.s_pic1) {
+            str += "<img src=\"" + el.s_pic1 + "\" />";
+          } else {
+            str += "<img src=\"" + el.s_pic + "\" />";
           }
-          itemStr += `</div></a></li>`
-          str += itemStr
-        })
-        let i = typ-1
-        $(".newNotice .tab-content-list").eq(i).find('ul').html(str)
-      },
-      error: function (e) {
-        console.log('数据错误');
-      }
-    });
-  }
-  getNewNotice(1)
-  //最新公告信息
-  $(".newNotice .newNotice-header span").on('click', function () {
-
-    $(".newNotice .newNotice-header span").removeClass('active')
-    $(this).addClass('active')
-    let i = $(this).index();
-    getNewNotice(i+1)
-    $(this).parent().find('i').animate({
-      left: 120 + (300 * i) + 'px'
-    }, 200)
-    $("#index .newNotice .newNotice-content .tab-content-list").hide()
-    $("#index .newNotice .newNotice-content .tab-content-list").eq(i).show(300)
-  })
-
-
-
+          str += "<div class=\"item-content\">\n                  <h4>" + el.s_title + "</h4>\n                  <p>" + el.s_content + "</p>\n                  <div class=\"newLatest-tips\">\n                    <span>" + el.s_author + "</span>\n                    <span>" + el.l_createdate + "</span>\n                  </div>\n                </div>\n              </a>\n            </li>";
+        } else {
+          str1 += "<a href=\"/jyblog/" + el.id + ".html\">\n              <div class=\"dates\"><i>" + times[1] + "</i>/<span>" + times[2] + "</span></div>\n              <div class=\"item-content\">\n                <h4>" + el.s_title + "</h4>\n                <p>" + el.s_content + "</p>\n               </div>\n              </a>";
+        }
+      });
+      str += str1 + "</li>";
+      $(".newLatest .newLatest-content ul").html(str);
+    },
+    error: function error(e) {
+      console.log('数据错误');
+    }
+  });
+}
 
-   // 最新资讯
-   function getNewLatest(){
-    $.ajax({
-      type: "POST",
-      url: req_base + 'newBlog',
-      data: "",
-      success: function (result) {
-        console.log('----result.data----',result.data);
-        
-        var str = "",str1 = '<li class="newLatest-content-bottom">'
-        result.data.forEach(function(el,i){
-           var times = el.l_createdate.split('-')
-           if(i<3){
-            if(i == 2){
-              str += `<li class="newLatest-content-right">`
-            }else{
-              str += `<li>`
-            }
-            str += `<a href="/jyblog/${el.id}.html">
-                      <div class="date"><i>${times[1]}</i>/<span>${times[2]}</span></div>`
-            if(el.s_pic1){
-              str += `<img src="${el.s_pic1}" />`
-            }else{
-              str += `<img src="${el.s_pic}" />`
-            }
-            str += `<div class="item-content">
-                  <h4>${el.s_title}</h4>
-                  <p>${el.s_content}</p>
-                  <div class="newLatest-tips">
-                    <span>${el.s_author	}</span>
-                    <span>${el.l_createdate}</span>
-                  </div>
-                </div>
-              </a>
-            </li>`
-           }else{
-              str1 += `<a href="/jyblog/${el.id}.html">
-              <div class="dates"><i>${times[1]}</i>/<span>${times[2]}</span></div>
-              <div class="item-content">
-                <h4>${el.s_title}</h4>
-                <p>${el.s_content}</p>
-               </div>
-              </a>`
-           }
-        })
-        str += str1 + "</li>"
-        $(".newLatest .newLatest-content ul").html(str,)
-      },
-      error: function (e) {
-        console.log('数据错误');
-      }
-    });
-   }
+getNewLatest();
 
-   getNewLatest()
+var onlineData_arr = [];
+// 推送信息条数
+function getOnlineData() {
+  $.ajax({
+    type: "POST",
+    url: req_base + 'front/index',
+    data: "",
+    success: function success(result) {
+      var str = "";
+      str += "<li>\n            <h4>自上线以来</h4>\n            <p>剑鱼标讯为用户成功推送了信息</p>\n            <strong><mark id=\"flip-number-1\">" + toThousands(result.i_bidall) + "</mark> <i>条</i></strong>\n          </li>\n          <li>\n          <h4>最近三十天</h4>\n          <p>剑鱼标讯从" + result.i_site + "个招标网站收录了</p>\n          <strong><mark id=\"flip-number-2\">" + toThousands(result.i_bidmonth) + " </mark><i>条</i></strong>\n        </li>\n        <li>\n          <h4>今天</h4>\n          <p>剑鱼标讯成功为用户推送了信息</p>\n          <strong><mark id=\"flip-number-3\">" + toThousands(result.i_bidtoday) + " </mark><i>条</i></strong>\n        </li>";
 
+      $(".jy-onlineData ul").html(str);
 
- var onlineData_arr = []
-  // 推送信息条数
-  function getOnlineData() {
-    $.ajax({
-      type: "POST",
-      url: req_base + 'front/index',
-      data: "",
-      success: function (result) {
-        var str = ""
-        str += `<li>
-            <h4>自上线以来</h4>
-            <p>剑鱼标讯为用户成功推送了信息</p>
-            <strong><mark id="flip-number-1">${toThousands(result.i_bidall)}</mark> <i>条</i></strong>
-          </li>
-          <li>
-          <h4>最近三十天</h4>
-          <p>剑鱼标讯从${result.i_site}个招标网站收录了</p>
-          <strong><mark id="flip-number-2">${toThousands(result.i_bidmonth)} </mark><i>条</i></strong>
-        </li>
-        <li>
-          <h4>今天</h4>
-          <p>剑鱼标讯成功为用户推送了信息</p>
-          <strong><mark id="flip-number-3">${toThousands(result.i_bidtoday)} </mark><i>条</i></strong>
-        </li>`
+      onlineData_arr = [result.i_bidall, result.i_bidmonth, result.i_bidtoday];
+      $(window).scroll(windowScrollFn);
+    },
+    error: function error(e) {
+      console.log('数据错误');
+    }
+  });
+}
+getOnlineData();
 
-        $(".jy-onlineData ul").html(str)
-  
-        onlineData_arr = [result.i_bidall,result.i_bidmonth,result.i_bidtoday]
-        $(window).scroll(windowScrollFn)
-      },
-      error: function (e) {
-        console.log('数据错误');
-      }
+function filpNumber() {
+  onlineData_arr.map(function (v, i) {
+    var demo = new CountUp('flip-number-' + (i + 1), 0, v, 0, 2, {
+      useEasing: false,
+      useGrouping: false
     });
-  }
-  getOnlineData()
-
-  function filpNumber () {
-      onlineData_arr.map(function (v, i) {
-          var demo = new CountUp('flip-number-' + (i + 1), 0, v, 0,2,{
-              useEasing: false,
-              useGrouping: false
-          });
-          if (!demo.error) {
-              demo.start();
-          } else {
-              console.error(demo.error);
-          }
-      })
-  }
+    if (!demo.error) {
+      demo.start();
+    } else {
+      console.error(demo.error);
+    }
+  });
+}
 
-  function windowScrollFn (){
-      var numberBox = $(".jy-onlineData")
-      var numberBoxH = numberBox.offset().top
-      if ($(window).scrollTop() + $(window).height()  >= numberBoxH) {
-        console.log('----11111----',onlineData_arr);
-          if (!numberBox.attr('data-show-an')) {
-              numberBox.attr('data-show-an','true')
-              filpNumber()
-          }
-      } else {
-          numberBox.removeAttr('data-show-an')
-      }
+function windowScrollFn() {
+  var numberBox = $(".jy-onlineData");
+  var numberBoxH = numberBox.offset().top;
+  if ($(window).scrollTop() + $(window).height() >= numberBoxH) {
+    if (!numberBox.attr('data-show-an')) {
+      numberBox.attr('data-show-an', 'true');
+      filpNumber();
+    }
+  } else {
+    numberBox.removeAttr('data-show-an');
   }
+}
 
 
 

+ 1 - 1
src/web/templates/common/pchead.html

@@ -812,7 +812,7 @@
         if(opa>baseOpa){
             el.style.background = 'rgba(255,255,255,'+ opa +')'
         }else{
-            el.style.background = 'rgba(255,255,255,0)'
+            el.style.background = 'rgba(255,255,255,'+ baseOpa +')'
         }
         
     }