Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

169 linhas
6.6 KiB

  1. <title>模板列表</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>系统设置</cite></a>
  6. <a><cite>信息管理</cite></a>
  7. <a><cite>模板管理</cite></a>
  8. <a><cite>模板列表</cite></a>
  9. </div>
  10. </div>
  11. <style>
  12. tbody .layui-table-cell {
  13. height: 160px;
  14. /*line-height: 64px;*/
  15. }
  16. </style>
  17. <div class="layui-fluid">
  18. <div class="layui-card">
  19. <div id="layui-search" class="layui-form layui-form layui-card-header layuiadmin-card-header-auto"
  20. style="display: none">
  21. <div class="layui-form-item">
  22. <div id="layui-search-fields" class="layui-search-fields" style="display: inline-block">
  23. </div>
  24. <div id="layui-search-button" class="layui-inline">
  25. <button class="layui-btn layuiadmin-btn" lay-submit lay-filter="LAY-front-search">
  26. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  27. </button>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="layui-card-body">
  32. <div style="padding-bottom: 10px;" id="layui-top-button">
  33. </div>
  34. <table id="LAY-curd-table" lay-filter="LAY-curd-table"></table>
  35. <script type="text/html" id="table-curd-list">
  36. </script>
  37. </div>
  38. </div>
  39. </div>
  40. <script type="text/html" id="theme-info">
  41. <b>{{d.name}}</b><br/>
  42. 作者:{{d.author}}<br/>
  43. 邮箱:{{d.email}}<br/>
  44. 网址:{{d.url}}<br/>
  45. 简介:{{d.description}}<br/>
  46. </script>
  47. <script type="text/html" id="theme-amp">
  48. {{# if(d.amp){}}
  49. <span class="layui-badge layui-bg-green">使用中</span>
  50. {{#}}}
  51. </script>
  52. <script type="text/html" id="theme-mip">
  53. {{# if(d.mip){}}
  54. <span class="layui-badge layui-bg-green">使用中</span>
  55. {{#}}}
  56. </script>
  57. <script type="text/html" id="theme-pc">
  58. {{# if(d.pc){}}
  59. <span class="layui-badge layui-bg-green">使用中</span>
  60. {{#}}}
  61. </script>
  62. <script type="text/html" id="theme-wap">
  63. {{# if(d.wap){}}
  64. <span class="layui-badge layui-bg-green">使用中</span>
  65. {{#}}}
  66. </script>
  67. <script>
  68. var config = {
  69. api: {
  70. list: '/manage/template/list.json',
  71. set: '/manage/template/set.json',
  72. },
  73. search: {},
  74. actionButton: {
  75. set: {
  76. text: '使用',
  77. icon: 'layui-icon layui-icon-ok',
  78. action(obj) {
  79. var setTemplate = function (type, template) {
  80. layui.admin.req({
  81. url: config.api.set,
  82. data: {type: type, template: template},
  83. method: 'POST',
  84. success: function (res) {
  85. layui.table.reload('LAY-curd-table');
  86. layui.layer.msg('操作成功');
  87. }
  88. })
  89. };
  90. if (obj.data.type === 'all') {
  91. layui.layer.msg('当前模板支持多平台,请问您要为哪个平台设置?', {
  92. time: false,
  93. btn: ['全部', '电脑', '手机', 'AMP', 'MIP'],
  94. yes: function (index) {
  95. setTemplate('all', obj.data.path);
  96. },
  97. btn2: function (index) {
  98. setTemplate('pc', obj.data.path);
  99. },
  100. btn3: function (index) {
  101. setTemplate('wap', obj.data.path);
  102. },
  103. btn4: function (index) {
  104. setTemplate('amp', obj.data.path);
  105. },
  106. btn5: function (index) {
  107. setTemplate('mip', obj.data.path);
  108. }
  109. });
  110. } else {
  111. layui.admin.req({
  112. url: config.api.set,
  113. data: {type: obj.data.type, template: obj.data.path},
  114. method: 'POST',
  115. success: function (res) {
  116. layui.table.reload('LAY-curd-table');
  117. layui.layer.msg('操作成功');
  118. }
  119. })
  120. }
  121. }
  122. },
  123. preview: {
  124. text: '预览',
  125. icon: 'layui-icon layui-icon-search',
  126. action(obj) {
  127. index = layui.layer.open({
  128. type: 2,
  129. title: '主题预览',
  130. shadeClose: false,
  131. shade: false,
  132. maxmin: true,
  133. area: obj.data.type === 'wap' ? ['360px', '640px'] : [],
  134. content: '/?template=' + obj.data.path
  135. });
  136. if (obj.data.type !== 'wap') {
  137. layer.full(index);
  138. }
  139. }
  140. },
  141. config: {
  142. text: '参数',
  143. icon: 'layui-icon layui-icon-set',
  144. action(obj) {
  145. window.location.hash = layui.router().href + 'config/template=' + obj.data.path;
  146. }
  147. },
  148. },
  149. table: {
  150. page: false,
  151. height: 0,
  152. cols: [[
  153. {field: 'demo', title: '预览', templet: '#table-img', width: 120},
  154. {field: 'key', title: '模板信息', templet: '#theme-info'},
  155. {field: 'version', title: '版本', width: 120},
  156. {field: 'typename', title: '类型', width: 120},
  157. {field: 'pc', title: 'PC模板', templet: '#theme-pc', align: 'center', width: 100},
  158. {field: 'wap', title: '手机模板', templet: '#theme-wap', align: 'center', width: 100},
  159. {field: 'amp', title: 'AMP模板', templet: '#theme-amp', align: 'center', width: 100},
  160. {field: 'mip', title: 'MIP模板', templet: '#theme-mip', align: 'center', width: 100},
  161. {title: '操作', width: 220, align: 'center', fixed: 'right', toolbar: '#table-curd-list'}
  162. ]]
  163. }
  164. };
  165. layui.use('curd/list', layui.factory('curd/list'));
  166. </script>