人人商城

permission.html 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. {template 'common/header-gw'}
  2. <ol class="breadcrumb">
  3. <li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
  4. <li><a href="{url 'system/welcome'}">系统</a></li>
  5. <li><a href="{url 'account/display'}">公众号列表</a></li>
  6. <li class="active">账号操作员列表</li>
  7. </ol>
  8. {if $_GPC['reference'] != 'solution'}
  9. <ul class="nav nav-tabs">
  10. <li class="active"><a href="{url 'account/permission' array('uniacid' => $uniacid)}">账号操作员列表</a></li>
  11. </ul>
  12. {/if}
  13. <div class="clearfix">
  14. <h5 class="page-header">设置可操作用户</h5>
  15. <div class="alert alert-info">
  16. <i class="fa fa-exclamation-circle"></i> 操作员不允许删除公众号和编辑公众号资料,管理员无此限制
  17. </div>
  18. <div class="panel panel-default">
  19. <div class="panel-body table-responsive">
  20. <table class="table table-hover">
  21. <thead>
  22. <tr>
  23. <th style="width:50px;">选择</th>
  24. <th style="width:80px;">用户ID</th>
  25. <th style="width:150px;">用户名</th>
  26. <th style="width:200px;">角色</th>
  27. <th>操作</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {loop $permission $row}
  32. <tr {if !empty($_GPC['fromuid']) && $_GPC['fromuid']== $row['uid']}style="background:#dddddd;"{/if}>
  33. <td class="row-first">{if !in_array($member[$row['uid']]['uid'], $founders) && $row['role'] != 'owner'}<input class="member" autocomplete="off" type="checkbox" value="{$row['id']}" />{/if}</td>
  34. <td>{$row['uid']}</td>
  35. <td>{$member[$row['uid']]['username']}</td>
  36. <td>
  37. {if in_array($member[$row['uid']]['uid'], $founders)}
  38. <span class="label label-warning">创始人</span>
  39. {elseif $row['role'] == 'owner'}
  40. <span class="label label-warning">主管理员</span>
  41. {else}
  42. <label for="radio_{$row['uid']}_1" class="radio-inline" style="padding-top:0; float:left; width:70px;"><input type="radio" name="role[{$row['uid']}]" targetid="{$row['uid']}" id="radio_{$row['uid']}_1" value="operator" {if empty($row['role']) || $row['role'] == 'operator'} checked{/if} /> 操作员</label>
  43. <label for="radio_{$row['uid']}_2" class="radio-inline" style="padding-top:0; float:left; width:70px;"><input type="radio" name="role[{$row['uid']}]" targetid="{$row['uid']}" id="radio_{$row['uid']}_2" value="manager" {if $row['role'] == 'manager'} checked{/if} /> 管理员</label>
  44. {/if}
  45. </td>
  46. <td>
  47. {if in_array($member[$row['uid']]['uid'], $founders)}
  48. 创始人拥有系统最高权限
  49. {elseif $row['role'] == 'owner'}
  50. 主管理员拥有公众号的所有权限,并且公众号的权限(模块、模板)根据主管理员来获取
  51. {else}
  52. {if $_W['isfounder']}<a href="{php echo url('user/edit', array('uid' => $member[$row['uid']]['uid']));}">编辑用户</a>&nbsp;|&nbsp;{/if}
  53. <a href="{php echo url('user/permission/menu', array('uid' => $member[$row['uid']]['uid'], 'uniacid' => $uniacid));}">设置权限</a>&nbsp;|&nbsp;
  54. <a href="{php echo url('user/permission', array('uid' => $row['uid']))}" target="_blank">查看操作权限</a>
  55. {/if}
  56. </td>
  57. </tr>
  58. {/loop}
  59. </tbody>
  60. <tfoot>
  61. <tr>
  62. <td colspan="5">
  63. {if !empty($_W['isfounder'])}
  64. <input id="btn-add" class="btn btn-default" type="button" value="选择账号操作员">
  65. {/if}
  66. <a class="btn btn-default" href="javascript:;" id="add-user">添加账号操作员</a>
  67. <input id="btn-revo" class="btn btn-default" type="button" value="删除选定操作">
  68. </td>
  69. </tr>
  70. </tfoot>
  71. </table>
  72. </div>
  73. </div>
  74. </div>
  75. <!-- 添加用户模态框 -->
  76. <div class="modal fade" id="user-modal" tabindex="-1" role="dialog">
  77. <div class="modal-dialog">
  78. <form action="{php echo url('account/permission/user')}" method="post" class="form-horizontal" role="form" id="form1">
  79. <div class="modal-content">
  80. <div class="modal-header">
  81. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  82. <h3 class="modal-title" id="myModalLabel">添加账号操作员</h3>
  83. </div>
  84. <div class="modal-body">
  85. <div class="form-group">
  86. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">用户名</label>
  87. <div class="col-sm-10 col-lg-9 col-xs-12">
  88. <input id="" name="username" type="text" class="form-control" value="{$user['username']}" />
  89. <span class="help-block">请输入完整的用户名。你需要让新管理员先去注册一个”新账号“,再把他添加进来。</span>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="modal-footer">
  94. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  95. <input type="submit" class="btn btn-primary" name="submit" value="确认" />
  96. <input type="hidden" name="token" value="{$_W['token']}" />
  97. </div>
  98. </div>
  99. </form>
  100. </div>
  101. </div>
  102. <script type="text/javascript">
  103. var seletedUserIds = {php echo json_encode($uids);};
  104. require(['biz', 'bootstrap'], function(biz){
  105. $(function(){
  106. $('#add-user').click(function(){
  107. $('#user-modal').modal('show');
  108. $('#form1').submit(function(){
  109. var username = $.trim($('#form1 :text[name="username"]').val());
  110. if(!username) {
  111. util.message('没有输入用户名.', '', 'error');
  112. return false;
  113. }
  114. $.post("{php echo url('account/permission/user', array('uniacid' => $uniacid))}", {'username':username}, function(data){
  115. if(data != 'success') {
  116. util.message(data, '', 'error');
  117. } else {
  118. util.message('添加账号操作员成功', "{php echo url('account/permission/', array('uniacid' => $uniacid))}", 'success');
  119. }
  120. });
  121. return false;
  122. });
  123. });
  124. $('#btn-add').click(function(){
  125. biz.user.browser(seletedUserIds, function(us){
  126. $.post('{php echo url('account/permission', array('uniacid' => $uniacid, 'reference' => $_GPC['reference']));}', {'do': 'auth', uid: us}, function(dat){
  127. if(dat == 'success') {
  128. location.reload();
  129. } else {
  130. alert('操作失败, 请稍后重试, 服务器返回信息为: ' + dat);
  131. }
  132. });
  133. },{mode:'invisible'});
  134. });
  135. $('#btn-revo').click(function(){
  136. $chks = $(':checkbox.member:checked');
  137. if($chks.length >0){
  138. if(!confirm('确认删除当前选择的用户?')){
  139. return;
  140. }
  141. var ids = [];
  142. $chks.each(function(){
  143. ids.push(this.value);
  144. });
  145. $.post('{php echo url('account/permission', array('uniacid' => $uniacid));}',{'do':'revos', 'ids': ids},function(dat){
  146. if(dat == 'success') {
  147. location.reload();
  148. } else {
  149. alert('操作失败, 请稍后重试, 服务器返回信息为: ' + dat);
  150. }
  151. });
  152. }
  153. });
  154. $("input[name^='role[']").click(function(){
  155. $.post('{php echo url('account/permission/role', array('uniacid' => $uniacid));}', {'uid' : $(this).attr('targetid'), 'role' : $(this).val()}, function(dat){
  156. if(dat != 'success') {
  157. u.message('设置管理员角色失败', "{php echo url('account/permission', array('uniacid' => $uniacid))}", 'error');
  158. }
  159. });
  160. });
  161. });
  162. });
  163. </script>
  164. {template 'common/footer-gw'}