sonconfigtab.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <button type="button" class="btn btn-w-m btn-primary add-filed">配置分类</button>
  8. <button type="button" class="btn btn-w-m btn-primary add_filed_base">添加配置</button>
  9. </div>
  10. <div class="ibox-content">
  11. <div class="table-responsive">
  12. <table class="table table-striped table-bordered">
  13. <thead>
  14. <tr>
  15. <th>编号</th>
  16. <th>配置名称</th>
  17. <th>字段变量</th>
  18. <th>字段类型</th>
  19. <th>值</th>
  20. <th>是否显示</th>
  21. <th>操作</th>
  22. </tr>
  23. </thead>
  24. <tbody class="">
  25. {volist name="list" id="vo"}
  26. <tr>
  27. <td class="text-center">
  28. {$vo.id}
  29. </td>
  30. <td class="text-center">
  31. {$vo.info}
  32. </td>
  33. <td class="text-center">
  34. {$vo.menu_name}
  35. </td>
  36. <td class="text-center">
  37. {$vo.type}
  38. </td>
  39. <td class="text-center">
  40. <?php
  41. if($vo['type'] == 'text' || $vo['type'] == 'textarea' || $vo['type'] == 'radio' || $vo['type'] == 'checkbox'){
  42. echo $vo['value'];
  43. }else if($vo['type'] == 'upload'){
  44. if($vo['upload_type'] == 3){
  45. if($vo['value']) {
  46. if(is_array($vo['value'])){
  47. foreach ($vo['value'] as $v){
  48. ?>
  49. <div class="attachment">
  50. <div class="file-box">
  51. <div class="file">
  52. <a href="http://<?php echo $_SERVER['SERVER_NAME'].$v;?>" target="_blank">
  53. <span class="corner"></span>
  54. <div class="icon">
  55. <i class="fa fa-file"></i>
  56. </div>
  57. <div class="file-name">
  58. <?php
  59. //显示带有文件扩展名的文件名
  60. echo basename($v);
  61. ?>
  62. </div>
  63. </a>
  64. </div>
  65. </div>
  66. <div class="clearfix"></div>
  67. </div>
  68. <?php } }else{ ?>
  69. <div class="attachment">
  70. <div class="file-box">
  71. <div class="file">
  72. <a href="http://<?php echo $_SERVER['SERVER_NAME'].$vo['value'];?>" target="_blank">
  73. <span class="corner"></span>
  74. <div class="icon">
  75. <i class="fa fa-file"></i>
  76. </div>
  77. <div class="file-name">
  78. <?php
  79. //显示带有文件扩展名的文件名
  80. echo basename($vo['value']);
  81. ?>
  82. </div>
  83. </a>
  84. </div>
  85. </div>
  86. <div class="clearfix"></div>
  87. </div>
  88. <?php }
  89. }
  90. }else{?>
  91. <div class="attachment">
  92. <?php
  93. if(is_array($vo['value'])){
  94. foreach ($vo['value'] as $v){
  95. ?>
  96. <div class="file-box">
  97. <div class="file">
  98. <span class="corner"></span>
  99. <div class="image" style="cursor: pointer">
  100. <img alt="image" class="img-responsive open_image" data-image="{$v}" src="{$v}">
  101. </div>
  102. <div class="file-name">
  103. <?php
  104. //显示带有文件扩展名的文件名
  105. echo basename($v);
  106. ?>
  107. </div>
  108. </div>
  109. </div>
  110. <?php
  111. }
  112. }else{
  113. ?>
  114. <div class="file-box">
  115. <div class="file">
  116. <span class="corner"></span>
  117. <div class="image" style="cursor: pointer">
  118. <img alt="image" class="img-responsive open_image" data-image="{$vo['value']}" src="{$vo['value']}">
  119. </div>
  120. <div class="file-name">
  121. <?php
  122. //显示带有文件扩展名的文件名
  123. echo basename($vo['value']);
  124. ?>
  125. </div>
  126. </div>
  127. </div>
  128. <?php
  129. }
  130. ?>
  131. <div class="clearfix"></div>
  132. </div>
  133. <?php
  134. }
  135. }
  136. ?>
  137. </td>
  138. <td class="text-center">
  139. {if condition="$vo.status eq 1"}
  140. <i class="fa fa-check text-navy"></i>
  141. {elseif condition="$vo.status eq 2"/}
  142. <i class="fa fa-close text-danger"></i>
  143. {/if}
  144. </td>
  145. <td class="text-center">
  146. <button class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('编辑','{:Url('setting.system_config/edit_config',array('id'=>$vo['id']))}')"><i class="fa fa-edit"></i> 编辑</button>
  147. <button class="btn btn-danger btn-xs del_config_tab" data-id="{$vo.id}" type="button" data-url="{:Url('setting.system_config/delete_config',array('id'=>$vo['id']))}" ><i class="fa fa-times"></i> 删除
  148. </button>
  149. </td>
  150. </tr>
  151. {/volist}
  152. </tbody>
  153. </table>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. {/block}
  160. {block name="script"}
  161. <script>
  162. $('.add-filed').on('click',function (e) {
  163. window.location.replace("{:Url('index')}");
  164. })
  165. $('.open_image').on('click',function (e) {
  166. var image = $(this).data('image');
  167. $eb.openImage(image);
  168. })
  169. $('.del_config_tab').on('click',function(){
  170. var _this = $(this),url =_this.data('url');
  171. $eb.$swal('delete',function(){
  172. $eb.axios.get(url).then(function(res){
  173. if(res.status == 200 && res.data.code == 200) {
  174. $eb.$swal('success',res.data.msg);
  175. _this.parents('tr').remove();
  176. }else
  177. return Promise.reject(res.data.msg || '删除失败')
  178. }).catch(function(err){
  179. $eb.$swal('error',err);
  180. });
  181. })
  182. });
  183. $('.add_filed_base').on('click',function (e) {
  184. $eb.createModalFrame('添加配置字段',"{:Url('setting.systemConfig/create',['tab_id'=>$Request.param.tab_id,'type'=>0])}");
  185. // $eb.swal({
  186. // title: '请选择数据类型',
  187. // input: 'radio',
  188. // inputOptions: ['文本框','多行文本框','单选框','文件上传','多选框'],
  189. // inputValidator: function(result) {
  190. // return new Promise(function(resolve, reject) {
  191. // if (result) {
  192. // resolve();
  193. // } else {
  194. // reject('请选择数据类型');
  195. // }
  196. // });
  197. // }
  198. // }).then(function(result) {
  199. // if (result) {
  200. // $eb.createModalFrame(this.innerText,"{:Url('setting.systemConfig/create',array('tab_id'=>$Request.param.tab_id))}?type="+result);
  201. // }
  202. // })
  203. })
  204. </script>
  205. {/block}