cate1.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {extend name="public/layout"/} {block name="title"}新建标签{/block} {block name="body"}
  2. <style>
  3. html,
  4. body {
  5. height: 80%;
  6. min-width: 500px;
  7. background-color: #fff;
  8. }
  9. .body {
  10. height: 100%;
  11. overflow-y: auto;
  12. background: #fff;
  13. }
  14. .huise333 {
  15. color: #333;
  16. }
  17. .layui-form-select {
  18. width: 50%;
  19. float: left;
  20. }
  21. .layui-form-label {
  22. width: 25%;
  23. }
  24. .layui-input-block {
  25. width: 70%;
  26. }
  27. .mjtext {
  28. width: 50%;
  29. height: 38px;
  30. }
  31. .pingfang {
  32. right: 11%;
  33. top: 32%;
  34. font-size: 14px;
  35. color: #999;
  36. }
  37. .text-detail {
  38. width: 100%;
  39. height: 100%;
  40. display: flex;
  41. flex-direction: column;
  42. justify-content: center;
  43. align-items: center;
  44. }
  45. .mdl20 {
  46. margin-left: 0px;
  47. }
  48. .width56_ {
  49. width: 59%;
  50. }
  51. .layui-form-checkbox i {
  52. height: 30px;
  53. }
  54. .bodys {
  55. padding: 20px 0px 0px;
  56. }
  57. </style>
  58. <body>
  59. <div class="bodys">
  60. <form class="layui-form layui-form-box">
  61. <div class="layui-form-item mdt30 wpsr">
  62. <label class="layui-form-label"><i style="color:red;">*</i> 一级分类名称:</label>
  63. <div class="layui-input-block">
  64. <input type="text" id="title" name="title" required lay-verify="required" placeholder="请输入分类名称"
  65. autocomplete="off" class="layui-input mjtext">
  66. </div>
  67. </div>
  68. <div class="layui-form-item">
  69. <label class="layui-form-label">类型</label>
  70. <div class="layui-input-block">
  71. <input type="radio" name="is_case" lay-filter="type" value=0 title="图文" checked>
  72. <input type="radio" name="is_case" lay-filter="type" value=1 title="案例">
  73. </div>
  74. </div>
  75. <div class="width56_" style="display: none;">
  76. <button type="button" lay-submit class="layui-btn layui-btn-normal pdlr30"
  77. lay-filter="spellgroup-submit" id="spellgroup-submit">保存</button>
  78. </div>
  79. </form>
  80. </div>
  81. </body>
  82. {/block} {block name="js"}
  83. <script>
  84. layui.config({
  85. base: '__LAYUI__/',
  86. urlbase: '/sys'
  87. }).extend({
  88. index: 'lib/index' //主入口模块
  89. }).use(['index', 'form', 'upload'], function () {
  90. var $ = layui.$,
  91. layer = layui.layer,
  92. upload = layui.upload,
  93. form = layui.form;
  94. form.render();
  95. //添加保存
  96. form.on('submit(spellgroup-submit)', function (data) {
  97. var formData = new FormData(data.form);
  98. $.ajax({
  99. url: '{:url("smartScreen/saveCate")}?type='+'{$type}',
  100. type: 'post',
  101. data: formData,
  102. dataType: 'json',
  103. processData: false,
  104. contentType: false,
  105. success: function (res) {
  106. if (res.code === 0) {
  107. layer.msg(res.msg, {
  108. anim: 0, time: 1000, icon: 6,
  109. }, function () {
  110. var index = parent.layer.getFrameIndex(window.name);
  111. parent.layer.close(index); //再执行关闭
  112. });
  113. } else {
  114. layer.msg(res.msg, { anim: 0, time: 1000, icon: 5 });
  115. }
  116. }
  117. });
  118. return false;
  119. });
  120. $('.cancel').click(function () {
  121. var index = parent.layer.getFrameIndex(window.name);
  122. parent.layer.close(index);
  123. })
  124. form.on('radio(type)', function (data) {
  125. if (data.value == 1) {
  126. $('.vrStyle').removeClass('layui-hide');
  127. $('.articleStyle').addClass('layui-hide');
  128. } else {
  129. $('.vrStyle').addClass('layui-hide');
  130. $('.articleStyle').removeClass('layui-hide');
  131. }
  132. })
  133. })
  134. </script>
  135. {/block}