Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<first-menu>
<menu-item href="/log" code="list">查询</menu-item>
<span class="item disabled">|</span>
<menu-item href="/log/clean" code="clean" v-if="logConfig.canClean">清理</menu-item>
<menu-item href="/log/settings" code="setting">设置</menu-item>
</first-menu>

View File

@@ -0,0 +1,31 @@
{$layout}
{$template "menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<!--<tr>
<td>当前用量</td>
<td>{{size}}</td>
</tr>-->
<tr>
<td class="title" :class="{'color-border':cleanType == 'days'}">清理方式</td>
<td>
<radio name="type" v-model="cleanType" :v-value="'all'">全部清除</radio> &nbsp; &nbsp;
<radio name="type" v-model="cleanType" :v-value="'days'">按天数清除</radio>
</td>
</tr>
<tr v-show="cleanType == 'days'">
<td :class="{'color-border':cleanType == 'days'}">天数</td>
<td>
<div class="ui input right labeled">
<input type="text" name="days" v-model="days" style="width:5em" maxlength="3"/>
<span class="ui label">天以外</span>
</div>
<p class="comment">表示清除此天数以外的日志数据。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,6 @@
Tea.context(function () {
this.cleanType = "all"
this.days = 30
this.success = NotifyReloadSuccess("清理完成")
})

View File

@@ -0,0 +1,8 @@
.log-row {
position: relative;
}
.log-row .buttons {
position: absolute;
right: 1em;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;;AADD,QAGC;EACC,kBAAA;EACA,UAAA","file":"index.css"}

View File

@@ -0,0 +1,61 @@
{$layout}
{$template "menu"}
{$template "/datepicker"}
<div class="margin"></div>
<form method="get" action="/log" class="ui form" autocomplete="off">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="dayFrom" placeholder="开始日期" v-model="dayFrom" value="" style="width:8em" id="day-from-picker"/>
</div>
<div class="ui field">
<input type="text" name="dayTo" placeholder="结束日期" v-model="dayTo" value="" style="width:8em" id="day-to-picker"/>
</div>
<div class="ui field">
<input type="text" name="keyword" style="width:10em" v-model="keyword" placeholder="关键词"/>
</div>
<div class="ui field">
<select class="ui dropdown" name="level" v-model="level">
<option value="">[级别]</option>
<option v-for="levelOption in levelOptions" :value="levelOption.code">{{levelOption.name}}</option>
</select>
</div>
<div class="ui field">
<select class="ui dropdown auto-width" name="userType" v-model="userType">
<option value="">[用户类型]</option>
<option value="admin">管理员</option>
<option value="user">用户</option>
</select>
</div>
<div class="ui field">
<button type="submit" class="ui button">查询</button>
</div>
<div class="ui field" v-if="dayFrom.length > 0 || dayTo.length > 0 || keyword.length > 0 || level.length > 0">
<a href="/log">[清除条件]</a>
</div>
<div class="ui field">
<a href="" @click.prevent="exportExcel">[导出到Excel]</a>
</div>
</div>
</form>
<div v-if="logs.length == 0">
<div class="ui margin"></div>
<p class="comment">暂时还没有日志。</p>
</div>
<table class="ui table selectable" v-for="log in logs">
<tr :class="{error: log.level == 'error', warning: log.level == 'warn'}">
<td class="log-row">{{log.createdTime}} <span class="grey"> <span
v-if="log.userName.length > 0">| <span v-if="log.userId>0">用户 &nbsp;|&nbsp;</span> {{log.userName}}</span> | <keyword :v-word="keyword">{{log.ip}}</keyword><span
v-if="log.region.length > 0"> | {{log.region}}</span> &nbsp; <a href="" @click.prevent="showMore(log)" title="显示更多">...</a> &nbsp;<span v-if="log.moreVisible">{{log.action}}</span></span>
<span class="buttons"><a v-if="logConfig.canDelete" href="" title="删除" @click.prevent="deleteLog(log.id)"><i class="icon remove small"></i></a> </span>
</td>
</tr>
<tr :class="{error: log.level == 'error', warning: log.level == 'warn'}">
<td><keyword :v-word="keyword">{{log.description}}</keyword></td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,32 @@
Tea.context(function () {
this.$delay(function () {
teaweb.datepicker("day-from-picker")
teaweb.datepicker("day-to-picker")
})
this.logs.forEach(function (v) {
v.moreVisible = false
})
this.showMore = function (log) {
log.moreVisible = !log.moreVisible
}
this.exportExcel = function () {
let that = this
teaweb.confirm("确定要将当前列表导出到Excel吗", function () {
window.location = "/log/exportExcel?dayFrom=" + that.dayFrom + "&dayTo=" + that.dayTo + "&keyword=" + that.keyword + "&userType=" + that.userType + '&level=' + that.level
})
}
this.deleteLog = function (logId) {
let that = this
teaweb.confirm("确定要删除此日志吗?", function () {
that.$post(".delete")
.params({
logId: logId
})
.refresh()
})
}
})

View File

@@ -0,0 +1,8 @@
.log-row {
position: relative;
.buttons {
position: absolute;
right: 1em;
}
}

View File

@@ -0,0 +1,44 @@
{$layout}
{$template "menu"}
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr v-show="logConfig.canChange">
<td class="title">允许手动删除日志</td>
<td>
<checkbox name="canDelete" v-model="logConfig.canDelete"></checkbox>
</td>
</tr>
<tr v-show="logConfig.canChange">
<td>允许手动清理</td>
<td>
<checkbox name="canClean" v-model="logConfig.canClean"></checkbox>
</td>
</tr>
<tr v-show="logConfig.canChange">
<td class="title">日志保留天数</td>
<td>
<input type="text" name="days" v-model="logConfig.days" style="width:5em" maxlength="3"/>
<p class="comment">超过此天数的日志将会被自动清理0表示不自动清理。</p>
</td>
</tr>
<tr>
<td class="title">最大容量限制</td>
<td>
<size-capacity-box :v-name="'capacityJSON'" :v-value="logConfig.capacity"></size-capacity-box>
<p class="comment">超出此容量限制后将会发送提醒。</p>
</td>
</tr>
<tr v-show="logConfig.canChange">
<td>允许修改清除配置</td>
<td>
<checkbox name="canChange" v-model="logConfig.canChange"></checkbox>
<p class="comment">选中后,不能再次修改删除、清理等相关设置,防止攻击者用来擦除日志。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})