优化安装脚本

优化JS
pull/406/head
Karson 2022-05-27 15:33:27 +08:00
parent 378aad4409
commit 466aa4233f
8 changed files with 26 additions and 14 deletions

View File

@ -90,8 +90,11 @@ class Install extends Command
$this->request = Request::instance(); $this->request = Request::instance();
define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS); define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS);
$langSet = strtolower($this->request->langset());
if (!$langSet || in_array($langSet, ['zh-cn', 'zh-hans-cn'])) { $lang = $this->request->langset();
$lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
if (!$lang || in_array($lang, ['zh-cn', 'zh-hans-cn'])) {
Lang::load(INSTALL_PATH . 'zh-cn.php'); Lang::load(INSTALL_PATH . 'zh-cn.php');
} }
@ -281,6 +284,13 @@ class Install extends Command
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/admin/command/Install/install.lock')); throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/admin/command/Install/install.lock'));
} }
try {
//删除安装脚本
@unlink(ROOT_PATH . 'public' . DS . 'install.php');
} catch (\Exception $e) {
}
return $adminName; return $adminName;
} }

View File

@ -12,7 +12,9 @@
// 应用行为扩展定义文件 // 应用行为扩展定义文件
return [ return [
// 应用初始化 // 应用初始化
'app_init' => [], 'app_init' => [
'app\\common\\behavior\\Common',
],
// 应用开始 // 应用开始
'app_begin' => [], 'app_begin' => [],
// 应用调度 // 应用调度

View File

@ -35,7 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
} }
}; };
table.on('load-success.bs.table', function (e, json) { table.on('load-success.bs.table', function (e, json) {
if (json && typeof json.category != 'undefined' && $(".nav-category li").size() == 2) { if (json && typeof json.category != 'undefined' && $(".nav-category li").length == 2) {
$.each(json.category, function (i, j) { $.each(json.category, function (i, j) {
$("<li><a href='javascript:;' data-id='" + j.id + "'>" + j.name + "</a></li>").insertBefore($(".nav-category li:last")); $("<li><a href='javascript:;' data-id='" + j.id + "'>" + j.name + "</a></li>").insertBefore($(".nav-category li:last"));
}); });
@ -238,7 +238,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
$(document).on("click", ".btn-addonindex", function () { $(document).on("click", ".btn-addonindex", function () {
if ($(this).attr("href") == 'javascript:;') { if ($(this).attr("href") == 'javascript:;') {
Layer.msg(__('Not installed tips'), {icon: 7}); Layer.msg(__('Not installed tips'), {icon: 7});
} else if ($(this).closest(".operate").find("a.btn-enable").size() > 0) { } else if ($(this).closest(".operate").find("a.btn-enable").length > 0) {
Layer.msg(__('Not enabled tips'), {icon: 7}); Layer.msg(__('Not enabled tips'), {icon: 7});
return false; return false;
} }

View File

@ -80,7 +80,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
api: { api: {
bindevent: function () { bindevent: function () {
Form.api.bindevent($("form[role=form]"), null, null, function () { Form.api.bindevent($("form[role=form]"), null, null, function () {
if ($("#treeview").size() > 0) { if ($("#treeview").length > 0) {
var r = $("#treeview").jstree("get_all_checked"); var r = $("#treeview").jstree("get_all_checked");
$("input[name='row[rules]']").val(r.join(',')); $("input[name='row[rules]']").val(r.join(','));
} }

View File

@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var value = $(this).val(); var value = $(this).val();
$(".tf").addClass("hidden"); $(".tf").addClass("hidden");
$(".tf.tf-" + value).removeClass("hidden"); $(".tf.tf-" + value).removeClass("hidden");
if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").size() == 1) { if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").length == 1) {
//异步加载表列表 //异步加载表列表
Fast.api.ajax({ Fast.api.ajax({
url: "general/config/get_table_list", url: "general/config/get_table_list",

View File

@ -23,7 +23,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
$("form.sidebar-form").on("blur", "input[name=q]", function () { $("form.sidebar-form").on("blur", "input[name=q]", function () {
searchResult.addClass("hide"); searchResult.addClass("hide");
}).on("focus", "input[name=q]", function () { }).on("focus", "input[name=q]", function () {
if ($("a", searchResult).size() > 0) { if ($("a", searchResult).length > 0) {
searchResult.removeClass("hide"); searchResult.removeClass("hide");
} }
}).on("keyup", "input[name=q]", function () { }).on("keyup", "input[name=q]", function () {
@ -209,7 +209,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
//绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格 //绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格
nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav}); nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav});
if ($("ul.sidebar-menu li.active a").size() > 0) { if ($("ul.sidebar-menu li.active a").length > 0) {
$("ul.sidebar-menu li.active a").trigger("click"); $("ul.sidebar-menu li.active a").trigger("click");
} else { } else {
if (multiplenav) { if (multiplenav) {
@ -223,10 +223,10 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
if (Config.referer) { if (Config.referer) {
if (Config.referer === $(addtabs).attr("url")) { if (Config.referer === $(addtabs).attr("url")) {
var active = $("ul.sidebar-menu li a[addtabs=" + $(addtabs).attr("addtabs") + "]"); var active = $("ul.sidebar-menu li a[addtabs=" + $(addtabs).attr("addtabs") + "]");
if (multiplenav && active.size() == 0) { if (multiplenav && active.length == 0) {
active = $("ul li a[addtabs='" + $(addtabs).attr("addtabs") + "']"); active = $("ul li a[addtabs='" + $(addtabs).attr("addtabs") + "']");
} }
if (active.size() > 0) { if (active.length > 0) {
active.trigger("click"); active.trigger("click");
} else { } else {
$(addtabs).appendTo(document.body).addClass("hide").trigger("click"); $(addtabs).appendTo(document.body).addClass("hide").trigger("click");

View File

@ -61,7 +61,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
api: { api: {
bindevent: function () { bindevent: function () {
Form.api.bindevent($("form[role=form]"), null, null, function () { Form.api.bindevent($("form[role=form]"), null, null, function () {
if ($("#treeview").size() > 0) { if ($("#treeview").length > 0) {
var r = $("#treeview").jstree("get_all_checked"); var r = $("#treeview").jstree("get_all_checked");
$("input[name='row[rules]']").val(r.join(',')); $("input[name='row[rules]']").val(r.join(','));
} }
@ -111,4 +111,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
} }
}; };
return Controller; return Controller;
}); });

View File

@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}, },
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列 ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
}, },
pageSize: localStorage.getItem('page-size') || 10, pageSize: Config.pagesize || 10,
pageList: [10, 15, 20, 25, 50, 'All'], pageList: [10, 15, 20, 25, 50, 'All'],
pagination: true, pagination: true,
clickToSelect: true, //是否启用点击选中 clickToSelect: true, //是否启用点击选中