Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
xinliangnote committed May 15, 2021
1 parent ec3c9f0 commit a6947b5
Show file tree
Hide file tree
Showing 60 changed files with 1,278 additions and 283 deletions.
67 changes: 66 additions & 1 deletion assets/templates/admin/admin_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
<th>手机号</th>
<th>创建日期</th>
<th>更新日期</th>
<th style="text-align: center; ">状态</th>
<th style="text-align: center; ">可用状态</th>
<th style="text-align: center; ">在线状态</th>
<th style="text-align: center; ">操作</th>
</tr>
</thead>
Expand Down Expand Up @@ -102,6 +103,7 @@

$.each(data.list, function (index, value) {
var showUsedBadge = "";
var showOnlineBadge = "";
var optionUsedName = "";

if (value.is_used === 1) {
Expand All @@ -114,6 +116,14 @@
showUsedBadge = '<span class="badge badge-danger">禁用</span></td>'
}

if (value.is_online === 1) {
showOnlineBadge = '<span class="badge btn-primary">在线</span></td>'
}

if (value.is_online === -1) {
showOnlineBadge = '<span class="badge btn-secondary">离线</span></td>'
}

const tr = '<tr>\n' +
'<td>' + value.id + '</td>\n' +
'<td>' + value.username + '</td>\n' +
Expand All @@ -122,6 +132,7 @@
'<td>' + value.created_at + '</td>\n' +
'<td>' + value.updated_at + '</td>\n' +
'<td style="text-align: center; ">' + showUsedBadge + '</td>\n' +
'<td style="text-align: center; ">' + showOnlineBadge + '</td>\n' +
'<td style="text-align: center; ">\n' +
'<div class="btn-group">\n' +
' <a class="btn btn-xs btn-default btn-option" href="#!" title=""\n' +
Expand All @@ -134,6 +145,9 @@
' <a class="btn btn-xs btn-default btn-menu" href="#!" title=""\n' +
' data-id="' + value.hashid + '"' +
' data-toggle="tooltip" data-original-title="菜单授权">菜单授权</a>\n' +
' <a class="btn btn-xs btn-default btn-offline" href="#!" title=""\n' +
' data-id="' + value.hashid + '"' +
' data-toggle="tooltip" data-original-title="下线">下线</a>\n' +
' <a class="btn btn-xs btn-default btn-confirm" href="#!" title=""\n' +
' data-id="' + value.hashid + '"' +
' data-toggle="tooltip" data-original-title="删除">删除</a>\n' +
Expand Down Expand Up @@ -280,6 +294,57 @@
location.href = "/admin/action/" + $(this).attr('data-id');
});

// 下线
$(document).on('click', '.btn-offline', function () {
const id = $(this).attr('data-id');

$.confirm({
title: '谨慎操作',
content: '确认要 <strong style="color: red">下线</strong> 吗?',
icon: 'mdi mdi-alert',
animation: 'scale',
closeAnimation: 'zoom',
buttons: {
okay: {
text: '确认',
keys: ['enter'],
btnClass: 'btn-orange',
action: function () {
AjaxForm(
"PATCH",
'/api/admin/offline',
{id: id},
function () {},
function (data) {
$.alert({
title: '操作成功',
icon: 'mdi mdi-check-decagram',
type: 'green',
content: '编号:' + data.id + ' 已下线。',
buttons: {
okay: {
text: '关闭',
action: function () {
location.reload();
}
}
}
});
},
function (response) {
AjaxError(response);
}
);
}
},
cancel: {
text: '取消',
keys: ['ctrl', 'shift'],
}
}
});
});

// 删除
$(document).on('click', '.btn-confirm', function () {
const id = $(this).attr('data-id');
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="col-md-6 col-lg-4">
<div class="card border-secondary">
<header class="card-header">
<div class="card-title">项目信息</div>
<div class="card-title">项目信息 <span class="badge badge-pill badge-warning">{{ .ProjectVersion }}</span> </div>
</header>
<div class="card-body">
<p>操作系统:{{ .GoOS }} <span class="badge badge-brown"> {{ .GoArch }} </span> <span class="badge badge-info"> {{ .GoVersion }} </span></p>
Expand Down
134 changes: 58 additions & 76 deletions assets/templates/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,90 +22,37 @@
<div class="lyear-layout-container">
<!--左侧导航-->
<aside class="lyear-layout-sidebar">

<!-- logo -->
<div id="logo" class="sidebar-header">
<a href="/">
<img src="bootstrap/images/logo-sidebar.png"/>
</a>
</div>
<div class="lyear-layout-sidebar-info lyear-scroll">
<div class="lyear-layout-sidebar-info lyear-scroll">

<nav class="sidebar-main">
<ul class="nav-drawer">
<li class="nav-item active"> <a class="multitabs" href="/dashboard"><i class="mdi mdi-home"></i> <span>仪表盘</span></a> </li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-settings-box"></i> <span>配置信息</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/config/email">告警邮箱</a> </li>
<li> <a class="multitabs" href="/config/code">错误码</a> </li>
</ul>
</li>

<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-code-not-equal-variant"></i> <span>代码生成器</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/generator/gorm">生成数据表 CURD</a> </li>
<li> <a class="multitabs" href="/generator/handler">生成控制器方法</a> </li>
</ul>
</li>

<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-playlist-check"></i> <span>授权调用方</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/authorized/list">调用方</a> </li>
<li> <a class="multitabs" href="/authorized/demo">使用说明</a> </li>
</ul>
</li>

<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-account"></i> <span>系统管理员</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/admin/list">管理员</a> </li>
<li> <a class="multitabs" href="/admin/menu">菜单管理</a> </li>
</ul>
</li>

<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-database-search"></i> <span>查询小助手</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/tool/cache">查询缓存</a> </li>
<li> <a class="multitabs" href="/tool/data">查询数据</a> </li>
</ul>
</li>

<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)"><i class="mdi mdi-tools"></i> <span>实用工具箱</span></a>
<ul class="nav nav-subnav">
<li> <a class="multitabs" href="/upgrade">服务升级</a> </li>
<li> <a class="multitabs" href="/tool/hashids">Hashids</a> </li>
<li> <a class="multitabs" href="/tool/logs">调用日志</a> </li>
<li> <a target="_blank" href="/swagger/index.html">接口文档</a> </li>
<li> <a target="_blank" href="/graphql">GraphQL</a> </li>
<li> <a target="_blank" href="/metrics">接口指标</a> </li>
</ul>
</li>

</ul>
</nav>
</div>

</aside>
<!--End 左侧导航-->

<!--头部信息-->
<header class="lyear-layout-header">

<nav class="navbar">

<div class="navbar-left">
<div class="lyear-aside-toggler">
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
</div>
</div>

<ul class="navbar-right d-flex align-items-center">

<!--切换主题配色-->
Expand Down Expand Up @@ -152,28 +99,28 @@
<span class="inverse">
<input type="radio" name="header_bg" value="default" id="header_bg_1" checked>
<label for="header_bg_1"></label>
</span>
<span>
</span>
<span>
<input type="radio" name="header_bg" value="color_2" id="header_bg_2">
<label for="header_bg_2"></label>
</span>
<span>
</span>
<span>
<input type="radio" name="header_bg" value="color_3" id="header_bg_3">
<label for="header_bg_3"></label>
</span>
<span>
<input type="radio" name="header_bg" value="color_4" id="header_bg_4">
<label for="header_bg_4"></label>
</span>
<span>
</span>
<span>
<input type="radio" name="header_bg" value="color_5" id="header_bg_5">
<label for="header_bg_5"></label>
</span>
<span>
</span>
<span>
<input type="radio" name="header_bg" value="color_6" id="header_bg_6">
<label for="header_bg_6"></label>
</span>
<span>
</span>
<span>
<input type="radio" name="header_bg" value="color_7" id="header_bg_7">
<label for="header_bg_7"></label>
</span>
Expand Down Expand Up @@ -247,17 +194,17 @@
</li>

</ul>

</nav>

</header>
<!--End 头部信息-->

<!--页面主要内容-->
<main class="lyear-layout-content">

<div id="iframe-content"></div>

</main>
<!--End 页面主要内容-->
</div>
Expand All @@ -281,6 +228,41 @@
function () {},
function (data) {
$("#nickname").html(data.nickname);
$(".nav-drawer").html("");
let li = '<li class="nav-item active"><a class="multitabs" href="/dashboard"><i class="mdi mdi-home"></i> <span>仪表盘</span></a></li>';

if (data.menu.length > 0) {
let newArr = [];
data.menu.forEach(function (v) {
if (v.pid === 0) {
v.children = [];
newArr.push(v)
}
});

data.menu.forEach(function (v) {
newArr.forEach(function (item) {
if (v.pid === item.id) {
item.children.push(v)
}
})
});

$.each(newArr, function (index, value) {
li += '<li class="nav-item nav-item-has-subnav">';
li += '<a href="javascript:void(0)"><i class="mdi '+ value.icon +'"></i> <span>'+ value.name +'</span></a>';
li += '<ul class="nav nav-subnav">';


value.children.forEach(function (item) {
li += '<li> <a class="multitabs" href="'+ item.link +'"> '+ item.name +' </a> </li>';
});

li += '</ul></li>';
});

$(".nav-drawer").html(li);
}
},
function (response) {
AjaxError(response);
Expand Down
Loading

0 comments on commit a6947b5

Please sign in to comment.