cate_wechat.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. {extend name="public/layout" /} {block name="title"}案例分类管理{/block} {block name="body"}
  2. <style type="text/css">
  3. html,
  4. body {
  5. display: block;
  6. background-color: #fff;
  7. }
  8. .layui-table thead tr,
  9. .layui-table-header {
  10. background-color: #D8E6F1 !important;
  11. }
  12. .layui-fluid {
  13. display: block;
  14. border-radius: 5px;
  15. background-color: #ffffff;
  16. padding: 15px 30px;
  17. }
  18. .layui-tab {
  19. padding: 15px;
  20. height: 100%;
  21. }
  22. .layui-form-item {
  23. width: 100%;
  24. }
  25. .layui-form-item .layui-inline {
  26. display: block;
  27. float: left;
  28. width: 145px;
  29. height: 38px;
  30. line-height: 38px;
  31. background: #FFFFFF;
  32. margin-right: 16px;
  33. }
  34. .layui-form-item .layui-input-inline {
  35. width: 145px;
  36. height: 38px;
  37. line-height: 38px;
  38. margin-bottom: 0;
  39. }
  40. .layui-icon {
  41. font-size: 20px !important;
  42. }
  43. .layui-form-item .layui-input-inline .layui-input {
  44. border: 1px solid #9DB6CF;
  45. border-radius: 5px;
  46. }
  47. .layui-form-select dl dd.layui-this {
  48. background-color: #249EFB;
  49. }
  50. .layui-form-item div.searchBox {
  51. width: 320px;
  52. background: #FFFFFF;
  53. border: 1px solid #B6CADE;
  54. border-radius: 24px;
  55. height: 38px;
  56. overflow: hidden;
  57. padding-left: 18px;
  58. position: relative;
  59. margin-bottom: 0px;
  60. float: right;
  61. }
  62. .searchBox .inputBox {
  63. width: 240px;
  64. float: left;
  65. height: 36px;
  66. line-height: 36px;
  67. border-width: 0;
  68. }
  69. .searchBtn {
  70. position: absolute;
  71. top: 0;
  72. right: 0;
  73. width: 51px;
  74. height: 38px;
  75. background-color: #fff;
  76. }
  77. .searchBtn img {
  78. position: absolute;
  79. width: 26px;
  80. top: 6px;
  81. left: 0;
  82. }
  83. .layui-card .layui-tab {
  84. margin: 0;
  85. height: 31%;
  86. width: 80%;
  87. float: right;
  88. padding: 1px;
  89. }
  90. .layui-btn-primary {
  91. color: #249EFB;
  92. border: 1px solid #249EFB;
  93. }
  94. .layui-btn-primary:hover {
  95. background-color: #E3F7FF;
  96. color: #249EFB;
  97. }
  98. .layui-btn-xs,.layui-btn-xs:hover {
  99. border: 1px solid #249EFB;
  100. background-color: #fff;
  101. color: #249EFB;
  102. padding: 0px 10px;
  103. }
  104. .layui-btn-danger,.layui-btn-danger:hover{
  105. color: #FF5722;
  106. background-color: #fff;
  107. border: 1px solid #FF5722;
  108. padding: 0px 10px;
  109. }
  110. .layui-card-header {
  111. background-color: #F6FAFD;
  112. }
  113. .layui-card-body {
  114. padding: 10px 0px 0px;
  115. }
  116. </style>
  117. <body>
  118. <div class="layui-fluid">
  119. <div class="layui-card">
  120. <div class="layui-card-header layuiadmin-card-header-auto">
  121. <a href="#" type="button" class="layui-btn layui-btn-primary" id="cate_add">添加分类</a>
  122. </div>
  123. <div class="layui-card-body">
  124. <table id="evidence-table" lay-filter="evidence-table"></table>
  125. </div>
  126. </div>
  127. </div>
  128. </body>
  129. {/block} {block name="js"}
  130. <script type="text/html" id="show">
  131. <input type="checkbox" name="show" value="{{d.id}}" lay-skin="switch" lay-text="上架|下架" lay-filter="show" {{ d.publish == 1 ? 'checked' : '' }}>
  132. </script>
  133. <script type="text/html" id="table-evidence-action">
  134. {{# if(d.from_type == 0){ }}
  135. {{# if(d.show == 0){ }}
  136. <a class="layui-btn layui-btn-xs" lay-event="evi-details">编辑</a>
  137. <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="evidence-delete">删除</a>
  138. {{# }else{ }}
  139. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">编辑</a>
  140. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">删除</a>
  141. {{# } }}
  142. {{# }else{ }}
  143. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">编辑</a>
  144. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">删除</a>
  145. {{# } }}
  146. </script>
  147. <script type="text/html" id="evidence_num">
  148. <span>{{d.picnum}}</span>
  149. </script>
  150. <script>
  151. layui.config({
  152. base: '__LAYUI__/',
  153. urlbase: '/sys'
  154. }).extend({
  155. index: 'lib/index' //主入口模块
  156. }).use(['index', 'table', 'element'], function () {
  157. var $ = layui.$,
  158. form = layui.form,
  159. element = layui.element,
  160. table = layui.table;
  161. //添加分类
  162. $('#cate_add').click(function(){
  163. layer.prompt({title:['添加', 'color:#333333;background-color:#D8E6F1;'],value:''},function(value,index){
  164. if (value.trim()=='') {
  165. layer.msg('请填写名称', {
  166. anim: 6
  167. ,time: 400
  168. });
  169. return false;
  170. }
  171. if(value.length > 6) {
  172. layer.msg('分类名称超长', {
  173. anim: 6
  174. ,time: 400
  175. });
  176. return false;
  177. }
  178. $.ajax({
  179. url: '{:url("material/cate_wechat_add")}',
  180. type: 'post',
  181. data: {name:value},
  182. dataType: 'json',
  183. success: function(res) {
  184. console.log(res)
  185. if(res.code === 0) {
  186. layer.msg(res.msg, {
  187. anim: 0
  188. ,time: 400
  189. });
  190. //执行重载
  191. table.reload('evidence-table', {
  192. });
  193. } else {
  194. layer.msg(res.msg, {
  195. anim: 6
  196. ,time: 400
  197. });
  198. }
  199. }
  200. });
  201. layer.close(index);
  202. });
  203. });
  204. //客户见证列表
  205. table.render({
  206. elem: '#evidence-table',
  207. autoSort: false,
  208. url:'{:url("material/cate_wechat_list")}',
  209. cols: [
  210. [{
  211. type: 'numbers',
  212. field: 'id',
  213. width: 80,
  214. title: '序号',
  215. sort: true
  216. }, {
  217. field: 'name',
  218. title: '名称'
  219. },{
  220. title: '操作',
  221. width: 240,
  222. align: 'center',
  223. fixed: 'right',
  224. toolbar: '#table-evidence-action'
  225. }]
  226. ],
  227. page: true,
  228. limit: 30,
  229. height: 'full-120',
  230. text: '对不起,加载出现异常!'
  231. });
  232. //监听列表
  233. table.on('tool(evidence-table)', function (obj) {
  234. var data = obj.data;
  235. if (obj.event === 'evidence-delete') {
  236. //监听关联的数量
  237. $.ajax({
  238. url: '{:url("material/cate_wechat_join_count")}',
  239. type: 'post',
  240. data: { id: data.id },
  241. dataType: 'json',
  242. success: function (msg) {
  243. layer.confirm(msg, { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function () {
  244. $.get("{:url('material/cate_wechat_delete')}?id=" + data.id, function (res) {
  245. if (res.code === 0) {
  246. layer.msg(res.msg, { anim: 0, time: 400 }, function () {
  247. table.reload('evidence-table');
  248. });
  249. } else {
  250. layer.msg(res.msg, { anim: 6, time: 400 });
  251. }
  252. });
  253. });
  254. }
  255. });
  256. } else if (obj.event === 'evi-details') {
  257. layer.prompt({title:['编辑', 'color:#333333;background-color:#D8E6F1;'],value:data.name},function(value,index){
  258. if (value==data.name || value.trim()=='') {
  259. layer.msg('请修改名称', {
  260. anim: 6
  261. ,time: 400
  262. });
  263. return false;
  264. }
  265. if(value.length > 6) {
  266. layer.msg('分类名称超长', {
  267. anim: 6
  268. ,time: 400
  269. });
  270. return false;
  271. }
  272. $.ajax({
  273. url: '{:url("material/cate_wechat_edit")}',
  274. type: 'post',
  275. data: {id:data.id,name:value},
  276. dataType: 'json',
  277. success: function(res) {
  278. // console.log(res)
  279. if(res.code === 0) {
  280. layer.msg(res.msg, {
  281. anim: 0
  282. ,time: 400
  283. });
  284. //执行重载
  285. table.reload('evidence-table', {
  286. });
  287. } else {
  288. layer.msg(res.msg, {
  289. anim: 6
  290. ,time: 400
  291. });
  292. }
  293. }
  294. });
  295. layer.close(index);
  296. //执行重载
  297. // var w = [];
  298. // w.type = types;
  299. // table.reload('evidence-table', {
  300. // // where: w
  301. // });
  302. });
  303. // layer.open({
  304. // type: 2,
  305. // title: '编辑',
  306. // content: "{:url('material/evidencedetail')}?id=" + data.id,
  307. // content:'{:url("material/cate_administration_edit_view")}?id='+data.id+'&type='+types,
  308. // maxmin: true,
  309. // area: ['400px', '200px'],
  310. // });
  311. }
  312. });
  313. //备注
  314. $('body').on('mouseover', '.remarksInfo', function () {
  315. var type = $(this).data('type');
  316. layer.tips(type, this, {
  317. tips: [1, '#3595CC'],
  318. time: 2000
  319. });
  320. });
  321. form.on('switch(show)', function (obj) {
  322. var id = obj.value;
  323. $.ajax({
  324. type: "post",
  325. url: '{:url("material/apipublish")}',
  326. data: {
  327. id: id,
  328. cate: 'evidence'
  329. },
  330. success: function (res) {
  331. layer.msg(res.msg);
  332. }
  333. });
  334. });
  335. });
  336. </script>
  337. {/block}