截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {layout name="layout1" /}
  2. <style>
  3. #card-body {
  4. margin-top: 20px;
  5. }
  6. </style>
  7. <div class="wrapper">
  8. <div class="layui-card">
  9. <div class="layui-card-body" >
  10. <div class="layui-form" lay-filter="layuiadmin-form-hot_search" id="layuiadmin-form-hot_search">
  11. <div class="layui-form-item div-flex" style="margin-top: 20px">
  12. <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
  13. <legend>热门搜索设置</legend>
  14. </fieldset>
  15. </div>
  16. <div class="layui-card-body" id="card-body">
  17. {foreach $info as $k => $v }
  18. <div class="layui-form-item">
  19. {eq name="$k" value="0"}
  20. <label class="layui-form-label">热门搜索:</label>
  21. {else/}
  22. <label class="layui-form-label"></label>
  23. {/eq}
  24. <div class="layui-input-inline">
  25. <input type="text" name="hot_keyword[]" value="{$v}" placeholder="请输入热门搜索关键字" lay-verify="" autocomplete="off" class="layui-input">
  26. </div>
  27. <button class="layui-btn layui-btn-small {$view_theme_button} add " type="button" ><i class="layui-icon"></i></button>
  28. {gt name="$k" value="0"}
  29. <button class="layui-btn layui-btn-small layui-btn-danger del" type="button" ><i class="layui-icon"></i></button>
  30. {/gt}
  31. </div>
  32. {/foreach}
  33. <div class="layui-form-item">
  34. <div class="layui-input-block">
  35. <button class="layui-btn {$view_theme_color}" lay-submit lay-filter="set_hot_keyword">确认修改</button>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <script>
  44. layui.config({
  45. version:"{$front_version}",
  46. base: '/static/lib/' //静态资源所在路径
  47. }).use(['form','element'], function(){
  48. var $ = layui.$,form = layui.form,element = layui.element;
  49. // 添加
  50. $(document).on('click','.add',function(){
  51. var len = $(this).parent().prevAll().length + 1;
  52. var str = "";
  53. str += "<div class='layui-form-item'>";
  54. str += "<label class='layui-form-label'></label>";
  55. str += "<div class='layui-input-inline' >";
  56. str += "<input type='text' name='hot_keyword[]' value='' placeholder='请输入热门搜索关键字' lay-verify='' autocomplete='off' class='layui-input'>";
  57. str += "</div>";
  58. str += "<button class='layui-btn layui-btn-small {$view_theme_button} add' type='button'><i class='layui-icon'></i></button>";
  59. if ( len >= 1 ) {
  60. str += "<button class='layui-btn layui-btn-small layui-btn-danger del' type='button' ><i class='layui-icon'></i></button>";
  61. }
  62. str += "</div>";
  63. $(this).parent().after(str);
  64. });
  65. $(document).on('click','.del',function(){
  66. var len = $(this).parent().prevAll().length + 1;
  67. if ( len == 1 ){
  68. layer.msg('不能删除');
  69. return;
  70. }
  71. $(this).parent().remove();
  72. });
  73. form.on('submit(set_hot_keyword)',function (data) {
  74. like.ajax({
  75. url: '{:url("setting.HotSearch/set")}'
  76. ,data: data.field
  77. ,type: 'post'
  78. ,success: function(res){
  79. if(res.code == 1)
  80. {
  81. layer.msg(res.msg, {
  82. offset: '15px'
  83. ,icon: 1
  84. ,time: 1500
  85. }, function(){
  86. location.href = location.href;
  87. });
  88. }
  89. },
  90. error:function(res){
  91. layer.msg('网络错误', {
  92. offset: '15px'
  93. ,icon: 2
  94. ,time: 1000
  95. }, function(){
  96. return;
  97. });
  98. }
  99. });
  100. });
  101. });
  102. </script>