content.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. define(['jquery', 'table', 'form'], function($, Table, Form) {
  2. var Controller = {
  3. publish: function() {
  4. Form.api.bindevent($("form.layui-form"), function(data, ret) {
  5. $(".layer-footer [lay-submit]", this).addClass("layui-btn-disabled", "btn-disabled");
  6. setTimeout(function() {
  7. location.href = Yzn.api.fixurl('cms.content/published');
  8. }, 1500);
  9. });
  10. layui.form.on('select(filter)', function(data) {
  11. location.href = data.value
  12. });
  13. },
  14. edit: function() {
  15. Form.api.bindevent($("form.layui-form"), function(data, ret) {
  16. $(".layer-footer [lay-submit]", this).addClass("layui-btn-disabled", "btn-disabled");
  17. setTimeout(function() {
  18. location.href = Yzn.api.fixurl('cms.content/published');
  19. }, 1500);
  20. });
  21. },
  22. published: function() {
  23. Table.init = {
  24. table_elem: '#currentTable',
  25. table_render_id: 'currentTable',
  26. edit_url: 'cms.content/edit',
  27. delete_url: 'cms.content/del',
  28. };
  29. Table.render({
  30. init: Table.init,
  31. toolbar: ['refresh'],
  32. url: 'cms.content/published',
  33. search: false,
  34. cols: [
  35. [
  36. { field: 'id', width: 80, title: 'ID' },
  37. { field: 'title', title: '标题' },
  38. { field: 'catname', width: 120, title: '所属栏目' },
  39. { field: 'create_time', width: 180, title: '发布时间' },
  40. { field: 'url', width: 60, align: "center", title: 'URL', templet: Table.formatter.url },
  41. { field: 'status', width: 90, align: "center", title: '状态', templet: '#status' },
  42. {
  43. width: 85,
  44. title: '操作',
  45. templet: Table.formatter.tool,
  46. operat: [
  47. {
  48. class: 'layui-btn layui-btn-success layui-btn-xs',
  49. icon:'iconfont icon-edit-2-line',
  50. text: "",
  51. title: '编辑信息',
  52. extend: '',
  53. url: Table.init.edit_url,
  54. },'delete'
  55. ]
  56. }
  57. ]
  58. ],
  59. page: {}
  60. });
  61. Table.api.bindevent();
  62. }
  63. };
  64. return Controller;
  65. });