foot.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
  2. <script src="__PUBLIC__/jquery/jquery.min.js"></script>
  3. <script src="__PUBLIC__/helper.js"></script>
  4. <script>
  5. var message;
  6. layui.config({
  7. base: '__EXTEND_JS__/',
  8. version: '1.0.2'
  9. }).use(['app', 'message'], function () {
  10. var app = layui.app,
  11. $ = layui.jquery,
  12. layer = layui.layer;
  13. //将message设置为全局以便子页面调用
  14. // message = layui.message;
  15. //主入口
  16. // app.set({
  17. // type: 'iframe'
  18. // }).init();
  19. });
  20. </script>
  21. <script type="text/javascript">
  22. $(function () {
  23. showThumb()
  24. })
  25. function showThumb() {
  26. var x = 10;
  27. var y = 20;
  28. $(".tooltip").mouseover(function (e) {
  29. var tooltip = "<div id='tooltip'><img src='" + this.href + "' alt='产品预览图' height='200'/>" + "<\/div>"; //创建 div 元素
  30. $("body").append(tooltip); //把它追加到文档中
  31. $("#tooltip")
  32. .css({
  33. "top": (e.pageY + y) + "px",
  34. "left": (e.pageX + x) + "px"
  35. }).show("fast"); //设置x坐标和y坐标,并且显示
  36. }).mouseout(function () {
  37. $("#tooltip").remove(); //移除
  38. }).mousemove(function (e) {
  39. $("#tooltip")
  40. .css({
  41. "top": (e.pageY + y) + "px",
  42. "left": (e.pageX + x) + "px"
  43. });
  44. });
  45. }
  46. </script>
  47. <script type="text/javascript">
  48. //判断tab是否有权限
  49. $('.a_menu').click(function () {
  50. var url = $(this).attr('href');
  51. var permission = $(this).attr('permission');
  52. if (url == 'javascript:;') {
  53. url = permission;
  54. }
  55. console.log('tab链接 ' + url);
  56. var a = true;
  57. $.ajax({
  58. url: url,
  59. type: 'get',
  60. async: false,
  61. data: {check_permission: true},
  62. success: function (res) {
  63. if (res.code == 0 && res.msg) {
  64. //提示并终止打开tab标签
  65. layer.msg(res.msg);
  66. a = false;
  67. }
  68. }
  69. })
  70. return a;
  71. })
  72. </script>
  73. <script>
  74. layui.use('laydate', function () {
  75. var laydate = layui.laydate;
  76. laydate.render({
  77. elem: '#date_time',
  78. max: 0 //最大值0天后
  79. });
  80. laydate.render({
  81. elem: '#time_range'
  82. , type: 'datetime'
  83. , range: true
  84. , max: '{:date("Y-m-d 23:59:59",time())}' //最大值
  85. , mark: {
  86. '{:date("Y-m-d",time())}': '今天'
  87. }
  88. , theme: 'molv'
  89. , calendar: true
  90. , done: function (value, date, endDate) {
  91. if (endDate.hours == 0 && endDate.minutes == 0 && endDate.seconds == 0) {
  92. setTimeout(function () {
  93. $('#time_range').val(value.replace(/00:00:00$/, '23:59:59'))
  94. }, 100)
  95. }
  96. }
  97. });
  98. });
  99. </script>
  100. <script>
  101. function switchStatus(classname, url) {
  102. $(classname).click(function () {
  103. var val = $(this).attr('data-val');
  104. var id = $(this).attr('data-id');
  105. var i = $(this).find('i');
  106. var the = $(this);
  107. var status = (val == 0) ? 1 : 0;
  108. $.ajax({
  109. type: "post",
  110. url: url,
  111. data: {status: status, id: id},
  112. dataType: 'json',
  113. success: function (res) {
  114. if (res.code == 1) {
  115. tostatus();
  116. } else {
  117. layer.msg(res.msg);
  118. }
  119. }
  120. })
  121. function tostatus() {
  122. if (val == 0) {
  123. i.attr("class", "fa fa-toggle-on");
  124. the.attr('data-val', 1);
  125. } else {
  126. i.attr("class", "fa fa-toggle-off");
  127. the.attr('data-val', 0);
  128. }
  129. }
  130. })
  131. }
  132. </script>