global.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. layui.config({
  2. base: "/statics/layui/lay/modules/extendplus/"
  3. }).extend({
  4. navbar: "navbar/navbar",
  5. tab: "navbar/tab",
  6. icheck: "icheck/icheck"
  7. });
  8. layui.use(["layer", "element", "util", "common"], function() {
  9. var a = layui.jquery,
  10. f = layui.layer,
  11. d = layui.device();
  12. var common=layui.common;
  13. layui.element();
  14. d.ie && 8 > d.ie && f.alert("最低支持ie8,您当前使用的是古老的 IE" + d.ie + "!");
  15. var d = a(".site-tree-mobile"),
  16. k = a(".site-mobile-shade");
  17. d.on("click", function() {
  18. a("body").addClass("site-mobile")
  19. });
  20. k.on("click", function() {
  21. a("body").removeClass("site-mobile")
  22. });
  23. a("#pay").on("click", function() {
  24. f.open({
  25. type: 1,
  26. title: !1,
  27. area: ["562px", "450px"],
  28. content: a(".shang_box")
  29. })
  30. });
  31. a("#git,#weibo,#weixin").on("click", function() {
  32. f.tips("暂时没有哦!", this)
  33. });
  34. var g = {
  35. doAdd: function() {
  36. var b = a(this).data("href");
  37. b ? window.location.href = b : common.layerAlertE("链接错误!", "提示")
  38. },
  39. doEdit: function() {
  40. var b = a(this).data("href"),
  41. c = a(this).data("id");
  42. b ? window.location.href = b + "&id=" + c : common.layerAlertE("链接错误!", "提示")
  43. },
  44. doDelete: function() {
  45. var b = a(this).data("href");
  46. if (b) {
  47. if (1 > a(".layuitable tbody input:checked").size()) return common.layerAlertE("对不起,请选中您要操作的记录!", "提示");
  48. for (var c = "", d = a(".layuitable tbody input:checked"), e = 0; e < d.length; e++) d[e].checked && "disabled" != a(d[e]).attr("disabled") && (c += a(d[e]).attr("ids") + ",");
  49. common.layerDel("确认删除这些信息?", "此操作不可逆,请再次确认是否要操作。", b, "post", "json", {
  50. ids: c
  51. })
  52. } else common.layerAlertE("链接错误!", "提示")
  53. },
  54. doState: function() {
  55. var b = a(this).data("href");
  56. if (b) {
  57. if (1 > a(".layuitable .article_list input:checked").size()) return common.layerAlertE("对不起,请选中您要操作的记录!", "提示");
  58. for (var c = "", d = a(".layuitable .article_list input:checked"), e = 0; e < d.length; e++) d[e].checked && "disabled" != a(d[e]).attr("disabled") && (c += a(d[e]).attr("ids") + ",");
  59. common.layerState("确认更新这些信息?", "此操作不可逆,请再次确认是否要操作。", b, "post", "json", {
  60. ids: c
  61. })
  62. } else common.layerAlertE("链接错误!", "提示")
  63. },
  64. doDelOne: function() {
  65. var b = a(this).data("href"),
  66. c = a(this).data("id");
  67. b ? common.layerDel("确认删除该条记录吗?", "此操作不可逆,请再次确认是否要操作。", b, "post", "json", {
  68. ids: c
  69. }) : common.layerAlertE("链接错误!", "提示")
  70. },
  71. doBatchDelete: function() {
  72. var b = a(this).data("href");
  73. b ? common.layerDel("确认删除这些信息?", "此操作不可逆,请再次确认是否要操作。", b, "post", "json", {
  74. ids: ""
  75. }) : common.layerAlertE("链接错误!", "提示")
  76. },
  77. doDbBak: function() {
  78. var b = a(this).data("href");
  79. b ? common.ajax(b, "post", "json", "") : common.layerAlertE("链接错误!", "提示")
  80. }
  81. },
  82. h = {
  83. doRefresh: function() {
  84. var b = a(this).data("href");
  85. location.href = b ? b : location.href
  86. },
  87. doGoTop: function() {
  88. a(this).click(function() {
  89. a("body,html").animate({
  90. scrollTop: 0
  91. }, 500);
  92. return !1
  93. })
  94. },
  95. doGoBack: function() {
  96. history.go(-1)
  97. }
  98. };
  99. a(document).on("click", ".do-action", function(b) {
  100. var c = a(this).data("type");
  101. h[c] ? h[c].call(this) : "";
  102. g[c] ? g[c].call(this) : "";
  103. layui.stope(b)
  104. })
  105. });