const Config = { title: "陕西广电融媒体集团", logoUrl: "http://zyx-data-base.oss-cn-beijing.aliyuncs.com/img/logonew2.png", baseUrl: "http://topic.smcic.net", }; document.title = Config.title; $(".proName").append( $( "" +
      Config.title +
      "" ) ); const pageName = getPageName(); if (/skeleton/.test(pageName) && !localStorage.login) { location.href = "./index.html"; } function getPageName() { const pathList = location.href.split("/"); return pathList[pathList.length - 1]; } function getsearch() { const searchLi = location.search.replace("?", "").split("&"); const search = {}; for (let i = 0; i < searchLi.length; i++) { const v = searchLi[i]; const li = v.split("="); if (!li.length) continue; search[li[0]] = decodeURI(li[1]); } return search; } function showAlert(text, s) { let ele = $( "
" + text + "
" ); $(document.body).prepend(ele); let timeout; timeout = window.setTimeout(() => { window.clearTimeout(timeout); $("#local-alert").addClass("fadeOutRightBig animated infinite"); timeout = window.setTimeout(() => { window.clearTimeout(timeout); $("#local-alert").remove(); }, 500); }, s || 2000); } function createTable(ele, theadList, list) { $(ele + " .localtable").remove(); const pele = $(ele); const table = $("
"); const thead = $(""); const tbody = $(""); const trHead = $(""); const theadListL = theadList || []; const listL = list || []; theadListL.map((v, i) => { const td = $( "" + v.title + "" ); trHead.append(td); }); listL.map((v, o) => { let className = o % 2 === 1 ? "oddRow" : ""; const trBody = $(""); theadListL.map(titleI => { let val = titleI.value === "#index" ? o + 1 : v[titleI.value]; titleI.formatValue && (val = titleI.formatValue(val)); const td = $("" + val + ""); trBody.append(td); }); tbody.append(trBody); }); thead.append(trHead); table.append(thead); table.append(tbody); pele.append(table); } function createPager(totalPage, pageIndex, pele, section) { $("nav.localnavigation").remove(); let sectionReal = section || 2; const nav = $( "" ); const ul = $( "" ); const next = $( '
  • ' ); const minPage = pageIndex - sectionReal > 1 ? pageIndex - sectionReal : 1; const maxPage = pageIndex + sectionReal < totalPage ? pageIndex + sectionReal : totalPage; if (minPage !== 1) { ul.append($("
  • 1
  • ")); ul.append($("
  • ...
  • ")); } for (let i = minPage; i <= maxPage; i++) { let li = $( "
  • " + i + "
  • " ); ul.append(li); } if (maxPage !== totalPage) { ul.append($("
  • ...
  • ")); ul.append($("
  • " + totalPage + "
  • ")); } ul.append(next); nav.append(ul); $(pele).append(nav); } function formatnum(text) { let num = text; if (isNaN(text)) num = 0; if (text >= 100000000) num = (text / 100000000).toFixed(2) - 0 + "亿"; if (text >= 10000) num = (text / 10000).toFixed(2) - 0 + "万"; return num; } function require(type, conf) { return new Promise((resolve, reject) => { let D = {}, ct = "application/json"; D = type === "POST" ? JSON.stringify(conf.data || {}) : conf.data || {}; $.ajax({ url: Config.baseUrl + conf.url, contentType: ct, dataType: "json", type: type || "GET", headers: { Authorization: localStorage.token, }, cache: false, data: D, success: function (data) { if (data.code !== 0) { showAlert(data.message); reject(data.message); } else resolve(data.data); }, complete() {}, error(err) { showAlert(err.responseJSON ? err.responseJSON.message : "错误"); reject(err); }, }); }); }