Compare commits

...

5 Commits

Author SHA1 Message Date
Karson 32329947a3 优化用户协议配置 2026-01-15 11:22:47 +08:00
Karson 1ed0a1395c 优化菜单规则 2026-01-15 10:57:05 +08:00
Karson 8941680ab4 Merge branch '1.x-dev' of gitee.com:fastadminnet/fastadmin into 1.x-dev 2026-01-15 10:31:52 +08:00
Karson 0c85045e7d 优化CRUD生成 2026-01-15 10:31:34 +08:00
Karson 31a42a5481 插件管理新增是否显示配置按钮 2026-01-14 19:01:49 +08:00
7 changed files with 38 additions and 13 deletions

View File

@ -1005,7 +1005,7 @@ EOD;
}
//过滤text类型字段
if ($v['DATA_TYPE'] != 'text' && $inputType != 'fieldlist') {
if (!preg_match("/text$/i", $v['DATA_TYPE']) && $inputType != 'fieldlist') {
//主键
if ($v['COLUMN_KEY'] == 'PRI' && !$priDefined) {
$priDefined = true;
@ -1070,7 +1070,7 @@ EOD;
}
//过滤text类型字段
if ($v['DATA_TYPE'] != 'text') {
if (!preg_match("/text$/i", $v['DATA_TYPE'])) {
//构造JS列信息
$javascriptList[] = $this->getJsColumn($relationField, $v['DATA_TYPE'], '', [], $v);
}
@ -1646,11 +1646,11 @@ EOD;
$inputType = "datetimerange";
}
// 指定后缀结尾JSON配置
if ($this->isMatchSuffix($fieldsName, $this->jsonSuffix) && ($v['DATA_TYPE'] == 'varchar' || $v['DATA_TYPE'] == 'text')) {
if ($this->isMatchSuffix($fieldsName, $this->jsonSuffix) && ($v['DATA_TYPE'] == 'varchar' || preg_match("/text$/i", $v['DATA_TYPE']))) {
$inputType = "fieldlist";
}
// 指定后缀结尾标签配置
if ($this->isMatchSuffix($fieldsName, $this->tagSuffix) && ($v['DATA_TYPE'] == 'varchar' || $v['DATA_TYPE'] == 'text')) {
if ($this->isMatchSuffix($fieldsName, $this->tagSuffix) && ($v['DATA_TYPE'] == 'varchar' || preg_match("/text$/i", $v['DATA_TYPE']))) {
$inputType = "tagsinput";
}
return $inputType;
@ -1734,7 +1734,22 @@ EOD;
{
$lang = mb_ucfirst($field);
$formatter = '';
foreach ($this->fieldFormatterSuffix as $k => $v) {
$fieldFormatterSuffix = $this->fieldFormatterSuffix;
foreach (['switch', 'image', 'file', 'tag', 'intDate'] as $index => $item) {
$property = $item . (in_array($item, ['image', 'file']) ? 'Field' : 'Suffix');
if (!isset($this->$property) || !$this->isMatchSuffix($field, $this->$property)) {
continue;
}
if ($item == 'intDate') {
$fieldFormatterSuffix[$field] = ['type' => ['int', 'bigint', 'timestamp'], 'name' => 'datetime'];
} else if (in_array($item, ['image', 'file'])) {
$fieldFormatterSuffix[$field] = $this->fieldFormatterSuffix[$item . (preg_match("/s$/i", $field) ? 's' : '')];
} else {
$fieldFormatterSuffix[$field] = $this->fieldFormatterSuffix[$item];
}
break;
}
foreach ($fieldFormatterSuffix as $k => $v) {
if (preg_match("/{$k}$/i", $field)) {
if (is_array($v)) {
if (in_array($datatype, $v['type'])) {
@ -1765,7 +1780,13 @@ EOD;
}
// 文件、图片、权重等字段默认不加入搜索栏字符串类型默认LIKE
$noSearchFiles = ['file$', 'files$', 'image$', 'images$', '^weigh$'];
$noSearchFiles = ['file$', 'files$', 'image$', 'images$', '^' . $this->sortField . '$'];
$noSearchFiles = array_merge($noSearchFiles, array_map(function ($item) {
return $item . '$';
}, $this->imageField), array_map(function ($item) {
return $item . '$';
}, $this->fileField));
if (preg_match("/" . implode('|', $noSearchFiles) . "/i", $field)) {
$html .= ", operate: false";
} elseif (in_array($datatype, ['varchar'])) {

View File

@ -9,7 +9,7 @@ use think\addons\Service;
use think\Cache;
use think\Config;
use think\Db;
use think\Exception;
use Exception;
/**
* 插件管理
@ -38,7 +38,8 @@ class Addon extends Backend
$addons = get_addon_list();
foreach ($addons as $k => &$v) {
$config = get_addon_config($v['name']);
$v['config'] = $config ? 1 : 0;
$showConfig = $v['config'] ?? true;
$v['config'] = $showConfig && $config ? 1 : 0;
$v['url'] = str_replace($this->request->server('SCRIPT_NAME'), '', $v['url']);
}
$this->assignconfig(['addons' => $addons, 'api_url' => config('fastadmin.api_url'), 'faversion' => config('fastadmin.version'), 'domain' => request()->host(true)]);
@ -444,7 +445,7 @@ class Addon extends Backend
$json = [];
try {
$json = Service::addons($params);
} catch (\Exception $e) {
} catch (Exception $e) {
}
$rows = $json['rows'] ?? [];

View File

@ -12,6 +12,7 @@ return [
'frontend' => 'zh-cn',
],
'fixedpage' => 'dashboard',
'agreement' => '协议内容',
'categorytype' => [
'default' => 'Default',
'page' => 'Page',

View File

@ -400,6 +400,7 @@ class User extends Frontend
public function agreement()
{
$this->view->assign('title', __('User agreement'));
$this->view->assign('content', xss_clean(config('site.agreement')));
return $this->view->fetch();
}
}

View File

@ -1,7 +1,8 @@
<div id="content-container" class="container">
<div class="user-section agreement-section">
<h2>用户协议</h2>
<h2>{$title}</h2>
<div class="agreement-content">
<p>用户协议内容</p>
<p>{:$content}</p>
</div>
</div>
</div>

View File

@ -161,7 +161,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
api: {
formatter: {
title: function (value, row, index) {
var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
var caret = row.haschild == 1 ? '<i class="fa fa-caret-right"></i>' : '';
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'

View File

@ -106,7 +106,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
var caret = row.haschild == 1 ? '<i class="fa fa-caret-right"></i>' : '';
value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;