|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
-
-
-
- function gotop() {
- $('html, body').animate({ scrollTop: 0 }, 'slow');
- }
-
-
- function GetCookie(c_name) {
- if (document.cookie.length > 0) {
- c_start = document.cookie.indexOf(c_name + "=")
- if (c_start != -1) {
- c_start = c_start + c_name.length + 1;
- c_end = document.cookie.indexOf(";", c_start);
- if (c_end == -1) {
- c_end = document.cookie.length;
- }
- return unescape(document.cookie.substring(c_start, c_end));
- }
- }
- return null
- }
-
- function SetCookie(c_name, value, expiredays) {
- var exdate = new Date();
- exdate.setDate(exdate.getDate() + expiredays);
- document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
- }
-
-
-
-
-
-
- function guid() {
- function S4() {
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
- }
- return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
- }
-
-
-
-
-
-
-
- function ShowMsg(content, ...args) {
- title = "DedeBIZ信息提示";
- if (typeof content == "undefined") content = "";
- modalID = guid();
- var footer = `<button type="button" class="btn btn-outline-success" onClick="CloseModal(\'DedeModal${modalID}\')">确定</button>`;
- var noClose = false;
-
- if (args.length == 1) {
-
- if (typeof args[0].title !== 'undefined' && args[0].title != "") {
- title = args[0].title;
- }
- if (typeof args[0].footer !== 'undefined' && args[0].footer != "") {
- footer = args[0].footer;
- }
- if (typeof args[0].noClose !== 'undefined' && args[0].noClose == true) {
- noClose = true;
- }
- }
-
- String.prototype.replaceAll = function (s1, s2) {
- return this.replace(new RegExp(s1, "gm"), s2);
- }
- footer = footer.replaceAll("~modalID~", modalID);
- content = content.replaceAll("~modalID~", modalID);
-
- var modal = `<div id="DedeModal${modalID}" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="DedeModalLabel${modalID}" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content"><div class="modal-header">
- <h6 class="modal-title" id="DedeModalLabel${modalID}">${title}</h6>`;
- if (!noClose) {
- modal += `<button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>`;
- }
- modal += `</div><div class="modal-body">${content}</div><div class="modal-footer">${footer}</div></div></div></div>`;
- $("body").append(modal)
- $("#DedeModal" + modalID).modal({
- backdrop: 'static',
- show: true
- });
- $("#DedeModal" + modalID).on('hidden.bs.modal', function (e) {
- $("#DedeModal" + modalID).remove();
- })
- return modalID;
- }
-
-
- function CloseModal(modalID) {
- $("#" + modalID).modal('hide');
- $("#" + modalID).on('hidden.bs.modal', function (e) {
- if ($("#" + modalID).length > 0) {
- $("#" + modalID).remove();
- }
- })
- }
-
-
- function ShowAlert(ele, content, type, showtime = 3000) {
- let msg = `<div class="alert alert-${type}" role="alert">
- ${content}
- </div>`;
- $(ele).html(msg);
- $(ele).show();
- setTimeout(() => {
- $(ele).html("");
- }, showtime);
- }
-
-
-
-
-
- function ErrAddSaveDo(modalID) {
- let aid = $("#iptID").val();
- let title = $("#iptTitle").val();
- let type = $("#selType").val();
- let err = $("#iptErr").val();
- let erradd = $("#iptErradd").val();
- let parms = {
- format: "json",
- dopost: "saveedit",
- aid: aid,
- title: title,
- type: type,
- err: err,
- erradd: erradd,
- };
- $("#btnSubmit").attr("disabled", "disabled");
- if (typeof PHPURL === "undefined") {
- const PHPURL = "/plus";
- }
- $.post(PHPURL + "/erraddsave.php", parms, function (data) {
- let result = JSON.parse(data);
- if (result.code === 200) {
- CloseModal(modalID);
- } else {
- ShowAlert("#error-add-alert", `提交失败:${result.msg}`, "danger");
- }
- $("#btnSubmit").removeAttr("disabled");
- });
- }
-
-
- function ErrorAddSave(id, title) {
- let content = `
- <input type="hidden" value="${id}" class="form-control" id="iptID">
- <div class="form-group">
- <div id="error-add-alert">
- </div>
- <label for="iptTitle" class="col-form-label">标题:</label>
- <input type="text" disabled=true value="${title}" class="form-control" id="iptTitle">
- </div>
- <div class="form-group">
- <label for="message-text" class="col-form-label">错误类型:</label>
- <select id="selType" class="form-control">
- <option value="1">错别字(除的、地、得)</option>
- <option value="2">成语运用不当</option>
- <option value="3">专业术语写法不规则</option>
- <option value="4">产品与图片不符</option>
- <option value="5">事实年代以及内容错误</option>
- <option value="6">技术参数错误</option>
- <option value="7">其他</option>
- </select>
- </div>
- <div class="form-group">
- <label for="message-text" class="col-form-label">错误内容:</label>
- <textarea name="iptErr" class="form-control" id="iptErr"></textarea>
- </div>
- <div class="form-group">
- <label for="message-text" class="col-form-label">修正建议:</label>
- <textarea name="optErradd" class="form-control" id="iptErradd"></textarea>
- </div>
- `;
- let footer = `
- <button type="button" id="btnSubmit" class="btn btn-success" onClick="ErrAddSaveDo('DedeModal~modalID~')">提交</button>
- <button type="button" class="btn btn-outline-success" onClick="CloseModal('DedeModal~modalID~')">确定</button>
- `;
- ShowMsg(content, {
- 'footer': footer,
- });
- }
-
-
-
- $(document).ready(function () {
-
- window.onscroll = function () { scrollFunction() };
-
- function scrollFunction() {
- if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
- $("#btnScrollTop").show();
- } else {
- $("#btnScrollTop").hide();
- }
- }
-
- });
|