123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- * Created by TT on 2017/9/22.
- */
- ;
- spa_define(function () {
- return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
- return {
- main: function () {
- var root = spa.findInMain(".sys_article_viewcount");
- var qf = form.build(root.find(".queryForm"));
- var cr = code.parseCode(root.find(".dt-tpl"));
- var queryBtn = root.find(".queryForm .opt-query");
- var tableData = {data: []},
- allData = [],
- $data = {tn: "article"};
- var now = new Date(),
- nbt = new Date();
- nbt.setDate(now.getDate() - 7);
- var et1 = now.format("yyyyMMdd"),
- bt1 = nbt.format("yyyyMMdd");
- qf.val({bt: bt1, et: et1});
- $data.bt = bt1;
- $data.et = et1;
- var caption = function (dicts, code) {
- var items = dict.get(dicts);
- var cp = dict.getCap(items, code.toString());
- if (cp) {
- return cp;
- }else {
- return "不可翻译的";
- }
-
- },
- showDay = function (day) {
- if (day) {
- return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日";
- } else return "";
- },
- loadContent = function () {
- root.find(".hand-id").each(function () {
- var $e = $(this);
- var articleId = $e.attr("articleId");
- if (articleId) {
- util.get("../ajax/article/id",{id:articleId}, function (data) {
- if (data) {
- $e.parent().find(".articleTitle").text(data.articleTitle);
- $e.parent().find(".professorName").text(data.professorName || data.organizationName);
- $e.parent().find(".subject").text(data.subject);
- $e.parent().find(".colNum").text(caption("banner", data.colNum));
- $e.parent().find(".publishTime").text(showDay(data.publishTime));
- $e.parent().find(".sortNum").text(data.sortNum);
- $e.parent().find(".pageViews").text(data.pageViews);
- $e.parent().find(".articleAgree").text(data.articleAgree);
- }
- }, {});
-
- }
- });
- },
- load = function () {
-
- $.ajax({
- type: "GET",
- url: "http://www.ekexiu.com:8082/log/jsonp/qs",
- data: $data,
- dataType: "jsonp",
- success: function (data) {
-
- allData = data.data || [];
-
-
-
-
-
- tableData.data = allData;
- cr.val(tableData.data);
- loadContent();
- }
- });
- },
- query = function () {
-
- $data.bt = qf.val().bt;
- $data.et = qf.val().et;
-
-
-
-
- load();
- };
- queryBtn.on("click", query);
- load();
- root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
- var $this = $(this);
- $this.toggleClass("checked");
- if ($this.hasClass("checked")) {
- root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
- } else {
- root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
- }
- });
- root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
- var $this = $(this);
- $this.toggleClass("checked");
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- root.on("click",".icon-line-chart",function () {
- var $this = $(this);
- var articleId = $this.parent().attr("articleId");
- spa.showModal("sys_article_count",{
- id:articleId,
- hand:function () {
- pdg.reload();
- }
- })
- })
- },
- mainDestory: function () {
- }
- };
- });
- });
|