人人商城

subscribe.html 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {template 'common/header-gw'}
  2. <style>
  3. .js-test .item:hover{background-color:#f5f5f5;}
  4. </style>
  5. <ol class="breadcrumb">
  6. <li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
  7. <li><a href="{url 'system/welcome'}">系统</a></li>
  8. <li class="active">订阅管理</li>
  9. </ol>
  10. <div class="alert alert-info">
  11. 如果模块测试订阅消息失败,为了不影响系统整体通知,请禁用这些通知失败的模块
  12. </div>
  13. {loop $module_subscribes $module_name $module_value}
  14. <div class="panel panel-default js-test" modulename="{$module_name}">
  15. <div class="panel-heading clearfix">
  16. <div class="pull-right">
  17. <input class="js-flag" type="checkbox" modulename="{$module_name}" {if !in_array($module_name, $module_ban)} checked="checked" {/if}/>
  18. </div>
  19. {$modules[$module_name]['title']} ({$module_name})
  20. </div>
  21. <div class="panel-body clearfix">
  22. {loop $module_value $v}
  23. {if $v != 'text' && $v != 'enter'}
  24. <div class="col-md-3 col-sm-4 col-xs-6 item" style="line-height: 30px; cursor:pointer;">
  25. {$mtypes[$v]}
  26. <p class="pull-right"></p>
  27. </div>
  28. {/if}
  29. {/loop}
  30. </div>
  31. </div>
  32. {/loop}
  33. <script type="text/javascript">
  34. require(['bootstrap.switch'],function($){
  35. $('.js-flag:checkbox').bootstrapSwitch({onText: '启用', offText: '禁用'});
  36. $('.js-flag:checkbox').on('switchChange.bootstrapSwitch', function(event, state) {
  37. var modulename = $(this).attr('modulename');
  38. var ban = state ? 1 : 0;
  39. $.getJSON("{php echo url('extension/subscribe/ban')}", {modulename:modulename, ban:ban}, function(data) {
  40. var data = eval(data.message);
  41. });
  42. });
  43. });
  44. $(function() {
  45. $('.js-test').each(function() {
  46. var modulename = $(this).attr('modulename');
  47. var result = $(this).find('p');
  48. var module_subscribe = $(this).children('.item');
  49. $.post("{php echo url('extension/subscribe/check')}", {modulename:modulename}, function(data){
  50. if(data != 'success') {
  51. result.html('<span class="label label-danger"> 失败</span>');
  52. } else {
  53. result.html('<span class="label label-success"> 正常</span');
  54. }
  55. });
  56. });
  57. });
  58. </script>
  59. {template 'common/footer-gw'}