Browse Source

Merge pull request '设置免登陆' (#31) from wpd_freelogin3 into master

Reviewed-on: #31
pull/34/head
pengda 1 month ago
parent
commit
5e4ce0a55e
  1. 5
      control/index.php
  2. 25
      view/js/subCount.js
  3. 3
      view/templates/index/user_list.html

5
control/index.php

@ -54,7 +54,9 @@ class index extends publicBase {
$user_info = $this->get_user_info();
if (!$user_info['is_super_admin']) $this->ajax_json(false, '您还有此权限');
$condition = array('is_super_admin' => ADMIN_USER_NOT_SUPER);
$condition = array('aid'=>$user_info['aid']);
if ($user_info['aid'] == 0) $condition = array();
$cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1;
$page_size = $this->post('pageSize') ? $this->post('pageSize') : 20;
@ -68,6 +70,7 @@ class index extends publicBase {
'last_page' => ceil($total / $page_size),
'cur_page' => $cur_page,
'list' => $user_list,
'aid' => $user_info['aid'],
);
$this->ajax_json(true, '获取成功', $rdata);

25
view/js/subCount.js

@ -82,22 +82,35 @@ $(document).ready(function () {
function renderData(data){
totalPages = data.last_page;
var pageData = data.list
var login_aid = data.aid
$('#tbody-wrap').empty()
renderList()
var html = '';
pageData.forEach((item)=>{
html += ` <tr data-id="${item.id}">
let aidHtml = '';
if(login_aid == 0){
aidHtml = `<td>${item.aid}</td>`
}
let switchHtml = '';
if((item.is_super_admin == 0 || login_aid == 0) && item.aid>0){
switchHtml = `<label class="switch">
<input type="checkbox" ${item.status == 1 ? 'checked' : ''}>
<span class="slider"></span>
</label>`;
}
html += ` <tr data-id="${item.aid}">
${aidHtml}
<td>${item.nickname}</td>
<td>${item.realname}<img class="action-icon" src="../../images/edit.svg" alt=""></td>
<td>${item.addtime}</td>
<td>
<label class="switch">
<input type="checkbox" ${item.status == 1 ? 'checked' : ''}>
<span class="slider"></span>
</label>
${switchHtml}
</td>
</tr>`
</tr>`
$('#tbody-wrap').html(html)
})

3
view/templates/index/user_list.html

@ -27,6 +27,9 @@
<table id="dataTable">
<thead>
<tr>
{if $_user_info.aid == 0}
<th>AID</th>
{/if}
<th>账号昵称</th>
<th>姓名</th>
<th>添加时间</th>

Loading…
Cancel
Save