index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. {extend name="layout/content" /} {block name="header"}
  2. <link rel="stylesheet" href="__STATIC__/css/admin/bootstrap.min.css">
  3. <link rel="stylesheet" href="__STATIC__/css/admin/bootstrap-table.css">
  4. <!--<link rel="stylesheet" href="__STATIC__/css/admin/bootstrap-editable.css">-->
  5. <!--<link rel="stylesheet" href="__STATIC__/css/FuzzySearch.css?v={$Think.STATIC_VERSION}">-->
  6. <!--<link rel="stylesheet" href="__STATIC__/js/select2/css/select2.min.css" type="text/css"/>-->
  7. <!--<link rel="stylesheet" href="__STATIC__/js/select2/css/select2-bootstrap.min.css" type="text/css"/>-->
  8. <!--<link rel="stylesheet" href="__STATIC__/css/viewer.min.css" type="text/css"/>-->
  9. <title>分享礼包管理</title>
  10. <style>
  11. .layui-layer.layui-layer-page.layer-anim .layui-table td:nth-child(2n) {
  12. text-align: left !important;
  13. }
  14. .layui-form-item .layui-input-inline {
  15. float: unset;
  16. width: 190px;
  17. margin-right: 10px;
  18. }
  19. .x-so {
  20. text-align: unset;
  21. margin-bottom: 0px;
  22. }
  23. .fl_r {
  24. float: right;
  25. }
  26. .frozen {
  27. color: orangered;
  28. }
  29. .normal {
  30. color: green;
  31. }
  32. .layui-form-label {
  33. display: inline-block;
  34. float: unset;
  35. text-align: center;
  36. }
  37. .separate {
  38. display: inline-block;
  39. float: unset;
  40. width: 15px;
  41. padding-top: 12px;
  42. margin-right: 7px;
  43. margin-left: 0px;
  44. }
  45. .layui-form-item .layui-input-inline {
  46. float: unset;
  47. width: 190px;
  48. margin-right: 10px;
  49. }
  50. .tip {
  51. display: inline-block;
  52. width: 14px;
  53. height: 14px;
  54. background: black;
  55. color: white;
  56. border-radius: 50%;
  57. text-align: center;
  58. line-height: 16px;
  59. font-weight: 700;
  60. }
  61. .tip:hover {
  62. cursor: pointer;
  63. }
  64. .red {
  65. color: red;
  66. }
  67. a:hover {
  68. text-decoration: none;
  69. }
  70. a:hover span {
  71. color: red !important;
  72. }
  73. .toolWrap {
  74. /*height: 50px;*/
  75. }
  76. .margin-top-10{
  77. margin-top: 10px;
  78. }
  79. .hide {
  80. display: none;
  81. }
  82. .setWidth{
  83. width:230px !important;
  84. }
  85. #objTable td,#objTable th{
  86. vertical-align: inherit;
  87. text-align: center;
  88. }
  89. .detail-view td{
  90. text-align: left !important;
  91. }
  92. .layui-input{
  93. display: inline-block;
  94. width: 190px;
  95. }
  96. .mgt_10{
  97. margin-top: 10px;
  98. }
  99. .pager-container .layui-input {
  100. width: 80px;
  101. }
  102. </style>
  103. {/block} {block name="content"}
  104. <div class="x-body">
  105. <form class="layui-form">
  106. <div style="float:left">
  107. <a href="{:url('add')}" class="layui-btn layui-btn-radius">
  108. <i class="layui-icon">&#xe654;</i>新增
  109. </a>
  110. </div>
  111. <div style="float:right;margin-bottom:10px;">
  112. <div class="layui-inline">
  113. <label class="layui-form-label">礼包名:</label>
  114. <div class="layui-input-inline">
  115. <input class="layui-input" placeholder="请输入标题" id="name" name="name" value="{:input('name')}">
  116. </div>
  117. </div>
  118. <div class="layui-inline">
  119. <label class="layui-form-label">文章名:</label>
  120. <div class="layui-input-inline">
  121. <input class="layui-input" placeholder="请输入标题" id="title" name="title" value="{:input('title')}">
  122. </div>
  123. </div>
  124. <div class="layui-inline">
  125. <label class="layui-form-label" style="width:90px">使用次数:</label>
  126. <div class="layui-input-inline">
  127. <select name="usetype" id="usetype" lay-search>
  128. <option value=""> - 请选择使用次数 - </option>
  129. <option value="1" {if condition="1 eq input('usetype')"} selected="selected"{/if}>一次</option>
  130. <option value="2" {if condition="2 eq input('usetype')"} selected="selected"{/if}>无限次</option>
  131. </select>
  132. </div>
  133. </div>
  134. <div class="layui-inline">
  135. <label class="">创建时间:</label>
  136. <div class="layui-input-inline">
  137. <input class="layui-input" placeholder="开始时间" name="cr_start" id="cr_start" readonly='readonly' value="{$Request.get.cr_start}" autocomplete="off">
  138. </div>
  139. <span>-</span>
  140. <div class="layui-input-inline">
  141. <input class="layui-input" placeholder="结束时间" name="cr_end" id="cr_end" readonly='readonly' value="{$Request.get.cr_end}" autocomplete="off">
  142. </div>
  143. </div>
  144. <div class="layui-inline">
  145. <button class="layui-btn" lay-submit id="J_search_submit">查询</button>
  146. </div>
  147. </div>
  148. <div style="clear:both"></div>
  149. <!-- data-toolbar="#toolbar" -->
  150. <table id="objTable" data-detail-view="true" data-detail-formatter="detailFormatter">
  151. <thead>
  152. <tr>
  153. <th>礼包名</th>
  154. <th>文章名</th>
  155. <th>使用次数</th>
  156. <th>创建时间</th>
  157. <th class="setWidth">操作</th>
  158. <th class="hide"></th>
  159. <th class="hide"></th>
  160. <th class="hide"></th>
  161. </tr>
  162. </thead>
  163. <tbody id="tbody">
  164. {notempty name="list"} {volist name="list" id="vo"}
  165. <tr>
  166. <td>{$vo.name}</td>
  167. <td>{$vo.title}</td>
  168. <td>
  169. {switch name="vo.usetype"}
  170. {case value="1"}一次{/case}
  171. {case value="2"}无限次{/case}
  172. {default /}
  173. {/switch}
  174. </td>
  175. <td>{:isset($vo.create_time)?date('Y-m-d H:i:s',$vo.create_time) : ""}</td>
  176. <td class="setWidth">
  177. <a title="编辑" href="{:url('edit',['id'=>$vo.id])}" class="layui-btn layui-btn-normal edit">
  178. <i class="layui-icon">&#xe63c;</i>编辑
  179. </a>
  180. <a href="javascript:;" onclick="ajaxDeletePack('{:url(\'del\',[\'id\'=>$vo.id])}')" class="layui-btn layui-btn-danger">
  181. <i class="layui-icon">&#xe640;</i>删除</a>
  182. </td>
  183. <td></td>
  184. <td>分享后回复内容:{$vo.response}</td>
  185. <td>备注:{$vo.remark}</td>
  186. </tr>
  187. {/volist} {/notempty}
  188. </tbody>
  189. </table>
  190. <div class="pager-container" style="margin-top:10px;">
  191. <span>
  192. {$list->total()}条记录
  193. </span>
  194. {$page}
  195. <div class="layui-inline" style="margin:0;margin-left:10px;width:80px">
  196. <input type="text" style="height: 30px;" class="layui-input" placeholder="跳转至" name="page" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
  197. </div>
  198. </div>
  199. </form>
  200. </div>
  201. {/block} {block name="footer"}
  202. <script type="text/javascript" src="__STATIC__/js/admin/bootstrap.min.js"></script>
  203. <!--<script type="text/javascript" src="__STATIC__/js/admin/bootstrap-editable.min.js"></script>-->
  204. <script type="text/javascript" src="__STATIC__/js/admin/bootstrap-table.js"></script>
  205. <script type="text/javascript">
  206. //要使用js渲染表格,不能用属性渲染,否则bootstrap-editable出不来
  207. var $table = $('#objTable');
  208. // $table.bootstrapTable({});
  209. $table.bootstrapTable({
  210. formatNoMatches: function () {
  211. return "暂无数据";
  212. }
  213. });
  214. layui.use(['form', 'laydate'], function () {
  215. var laydate = layui.laydate;
  216. var form = layui.form;
  217. var on_starttime = laydate.render({
  218. elem: '#on_start',
  219. type: 'date',
  220. format: 'yyyy-MM-dd',
  221. done: function (value, dates) {
  222. on_endtime.config.min = {
  223. year: dates.year,
  224. month: dates.month - 1, //关键
  225. date: dates.date,
  226. hours: 0,
  227. minutes: 0,
  228. seconds: 0
  229. };
  230. }
  231. });
  232. var on_endtime = laydate.render({
  233. elem: '#on_end',
  234. type: 'date',
  235. format: 'yyyy-MM-dd',
  236. done: function (value, dates) {
  237. on_starttime.config.max = {
  238. year: dates.year,
  239. month: dates.month - 1, //关键
  240. date: dates.date,
  241. hours: 0,
  242. minutes: 0,
  243. seconds: 0
  244. }
  245. }
  246. });
  247. var cr_starttime = laydate.render({
  248. elem: '#cr_start',
  249. type: 'date',
  250. format: 'yyyy-MM-dd',
  251. done: function (value, dates) {
  252. cr_endtime.config.min = {
  253. year: dates.year,
  254. month: dates.month - 1, //关键
  255. date: dates.date,
  256. hours: 0,
  257. minutes: 0,
  258. seconds: 0
  259. };
  260. }
  261. });
  262. var cr_endtime = laydate.render({
  263. elem: '#cr_end',
  264. type: 'date',
  265. format: 'yyyy-MM-dd',
  266. done: function (value, dates) {
  267. cr_starttime.config.max = {
  268. year: dates.year,
  269. month: dates.month - 1, //关键
  270. date: dates.date,
  271. hours: 0,
  272. minutes: 0,
  273. seconds: 0
  274. }
  275. }
  276. });
  277. })
  278. function detailFormatter(index, row) {
  279. // console.log(row);
  280. var html = [];
  281. var obj = {
  282. 0:"",//checkbox要算入
  283. 1: "礼包名",
  284. 2: "回复内容",
  285. 3:"使用次数",
  286. 4: "创建时间",
  287. 5: "操作",
  288. 6: "分享后回复内容",
  289. 7: "备注",
  290. }
  291. $.each(row, function (key, value) {
  292. if (key > 5) {
  293. html.push('<p><b></b> ' + value + '</p>');
  294. } else {
  295. html.push('<p class="hide"><b></b> ' + value + '</p>');
  296. }
  297. });
  298. return html.join('');
  299. }
  300. $(".download").click(function () {
  301. $.ajax({
  302. type: "post",
  303. url: "{:url('downPoint')}",
  304. async: false,
  305. data: $('.layui-form').serialize(),
  306. dataType: 'json',
  307. timeout: 5000,
  308. success: function (data) {
  309. if (data['code']) {
  310. layer.alert(data['msg']);
  311. } else {
  312. layer.alert(data['msg']);
  313. }
  314. },
  315. error: function () {
  316. layer.alert('网络错误,请重试');
  317. },
  318. });
  319. })
  320. $(".download_1").click(function () {
  321. $.ajax({
  322. type: "post",
  323. url: "{:url('downPointBySelf')}",
  324. async: false,
  325. data: $('.layui-form').serialize(),
  326. dataType: 'json',
  327. timeout: 5000,
  328. success: function (data) {
  329. if (data['code']) {
  330. layer.alert(data['msg']);
  331. } else {
  332. layer.alert(data['msg']);
  333. }
  334. },
  335. error: function () {
  336. layer.alert('网络错误,请重试');
  337. },
  338. });
  339. })
  340. function ajaxDeletePack(url) {
  341. //询问框
  342. layer.confirm('是否确定删除?', {
  343. btn: ['是','否'] //按钮
  344. }, function(){
  345. $.ajax({
  346. type: "post",
  347. url: url,
  348. async: false,
  349. data: '',
  350. dataType: 'json',
  351. timeout: 5000,
  352. success: function (data) {
  353. if (data['code']) {
  354. window.location.reload();
  355. }else {
  356. layer.alert(data['msg']);
  357. }
  358. },
  359. error: function () {
  360. layer.alert('网络错误,请重试');
  361. }
  362. });
  363. }, function(){});
  364. }
  365. </script>
  366. {/block}