mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-07-07 16:51:17 +08:00
Compare commits
7 Commits
4d1ff2c46a
...
c404534ea7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c404534ea7 | ||
|
|
877fa73043 | ||
|
|
87e3871da4 | ||
|
|
a32a01b2e1 | ||
|
|
e7a326e9d7 | ||
|
|
7ea65bbf0c | ||
|
|
4b8e12919c |
@ -87,18 +87,10 @@ class Config extends Controller
|
||||
}
|
||||
// 修改网站 ICON 图标文件,替换 public/favicon.ico 文件
|
||||
if (preg_match('#^https?://#', $icon = $post['site_icon'] ?? '')) try {
|
||||
if (preg_match('#/upload/(\w{2}/\w{30}.\w+)$#', $icon, $vars)) {
|
||||
$info = LocalStorage::instance()->info($vars[1]);
|
||||
}
|
||||
if (empty($info) || empty($info['file'])) {
|
||||
$info = LocalStorage::down($icon);
|
||||
}
|
||||
if (!empty($info) && !empty($info['file'])) {
|
||||
$favicon = new FaviconExtend($info['file']);
|
||||
$favicon->saveIco("{$this->app->getRootPath()}public/favicon.ico");
|
||||
}
|
||||
SystemService::instance()->setFavicon($icon);
|
||||
} catch (\Exception $exception) {
|
||||
trace_file($exception);
|
||||
$this->error($exception->getMessage());
|
||||
}
|
||||
// 数据数据到系统配置表
|
||||
foreach ($post as $k => $v) sysconf($k, $v);
|
||||
|
||||
@ -42,9 +42,11 @@
|
||||
<div class="help-label label-required-prev"><b>浏览器小图标</b>Browser Icon</div>
|
||||
<label class="relative block label-required-null">
|
||||
<input class="layui-input" required pattern="^(http|/)" placeholder="请上传浏览器图标" value="{:sysconf('site_icon')}" name="site_icon">
|
||||
<a class="input-right-icon layui-icon layui-icon-upload-drag" data-file="btn" data-type="ico,png,jpg" data-field="site_icon"></a>
|
||||
<a class="input-right-icon layui-icon layui-icon-upload-drag" data-file="btn" data-type="png,jpg,jpeg" data-field="site_icon"></a>
|
||||
</label>
|
||||
<span class="help-block">建议上传 <span class="color-blue">128x128</span> | <span class="color-blue">256x256</span> 的 ico 或 png 图片,可以通过 <a href="https://www.favicon-icon-generator.com" target="_blank">ICON </a>在线制作 ico 后缀文件 ~</span>
|
||||
<div class="help-block sub-span-blue">
|
||||
建议上传 <span>128x128</span> 或 <span>256x256</span> 的 <span>JPG</span>,<span>PNG</span>,<span>JPEG</span> 图片,保存后会自动生成 <span>48x48</span> 的 <span>ICO</span> 文件 ~
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row layui-col-space15 margin-bottom-5">
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=0.4">
|
||||
<link rel="shortcut icon" href="{:sysconf('site_icon')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/plugs/layui/css/layui.css?at={:date('md')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/theme/css/iconfont.css?at={:date('md')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/theme/css/console.css?at={:date('md')}">
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=0.4">
|
||||
<link rel="shortcut icon" href="{:sysconf('site_icon')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/plugs/layui/css/layui.css?at={:date('md')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/theme/css/iconfont.css?at={:date('md')}">
|
||||
<link rel="stylesheet" href="__ROOT__/static/theme/css/console.css?at={:date('md')}">
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 200 KiB |
@ -117,7 +117,7 @@ $(function () {
|
||||
temp = [], regx = new RegExp(/^{(.*?)}$/);
|
||||
if (regx.test(rule[idx1]) && (field = rule[idx1].replace(regx, '$1'))) {
|
||||
for (idx2 in json) if (json[idx2][field]) temp.push(json[idx2][field]);
|
||||
if (temp.length < 1) return $.msg.tips('请选择需要更改的数据!'), false;
|
||||
if (temp.length < 1) return $.msg.tips('请选择需要更改的数据!') , false;
|
||||
data[idx1] = temp.join(',');
|
||||
} else {
|
||||
data[idx1] = rule[idx1];
|
||||
@ -131,7 +131,7 @@ $(function () {
|
||||
});
|
||||
return array.length > 0 ? rule.replace('{key}', array.join(',')) : '';
|
||||
})(elem.dataset.rule || '', []) || '';
|
||||
if (value.length < 1) return $.msg.tips('请选择需要更改的数据!'), false;
|
||||
if (value.length < 1) return $.msg.tips('请选择需要更改的数据!') , false;
|
||||
return value.split(';').forEach(function (item) {
|
||||
data[item.split('#')[0]] = item.split('#')[1];
|
||||
}), data;
|
||||
@ -219,13 +219,12 @@ $(function () {
|
||||
this.selecter = '.layui-layout-admin>.layui-body>.think-page-body';
|
||||
/*! 刷新当前页面 */
|
||||
this.reload = function (force) {
|
||||
if (force) top.location.reload();
|
||||
else if (self !== top) location.reload();
|
||||
else window.onhashchange.call(this);
|
||||
force ? top.location.reload() : (self !== top ? location.reload() : window.onhashchange.call(this));
|
||||
};
|
||||
/*! 内容区域动态加载后初始化 */
|
||||
this.reInit = function ($dom) {
|
||||
$(window).trigger('scroll'), $.vali.listen(this), $dom = $dom || $(this.selecter);
|
||||
layui.element.render(), layui.form.render();
|
||||
$(window).trigger('scroll'), $.vali.listen(), $dom = $dom || $(this.selecter);
|
||||
return $dom.find('[required]').map(function ($parent) {
|
||||
if (($parent = $(this).parent()) && $parent.is('label')) {
|
||||
$parent.addClass('label-required-prev');
|
||||
@ -245,21 +244,15 @@ $(function () {
|
||||
}
|
||||
});
|
||||
}), $dom.find('[data-lazy-src]:not([data-lazy-loaded])').each(function () {
|
||||
if (this.dataset.lazyLoaded !== 'true') {
|
||||
this.dataset.lazyLoaded = "true";
|
||||
if (this.nodeName === 'IMG') {
|
||||
this.src = this.dataset.lazySrc;
|
||||
} else {
|
||||
this.style.backgroundImage = 'url(' + this.dataset.lazySrc + ')';
|
||||
}
|
||||
}
|
||||
if (this.dataset.lazyLoaded === 'true') return;
|
||||
this.dataset.lazyLoaded = 'true';
|
||||
if (this.nodeName === 'IMG') this.src = this.dataset.lazySrc;
|
||||
else this.style.backgroundImage = 'url(' + this.dataset.lazySrc + ')';
|
||||
}), $dom;
|
||||
};
|
||||
/*! 在内容区显示视图 */
|
||||
this.show = function (html) {
|
||||
$(this.selecter).html(html), setTimeout(function () {
|
||||
that.reInit($(that.selecter));
|
||||
}, 500);
|
||||
return that.reInit($(this.selecter).html(html));
|
||||
};
|
||||
/*! 异步加载的数据 */
|
||||
this.load = function (url, data, method, callable, loading, tips, time, headers) {
|
||||
@ -299,15 +292,15 @@ $(function () {
|
||||
};
|
||||
/*! 以 HASH 打开新网页 */
|
||||
this.href = function (url, ele) {
|
||||
// 重置表格页数缓存
|
||||
if (ele && ele.dataset.menuNode) layui.sessionData('pages', null);
|
||||
if (url !== '#') location.hash = $.menu.parseUri(url, ele);
|
||||
else if (ele && ele.dataset.menuNode) $('[data-menu-node^="' + ele.dataset.menuNode + '-"]:first').trigger('click');
|
||||
var isNode = ele && ele.dataset.menuNode;
|
||||
isNode && layui.sessionData('pages', null);
|
||||
if (url !== '#') return location.hash = $.menu.parseUri(url, ele);
|
||||
isNode && $('[data-menu-node^="' + ele.dataset.menuNode + '-"]:first').trigger('click');
|
||||
};
|
||||
/*! 加载 HTML 到 BODY 位置 */
|
||||
this.open = function (url, data, call, load, tips) {
|
||||
this.load(url, data, 'get', function (ret) {
|
||||
return (typeof ret === 'object' ? $.msg.auto(ret) : that.show(ret)), false;
|
||||
return (typeof ret === 'object' ? $.msg.auto(ret) : that.show(ret)) , false;
|
||||
}, load, tips);
|
||||
};
|
||||
/*! 打开 IFRAME 窗口 */
|
||||
@ -317,7 +310,7 @@ $(function () {
|
||||
/*! 加载 HTML 到弹出层 */
|
||||
this.modal = function (url, data, name, call, load, tips, area, offset) {
|
||||
this.load(url, data, 'GET', function (res) {
|
||||
if (typeof res === 'object') return $.msg.auto(res) && false;
|
||||
if (typeof res === 'object') return $.msg.auto(res) , false;
|
||||
return $.msg.mdx.push(layer.open({
|
||||
type: 1, btn: false, area: area || "800px", resize: false, content: res, title: name || '', offset: offset || 'auto', success: function ($dom, idx) {
|
||||
$.form.reInit($dom.off('click', '[data-close]').on('click', '[data-close]', function () {
|
||||
@ -328,7 +321,7 @@ $(function () {
|
||||
});
|
||||
})) && typeof call === 'function' && call.call(that, $dom);
|
||||
}
|
||||
})) && false;
|
||||
})) , false;
|
||||
}, load, tips);
|
||||
};
|
||||
};
|
||||
@ -471,13 +464,11 @@ $(function () {
|
||||
return this.isRegex(input) ? (this.hideError(input), true) : this.remind(input);
|
||||
}, this.remind = function (input) {
|
||||
if (!$(input).is(':visible')) return true;
|
||||
return this.showError(input, input.getAttribute('title') || input.getAttribute('placeholder') || '输入错误'), false;
|
||||
return this.showError(input, input.getAttribute('title') || input.getAttribute('placeholder') || '输入错误') , false;
|
||||
}, this.showError = function (ele, tip) {
|
||||
$(ele).addClass('validate-error');
|
||||
this.insertError(ele).addClass('layui-anim-fadein').css({width: 'auto'}).html(tip);
|
||||
this.insertError($(ele).addClass('validate-error')).addClass('layui-anim-fadein').css({width: 'auto'}).html(tip);
|
||||
}, this.hideError = function (ele) {
|
||||
$(ele).removeClass('validate-error');
|
||||
this.insertError(ele).removeClass('layui-anim-fadein').css({width: '30px'}).html('');
|
||||
this.insertError($(ele).removeClass('validate-error')).removeClass('layui-anim-fadein').css({width: '30px'}).html('');
|
||||
}, this.insertError = function (ele) {
|
||||
if ($(ele).data('input-info')) return $(ele).data('input-info');
|
||||
var $html = $('<span class="absolute block layui-anim text-center font-s12 notselect" style="color:#A44;z-index:2"></span>');
|
||||
@ -486,10 +477,10 @@ $(function () {
|
||||
return $(ele).data('input-info', $html.css(style).insertAfter(ele)), $html;
|
||||
};
|
||||
/*! 表单元素验证 */
|
||||
this.form.attr({onsubmit: 'return false;', novalidate: 'novalidate'});
|
||||
this.form.attr({onsubmit: 'return false;', novalidate: 'novalidate', autocomplete: 'off'});
|
||||
this.form.off(this.evts, this.tags).on(this.evts, this.tags, function () {
|
||||
that.checkInput(this);
|
||||
}).attr('novalidate', 'novalidate').data('validate', this).bind("submit", function (evt) {
|
||||
}).data('validate', this).bind("submit", function (evt) {
|
||||
evt.button = that.form.find('button[type=submit],button:not([type=button])');
|
||||
/* 检查所有表单元素是否通过H5的规则验证 */
|
||||
if (that.checkAllInput() && typeof callable === 'function') {
|
||||
@ -503,7 +494,7 @@ $(function () {
|
||||
that.form.removeAttr('submit-locked'), evt.button.removeClass('submit-button-loading');
|
||||
}, 3000);
|
||||
}
|
||||
return evt.preventDefault(), false;
|
||||
return evt.preventDefault() , false;
|
||||
}).find('[data-form-loaded]').map(function () {
|
||||
$(this).html(this.dataset.formLoaded || this.innerHTML);
|
||||
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
|
||||
@ -523,7 +514,7 @@ $(function () {
|
||||
return $.msg.success(ret.info, 3, function () {
|
||||
(typeof ret.data === 'string' && ret.data) ? location.href = ret.data : $('#' + taid).trigger('reload');
|
||||
$.msg.close($.msg.mdx.length > 0 ? $.msg.mdx.pop() : null);
|
||||
}) && false;
|
||||
}) , false;
|
||||
}
|
||||
} : undefined);
|
||||
(function (confirm, callable) {
|
||||
@ -755,7 +746,7 @@ $(function () {
|
||||
/*! 显示任务进度消息 */
|
||||
$.loadQueue = function (code, doScript, element) {
|
||||
var doAjax = true, doReload = false;
|
||||
layui.layer.open({
|
||||
layer.open({
|
||||
type: 1, title: false, area: ['560px', '315px'], anim: 2, shadeClose: false, end: function () {
|
||||
doAjax = false;
|
||||
if (doReload && doScript) {
|
||||
@ -814,7 +805,7 @@ $(function () {
|
||||
that.$percent.attr('lay-percent', (parseFloat(ret.data.progress || '0.00').toFixed(2)) + '%'), layui.element.render();
|
||||
that.$coder.html('<p class="layui-elip">' + lines.join('</p><p class="layui-elip">') + '</p>').animate({scrollTop: that.$coder[0].scrollHeight + 'px'}, 200);
|
||||
return parseInt(ret.data.status) === 3 || parseInt(ret.data.status) === 4 || setTimeout(that.LoadProgress, Math.floor(Math.random() * 200)), false;
|
||||
} else return setTimeout(that.LoadProgress, Math.floor(Math.random() * 500) + 200), false;
|
||||
} else return setTimeout(that.LoadProgress, Math.floor(Math.random() * 500) + 200) , false;
|
||||
}
|
||||
}, false);
|
||||
})();
|
||||
@ -854,12 +845,11 @@ $(function () {
|
||||
(function (confirm, callable) {
|
||||
confirm ? $.msg.confirm(confirm, callable) : callable();
|
||||
})(emap.confirm, function () {
|
||||
var call = !emap.tableId ? false : function (ret) {
|
||||
$.form.load(emap.load, data, 'get', !emap.tableId ? false : function (ret) {
|
||||
if (ret.code > 0) return $.msg.success(ret.info, 3, function () {
|
||||
$('#' + emap.tableId).trigger('reload');
|
||||
}), false;
|
||||
}
|
||||
$.form.load(emap.load, data, 'get', call, true, emap.tips, emap.time);
|
||||
}) , false;
|
||||
}, true, emap.tips, emap.time);
|
||||
});
|
||||
});
|
||||
|
||||
@ -899,7 +889,7 @@ $(function () {
|
||||
confirm ? $.msg.confirm(confirm, callable) : callable();
|
||||
})(emap.confirm, function () {
|
||||
$.form.load(emap.actionBlur || emap.blurAction, data, emap.method || 'post', function (ret) {
|
||||
return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red'), false;
|
||||
return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red') , false;
|
||||
}, emap.loading !== 'false', emap.loading, emap.time)
|
||||
});
|
||||
});
|
||||
@ -931,7 +921,7 @@ $(function () {
|
||||
var call = !emap.tableId ? false : function (ret) {
|
||||
if (ret.code > 0) return $.msg.success(ret.info, 3, function () {
|
||||
$('#' + emap.tableId).trigger('reload');
|
||||
}), false;
|
||||
}) , false;
|
||||
}
|
||||
$.form.load(emap.action, data, emap.method || 'post', call, load, tips, emap.time)
|
||||
});
|
||||
@ -981,7 +971,7 @@ $(function () {
|
||||
})(this.dataset.confirm, function () {
|
||||
$.form.load(that.dataset.queue, {}, 'post', function (ret) {
|
||||
if (typeof ret.data === 'string' && ret.data.indexOf('Q') === 0) {
|
||||
return $.loadQueue(ret.data, true, that), false;
|
||||
return $.loadQueue(ret.data, true, that) , false;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -992,7 +982,7 @@ $(function () {
|
||||
var opts = {tips: [$(this).attr('data-tips-type') || 3, '#78BA32'], time: 0};
|
||||
var layidx = layer.tips($(this).attr('data-tips-text') || this.innerText, this, opts);
|
||||
$(this).off('mouseleave').on('mouseleave', function () {
|
||||
setTimeout("layui.layer.close('" + layidx + "')", 100);
|
||||
setTimeout("layer.close('" + layidx + "')", 100);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1003,7 +993,7 @@ $(function () {
|
||||
img.layopt = {time: 0, skin: 'layui-layer-image', anim: 5, isOutAnim: false, scrollbar: false};
|
||||
img.referrerPolicy = 'no-referrer', img.style.maxWidth = '260px', img.style.maxHeight = '260px';
|
||||
ele.data('layidx', layer.tips(img.outerHTML, this, img.layopt)).off('mouseleave').on('mouseleave', function () {
|
||||
layui.layer.close(ele.data('layidx'));
|
||||
layer.close(ele.data('layidx'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user