1
0
mirror of https://gitee.com/zoujingli/ThinkAdmin.git synced 2025-04-06 03:58:04 +08:00

Update error.tpl

This commit is contained in:
邹景立 2021-03-24 17:47:48 +08:00
parent 7030c900d9
commit 6def8f617d

@ -161,8 +161,8 @@ if (!function_exists('echo_value')) {
} }
.echo pre > pre { .echo pre > pre {
margin: 0;
padding: 0; padding: 0;
margin: 0;
} }
/* Exception Info */ /* Exception Info */
@ -171,11 +171,11 @@ if (!function_exists('echo_value')) {
} }
.exception .message { .exception .message {
border: 1px solid #ddd;
padding: 12px; padding: 12px;
font-size: 16px; border: 1px solid #ddd;
line-height: 18px;
border-bottom: 0 none; border-bottom: 0 none;
line-height: 18px;
font-size: 16px;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif; font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif;
@ -192,10 +192,12 @@ if (!function_exists('echo_value')) {
} }
.exception .source-code { .exception .source-code {
border: 1px solid #ddd;
padding: 6px; padding: 6px;
overflow-x: auto; border: 1px solid #ddd;
background: #f9f9f9; background: #f9f9f9;
overflow-x: auto;
} }
.exception .source-code pre { .exception .source-code pre {
@ -207,24 +209,25 @@ if (!function_exists('echo_value')) {
color: #4288ce; color: #4288ce;
display: inline-block; display: inline-block;
min-width: 100%; min-width: 100%;
font-size: 14px;
box-sizing: border-box; box-sizing: border-box;
font-size: 14px;
font-family: "Century Gothic", Consolas, "Liberation Mono", Courier, Verdana, serif; font-family: "Century Gothic", Consolas, "Liberation Mono", Courier, Verdana, serif;
padding-left: <?php echo (isset($source) && ! empty($source)) ? parse_padding($source): 40;?> px; padding-left: < ? php echo (isset($ source) & & ! empty($ source)) ? parse_padding($ source): 40;
? > px;
} }
.exception .source-code pre li { .exception .source-code pre li {
border-left: 1px solid #ddd;
height: 18px; height: 18px;
line-height: 18px; line-height: 18px;
border-left: 1px solid #ddd;
} }
.exception .source-code pre code { .exception .source-code pre code {
color: #333; color: #333;
height: 100%; height: 100%;
font-size: 14px;
display: inline-block; display: inline-block;
border-left: 1px solid #fff; border-left: 1px solid #fff;
font-size: 14px;
font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif; font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif;
} }
@ -371,7 +374,7 @@ if (!function_exists('echo_value')) {
</head> </head>
<body> <body>
<?php if (\think\facade\App::isDebug()) { ?> <?php if (\think\facade\App::isDebug()) { ?>
<?php if (isset($traces)) foreach ($traces as $index => $trace) { ?> <?php foreach ($traces as $index => $trace) { ?>
<div class="exception"> <div class="exception">
<div class="message"> <div class="message">
<div class="info"> <div class="info">
@ -383,16 +386,7 @@ if (!function_exists('echo_value')) {
</div> </div>
<?php if (!empty($trace['source'])) { ?> <?php if (!empty($trace['source'])) { ?>
<div class="source-code"> <div class="source-code">
<pre class="prettyprint lang-php"> <pre class="prettyprint lang-php"><ol start="<?php echo $trace['source']['first']; ?>"><?php foreach ((array)$trace['source']['source'] as $key => $value) { ?><li class="line-<?php echo " {$index}-" . ($key + $trace['source']['first']) . ($trace['line'] === $key + $trace['source']['first'] ? ' line-error' : ''); ?>"><code><?php echo htmlentities($value); ?></code></li><?php } ?></ol></pre>
<?php
echo "<ol start='{$trace['source']['first']}'>";
foreach ((array)$trace['source']['source'] as $key => $value) {
$class = " {$index}-" . ($key + $trace['source']['first']) . ($trace['line'] === $key + $trace['source']['first'] ? ' line-error' : '');
echo "<li class='{$class}'><code>" . htmlentities($value) . "</code></li>";
}
echo "</ol>";
?>
</pre>
</div> </div>
<?php } ?> <?php } ?>
<div class="trace"> <div class="trace">
@ -412,6 +406,7 @@ if (!function_exists('echo_value')) {
isset($value['args']) ? parse_args($value['args']) : '' isset($value['args']) ? parse_args($value['args']) : ''
); );
} }
// Show line // Show line
if (isset($value['file']) && isset($value['line'])) { if (isset($value['file']) && isset($value['line'])) {
echo sprintf(' in %s', parse_file($value['file'], $value['line'])); echo sprintf(' in %s', parse_file($value['file'], $value['line']));
@ -479,6 +474,7 @@ if (!function_exists('echo_value')) {
<script> <script>
function $(selector, node) { function $(selector, node) {
var elements; var elements;
node = node || document; node = node || document;
if (document.querySelectorAll) { if (document.querySelectorAll) {
elements = node.querySelectorAll(selector); elements = node.querySelectorAll(selector);
@ -501,36 +497,49 @@ if (!function_exists('echo_value')) {
return elements; return elements;
function get_elements_by_class(search_class, node, tag) { function get_elements_by_class(search_class, node, tag) {
var elements = [], eles, pattern = new RegExp('(^|\\s)' + search_class + '(\\s|$)'); var elements = [], eles,
node = node || document, tag = tag || '*', eles = node.getElementsByTagName(tag); pattern = new RegExp('(^|\\s)' + search_class + '(\\s|$)');
node = node || document;
tag = tag || '*';
eles = node.getElementsByTagName(tag);
for (var i = 0; i < eles.length; i++) { for (var i = 0; i < eles.length; i++) {
if (pattern.test(eles[i].className)) { if (pattern.test(eles[i].className)) {
elements.push(eles[i]) elements.push(eles[i])
} }
} }
return elements; return elements;
} }
} }
$.getScript = function (src, func) { $.getScript = function (src, func) {
var script = document.createElement('script'); var script = document.createElement('script');
script.src = src;
script.async = 'async'; script.async = 'async';
script.src = src;
script.onload = func || function () { script.onload = func || function () {
}; };
$('head')[0].appendChild(script); $('head')[0].appendChild(script);
} }
;(function () { ;(function () {
var files = $('.toggle'); var files = $('.toggle');
var ol = $('ol', $('.prettyprint')[0]);
var li = $('li', ol[0]);
// 短路径和长路径变换 // 短路径和长路径变换
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
files[i].ondblclick = function () { files[i].ondblclick = function () {
var title = this.title; var title = this.title;
this.title = this.innerHTML; this.title = this.innerHTML;
this.innerHTML = title; this.innerHTML = title;
} }
} }
(function () { (function () {
var expand = function (dom, expand) { var expand = function (dom, expand) {
var ol = $('ol', dom.parentNode)[0]; var ol = $('ol', dom.parentNode)[0];