13 Commits

Author SHA1 Message Date
wolfcode
70ec12f406 feat(admin): 新增搜索表单多选功能 add xmSelect plugin support for multiple selection
- Add xmSelect case handling in AdminController for 'in' operation
- Include xmSelect.js in admin layout
- Update easy-admin.js to support xmSelect initialization and data binding
- Modify goods.js to demonstrate xmSelect usage with simulated data
- Adjust public.css for better styling of xmSelect elements

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-25 11:44:19 +08:00
wolfcode
e15b56ecc9 Update composer.json 2024-10-24 09:37:09 +08:00
wolfcode
af275e1c6a fix(install): check for .env file existence before installation
- Add a check for the presence of the .env file in the root directory
- Update the index method to redirect to the admin page with a default value

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-23 10:27:06 +08:00
wolfcode
20d4038159 Update public.css 2024-10-22 16:08:23 +08:00
wolfcode
475a1ef84d refactor(admin): update login.js to include jQuery dependency
- Add jQuery as a dependency in the define function
- Update the function parameters to include jQuery ($)

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-22 14:43:50 +08:00
wolfcode
9307e724a9 refactor(SystemLogService): optimize detectTable method and improve code quality
- Remove unnecessary return type annotation in instance method
- Add type hint for SystemLogService instance
- Use variable for cache key to improve code readability
- Update cache key name for consistency

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-22 11:54:59 +08:00
wolfcode
6616e96724 perf(middleware): optimize system log middleware for performance
- Remove redundant code for checking ignoreLog property
- Consolidate logic to check ignoreLog property in a single location
- Improve readability and maintainability of the code

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-22 11:31:06 +08:00
wolfcode
963febc15c feat(admin): 新增弹框是否允许在新标签页中打开 add option to open iframe in new tab
- Add 'iframe_open_top' configuration to admin site settings
- Implement functionality to open iframe in new tab if configured
- Update admin layout to include new configuration option
- Modify easy-admin.js to support new tab opening for iframes

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-21 16:27:48 +08:00
wolfcode
f78edd2fd5 refactor(css): simplify table styles and remove redundant code
- Remove duplicate styles for .layui-table-tool
- Delete unused styles for .layui-table-view and .layui-table-box
- Simplify border styles for light and dark themes- Remove unnecessary padding and positioning styles- Improve readability of table header text

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-16 22:21:20 +08:00
wolfcode
83aa399f95 feat(easy-admin): prevent rapid form submission
Add a mechanism to handle quick consecutive form submissions by displaying a message when a user tries to submit the form before the previous submission is completed. This
update introduces a wait period during which subsequent submissions are prevented,
enhancing the user experience and preventing potential errors.

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-16 11:05:26 +08:00
wolfcode
3096aa8985 🚀Layui v2.9.18 2024-10-15 11:08:50 +08:00
wolfcode
c7f7ca9af7 Update README.md 2024-10-14 18:00:48 +08:00
wolfcode
352484c69e fix(layout): adjust column layout for better responsiveness
Changed the column layout in both goods add and edit pages to ensure better responsiveness across different screen sizes. The left column is now fixed at 5 units, while the right column is set to 12 units for improved flexibility on smaller screens.

Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com>
2024-10-14 17:31:51 +08:00
18 changed files with 2691 additions and 67 deletions

View File

@@ -39,7 +39,13 @@
> EasyAdmin8 使用 Composer 来管理项目依赖。因此,在使用 EasyAdmin8 之前,请确保你的机器已经安装了 Composer。
### 通过git下载安装包composer安装依赖包
### 通过一键安装命令
```
if [ -f /usr/bin/curl ];then curl -sSO https://easyadmin8.top/auto-install-EasyAdmin8.sh;else wget -O auto-install-EasyAdmin8.sh https://easyadmin8.top/auto-install-EasyAdmin8.sh;fi;bash auto-install-EasyAdmin8.sh
```
### 通过`git`下载安装包,`composer`安装依赖包
```
1.下载安装包

View File

@@ -48,15 +48,6 @@ class SystemLog
if ($request->isAjax()) {
if (in_array($method, ['post', 'put', 'delete'])) {
$controller = $request->controller();
if (str_contains($controller, '.')) $controller = str_replace('.', '\\', $controller);
$action = $request->action();
$controllerClass = 'app\\admin\\controller\\' . $controller;
$classObj = new ReflectionClass($controllerClass);
$properties = $classObj->getDefaultProperties();
$ignoreLog = $properties['ignoreLog'] ?? [];
if (in_array($action, $ignoreLog)) return $response;
$title = '';
try {
$pathInfo = $request->pathinfo();
@@ -68,7 +59,10 @@ class SystemLog
if ($_name && $_controller && $_action) {
$className = "app\admin\controller\\{$_name}\\{$_controller}";
$reflectionClass = new \ReflectionClass($className);
$parser = new DocParser();
$properties = $reflectionClass->getDefaultProperties();
$ignoreLog = $properties['ignoreLog'] ?? [];
if (in_array($_action, $ignoreLog)) return $response;
$parser = new DocParser();
$parser->setIgnoreNotImportedAnnotations(true);
$reader = new AnnotationReader($parser);
$controllerAnnotation = $reader->getClassAnnotation($reflectionClass, ControllerAnnotation::class);

View File

@@ -44,14 +44,13 @@ class SystemLogService
$this->tablePrefix = Config::get('database.connections.mysql.prefix');
$this->tableSuffix = date('Ym', time());
$this->tableName = "{$this->tablePrefix}system_log_{$this->tableSuffix}";
return $this;
}
/**
* 获取实例对象
* @return SystemLogService|object
* @return SystemLogService
*/
public static function instance()
public static function instance(): SystemLogService
{
if (is_null(self::$instance)) {
self::$instance = new static();
@@ -85,15 +84,16 @@ class SystemLogService
*/
public function detectTable(): bool
{
$_key = "system_log_{$this->tableName}_table";
// 手动删除日志表时候 记得清除缓存
$isset = Cache::get("systemLog{$this->tableName}Table");
$isset = Cache::get($_key);
if ($isset) return true;
$check = Db::query("show tables like '{$this->tableName}'");
if (empty($check)) {
$sql = $this->getCreateSql();
Db::execute($sql);
}
Cache::set("system_log_{$this->tableName}_table", !empty($check));
Cache::set($_key, !empty($check));
return true;
}

View File

@@ -21,10 +21,12 @@
IS_SUPER_ADMIN: "{$isSuperAdmin|default='false'}",
VERSION: "{$version|default='1.0.0'}",
CSRF_TOKEN: "{:token()}",
ADMIN_UPLOAD_URL: "{$adminUploadUrl|DEFAULT=''}",
EDITOR_TYPE: "{$adminEditor|default='ueditor'}",
ADMIN_UPLOAD_URL: "{$adminUploadUrl|default=''}",
IFRAME_OPEN_TOP: "{$iframeOpenTop|default=0}",
EDITOR_TYPE: "{$adminEditor|default='wangEditor'}",
};
</script>
<script src="/static/plugs/xmSelect/xm-select.js" charset="utf-8"></script>
<script src="/static/plugs/layui-v2.x/layui.js" charset="utf-8"></script>
<script src="/static/plugs/require-2.3.6/require.js" charset="utf-8"></script>
<script src="/static/config-admin.js?v={$version}" charset="utf-8"></script>

View File

@@ -2,7 +2,7 @@
<form id="app-form" class="layui-form layuimini-form layui-form-pane">
<div class="layui-row">
<div class="layui-col-xl5 layui-col-lg5 layui-col-md5 layui-col-sm5 layui-col-xs5">
<div class="layui-col-xl5 layui-col-lg5 layui-col-md12 layui-col-sm12 layui-col-xs12">
<!-- 可以使用该方式 推荐写法-->
<div class="layui-form-item">
<label class="layui-form-label">商品分类</label>
@@ -89,7 +89,7 @@
</div>
</div>
</div>
<div class="layui-col-xl7 layui-col-lg7 layui-col-md7 layui-col-sm7 layui-col-xs7">
<div class="layui-col-xl7 layui-col-lg7 layui-col-md12 layui-col-sm12 layui-col-xs12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">商品描述</label>
<div class="layui-input-block">

View File

@@ -2,7 +2,7 @@
<form id="app-form" class="layui-form layuimini-form layui-form-pane">
<div class="layui-row">
<div class="layui-col-xl5 layui-col-lg5 layui-col-md5 layui-col-sm5 layui-col-xs5">
<div class="layui-col-xl5 layui-col-lg5 layui-col-md12 layui-col-sm12 layui-col-xs12">
<!-- 可以使用该方式 推荐写法-->
<div class="layui-form-item">
<label class="layui-form-label">商品分类</label>
@@ -89,7 +89,7 @@
</div>
</div>
</div>
<div class="layui-col-xl7 layui-col-lg7 layui-col-md7 layui-col-sm7 layui-col-xs7">
<div class="layui-col-xl7 layui-col-lg7 layui-col-md12 layui-col-sm12 layui-col-xs12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">商品描述</label>
<div class="layui-input-block">

View File

@@ -54,6 +54,15 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">新标签页窗口</label>
<div class="layui-input-block">
<input type="radio" name="iframe_open_top" value="0" title="不允许" {if 1!=sysConfig('site','iframe_open_top')}checked{/if}>
<input type="radio" name="iframe_open_top" value="1" title="允许" {if 1==sysConfig('site','iframe_open_top')}checked{/if}>
<br>
<tip>是否允许弹框在新标签页打开。</tip>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">默认编辑器</label>

View File

@@ -190,6 +190,9 @@ class AdminController extends BaseController
case '%*':
$where[] = [$key, 'LIKE', "%{$val}"];
break;
case 'in':
$where[] = [$key, 'IN', $val];
break;
case 'range':
[$beginTime, $endTime] = explode(' - ', $val);
$where[] = [$key, '>=', strtotime($beginTime)];
@@ -240,6 +243,7 @@ class AdminController extends BaseController
'version' => env('APP_DEBUG') ? time() : ConfigService::getVersion(),
'adminUploadUrl' => url('ajax/upload', [], false),
'adminEditor' => sysConfig('site', 'editor_type') ?: 'wangEditor',
'iframeOpenTop' => sysConfig('site', 'iframe_open_top') ?: 0,
];
View::assign($data);
}

View File

@@ -14,6 +14,6 @@ class Index extends BaseController
public function index(): Redirect
{
// 这是项目首页 系统默认跳转后台页面
return redirect('/' . Env::get('EASYADMIN.ADMIN', false));
return redirect('/' . Env::get('EASYADMIN.ADMIN', 'admin'));
}
}

View File

@@ -27,6 +27,9 @@ class Install extends BaseController
}elseif (!extension_loaded("PDO")) {
$errorInfo = '当前未开启PDO无法进行安装';
}
if (!is_file(root_path() . '.env')) {
$errorInfo = '.env 文件不存在,请先配置 .env 文件';
}
if (!$request->isAjax()) {
$currentHost = '://';
$result = compact('errorInfo', 'currentHost', 'isInstall');

View File

@@ -37,7 +37,7 @@
"qiniu/php-sdk": "v7.11.0",
"ext-mysqli": "*",
"ext-pdo": "*",
"wolf-leo/phplogviewer": "^0.10.0"
"wolf-leo/phplogviewer": "^0.11.1"
},
"require-dev": {
"symfony/var-dumper": ">=4.2",

View File

@@ -134,6 +134,12 @@ html.dark, body {
color: #a29c9c;
}
.layui-form-item xm-select {
min-height: 30px !important;
line-height: 30px !important;
margin: 0 !important;
}
/** 按钮背景色 */
.layuimini-container .layuimini-btn-primary {
color: #fff;
@@ -253,36 +259,10 @@ table样式
.layuimini-container .layui-table-tool {
background-color: #ffffff;
border-bottom: none !important;
padding: 10px;
padding-bottom: 15px !important;
}
.dark .layuimini-container .layui-table-tool {
background-color: var(--lay-color-bg-1);
border-bottom: none !important;
padding-bottom: 15px !important;
}
.layuimini-container .layui-table-view {
border: none !important;
}
.layuimini-container .layui-table-box {
border-width: 1px;
border-style: solid;
border-color: #e6e6e6;
}
.dark .layuimini-container .layui-table-box {
border-width: 1px;
border-style: solid;
border-color: #363636;
}
.layuimini-container .layui-table-page, .layui-table-total {
border-width: 0px 0 0;
}
.layuimini-container .layui-table-box .layui-table-header th {
font-weight: bold !important;
color: #565656 !important;
@@ -329,10 +309,6 @@ table样式
padding: 0;
}
/**
按钮
*/
.layuimini-container .layui-btn-success {
color: #fff;
background-color: #4bb368;
@@ -360,14 +336,6 @@ table样式
font-size: 16px;
}
.layuimini-container .layui-table-tool-self {
right: 0px;
}
.layuimini-container .layui-table-tool {
padding: 10px 0px;
}
/**
弹出层样式
*/
@@ -513,6 +481,18 @@ table样式
.form-search .layui-input-inline input, .form-search .layui-input-inline select {
width: 100% !important;
}
.tableSelect {
margin: 5px !important;
min-width: auto !important;
left: 1px !important;
right: 1px !important;
}
.tableSelect img {
object-fit: cover;
height: 100%;
}
}
/**

View File

@@ -1,4 +1,4 @@
define(["easy-admin"], function (ea) {
define(["jquery", "easy-admin"], function ($, ea) {
return {
index: function () {

View File

@@ -42,6 +42,14 @@ define(["jquery", "easy-admin"], function ($, ea) {
{field: 'virtual_sales', width: 100, title: '虚拟销量'},
{field: 'sales', width: 80, title: '销量'},
{field: 'status', title: '状态', width: 85, selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
// 演示多选,实际数据库并无 status2 字段,搜索后会报错
{
field: 'status2', title: '演示多选', width: 105, search: 'xmSelect', selectList: {1: '模拟选项1', 2: '模拟选项2', 3: '模拟选项3', 4: '模拟选项4', 5: '模拟选项5'},
searchOp: 'in', templet: function (res) {
// 根据自己实际项目进行输出
return res?.status2 || '模拟数据'
}
},
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
{
width: 250,

View File

@@ -19,9 +19,13 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
table_render_id: 'currentTableRenderId',
upload_url: 'ajax/upload',
upload_exts: 'doc|gif|ico|icon|jpg|mp3|mp4|p12|pem|png|rar',
csrf_token: window.CONFIG.CSRF_TOKEN
csrf_token: window.CONFIG.CSRF_TOKEN,
wait_submit: false,
xmSelectList: {},
xmSelectModel: {},
};
var admin = {
config: {
shade: [0.02, '#000'],
@@ -112,6 +116,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
// @todo 刷新csrf-token
let token = data.responseJSON ? data.responseJSON.__token__ : ''
init.csrf_token = token
init.wait_submit = false
}
});
}
@@ -367,6 +372,15 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
'</div>\n' +
'</div>';
break;
case 'xmSelect':
formHtml += '\t<div class="layui-form-item layui-inline">\n' +
'<label class="layui-form-label">' + d.title + '</label>\n' +
'<div class="layui-input-inline">\n' +
'<div id="c-' + d.fieldAlias + '" class="tableSearch-xmSelect xmSelect-' + d.fieldAlias + '" name="' + d.fieldAlias + '" data-search-op="' + d.searchOp + '"></div>\n' +
'</div>\n' +
'</div>';
init.xmSelectList[d.fieldAlias] = d.selectList
break;
case 'range':
d.searchOp = 'range';
formHtml += '\t<div class="layui-form-item layui-inline">\n' +
@@ -820,6 +834,17 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
return value;
},
listenTableSearch: function (tableId) {
if (Object.keys(init.xmSelectList).length > 0) {
$.each(init.xmSelectList, function (index, value) {
const keysArray = Object.keys(value).map((key) => {
return {name: value[key], value: key}
})
init.xmSelectModel[index] = xmSelect.render({
el: '.xmSelect-' + index, language: 'zn', data: keysArray, name: index,
filterable: true, paging: true, pageSize: 10, theme: {color: '#16b777'}, toolbar: {show: true},
})
})
}
form.on('submit(' + tableId + '_filter)', function (data) {
var dataField = data.field;
var formatFilter = {},
@@ -974,6 +999,14 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
before: function () {
},
success: function (layero, index) {
if (window.CONFIG.IFRAME_OPEN_TOP == '1') {
let _winTopBtn = `
<span class="_winTopBtn layui-btn layui-btn-primary layui-btn-xs"
style="position: absolute;top: 14px;right: 120px;color: #fff;border-color: #fff;" onclick="window.open(location.href)">
新标签页打开
</span>`
$('.layui-layer-iframe').append(_winTopBtn)
}
},
end: function () {
index = null
@@ -1144,6 +1177,11 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
if (tableId === undefined || tableId === '' || tableId == null) {
tableId = init.table_render_id;
}
if (Object.keys(init.xmSelectModel).length > 0) {
$.each(init.xmSelectModel, function (index, value) {
init.xmSelectModel[index].setValue([])
})
}
table.reload(tableId, {
page: {
curr: 1
@@ -1365,6 +1403,10 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
url = admin.url(url);
}
form.on('submit(' + filter + ')', function (data) {
if (init.wait_submit) {
layer.msg('你点击太快了', {icon: 16, shade: 0.3, shadeClose: false, time: 1000})
return false
}
var dataField = data.field;
var editorList = document.querySelectorAll(".editor");
// 富文本数据处理
@@ -1392,6 +1434,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
if (typeof preposeCallback === 'function') {
dataField = preposeCallback(dataField);
}
init.wait_submit = true
admin.api.form(url, dataField, ok, no, ex, refresh);
return false;
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long