fix: 修复tags标签,getTableFieldsBUG

This commit is contained in:
Ying
2022-08-28 22:24:52 +08:00
parent 3ef9177ea2
commit c1fd30dc98
10 changed files with 87 additions and 128 deletions

View File

@@ -65,13 +65,6 @@ class AdminController extends BaseController
*/ */
public $status = false; public $status = false;
/**
* 管理员信息
* @var array
*/
//public $admin = [];使用以下替代
//request()->adminInfo['id']
/** /**
* 获取模板 * 获取模板
* @access protected * @access protected
@@ -156,8 +149,8 @@ class AdminController extends BaseController
public function index() public function index()
{ {
if (request()->isAjax()) { if (request()->isAjax()) {
$page = (int)input('page') ?? 1; $page = (int)input('page', 1);
$limit = (int)input('limit') ?? 18; $limit = (int)input('limit',18);
$where = $this->buildSelectParams(); $where = $this->buildSelectParams();
$count = $this->model->where($where)->count(); $count = $this->model->where($where)->count();
$limit = is_empty($limit) ? 10 : $limit; $limit = is_empty($limit) ? 10 : $limit;

View File

@@ -246,8 +246,8 @@ class BaseController
*/ */
protected function getTableFields($model = null) protected function getTableFields($model = null)
{ {
$this->model = $model ?: $this->model; $model = $model ?: $this->model;
$tableFields = $this->model->getTableFields(); $tableFields = $model->getTableFields();
if (!empty($tableFields) && is_array($tableFields)) { if (!empty($tableFields) && is_array($tableFields)) {
foreach ($tableFields as $key => $value) { foreach ($tableFields as $key => $value) {
$filter = ['update_time', 'create_time', 'delete_time']; $filter = ['update_time', 'create_time', 'delete_time'];

View File

@@ -293,24 +293,17 @@ class Auth
} }
} else { } else {
if (!Event::hasListener('cmscategoryPermissions')) { if (!$this->superAdmin()) {
throw new \Exception('请安装CMS插件'); if (!empty($auth_nodes[$class])) {
} else {
if (!$this->superAdmin()) {
if (!empty($auth_nodes[$class])) {
$list = Event::emit('cmscategoryPermissions', [
'field' => $this->authFields,
'nodes' => $auth_nodes[$class]
], true);
}
}
if (empty($list)) {
$list = Event::emit('cmscategoryPermissions', [ $list = Event::emit('cmscategoryPermissions', [
'field' => $this->authFields 'field' => $this->authFields,
'nodes' => $auth_nodes[$class]
], true); ], true);
} }
} else {
$list = Event::emit('cmscategoryPermissions', [
'field' => $this->authFields
], true);
} }
} }

View File

@@ -1,6 +1,6 @@
<!--// 加载Markdown编辑器--> <!--// 加载Markdown编辑器-->
<link href="/static/js/markdown/cherry-markdown.css?v={:release()}" rel="stylesheet" type="text/css"/> <link href="/static/js/markdown/cherry-markdown.css?v={:release()}" rel="stylesheet" type="text/css"/>
<script src="/static/js/markdown/cherry-markdown.min.js?v={:release()}"></script> <script src="/static/js/markdown/cherry-markdown.core.js?v={:release()}"></script>
<!-- // 全局加载第三方JS --> <!-- // 全局加载第三方JS -->
<script src="/static/js/tinymce/tinymce.min.js?v={:release()}"></script> <script src="/static/js/tinymce/tinymce.min.js?v={:release()}"></script>

View File

@@ -1,11 +1,4 @@
<include file="/public/header" /> <include file="/public/header" />
<style>
.layui-form-select dl{
top: auto;
bottom: 36px;
}
</style>
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<!-- // 默认操作按钮 --> <!-- // 默认操作按钮 -->
@@ -40,7 +33,7 @@
<!-- // 默认搜索 --> <!-- // 默认搜索 -->
<button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i class="layui-icon layui-icon-search"></i>{:__('搜索')}</button> <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i class="layui-icon layui-icon-search"></i>{:__('搜索')}</button>
<!-- // 打开添加页面 --> <!-- // 打开添加页面 -->
<button class="layui-btn icon-btn" lay-open="" data-title="{:__('添加')}{:__('会员')}" data-area="500px" data-url="#editforms" > <button class="layui-btn icon-btn" lay-open="" data-title="{:__('添加')}{:__('会员')}" data-url="#editforms" >
<i class="layui-icon layui-icon-add-1"></i>{:__('添加')} <i class="layui-icon layui-icon-add-1"></i>{:__('添加')}
</button> </button>
</div> </div>
@@ -54,7 +47,7 @@
</div> </div>
<!-- // 添加编辑数据 --> <!-- // 添加编辑数据 -->
<script type="text/html" id="editforms" > <script type="text/html" id="editforms" >
<div class="layui-fluid layui-bg-white" > <div class="layui-fluid layui-bg-white" >
<form class="layui-form layui-form-fixed" lay-filter="editforms" > <form class="layui-form layui-form-fixed" lay-filter="editforms" >
<input type="text" name="id" hidden=""> <input type="text" name="id" hidden="">
@@ -111,7 +104,7 @@
<!-- // 列表工具栏 --> <!-- // 列表工具栏 -->
<script type="text/html" id="tableBar"> <script type="text/html" id="tableBar">
<a class="layui-table-text" data-title="{:__('编辑会员')}" data-area="500px" data-url="#editforms" lay-event="edit">{:__('编辑')}</a> <a class="layui-table-text" data-title="{:__('编辑会员')}" data-url="#editforms" lay-event="edit">{:__('编辑')}</a>
<div class="layui-divider layui-divider-vertical"></div> <div class="layui-divider layui-divider-vertical"></div>
<a class="layui-table-text" data-url="{:url('/system/User/del')}?id={{d.id}}" lay-event="del">{:__('删除')}</a> <a class="layui-table-text" data-url="{:url('/system/User/del')}?id={{d.id}}" lay-event="del">{:__('删除')}</a>
</script> </script>

View File

@@ -39,13 +39,10 @@ class Dictionary extends Model
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
*/ */
public static function getValueList(string $value = ''): array public static function getValueList(string $value = '')
{ {
$list = []; $list = [];
$data = self::where([ $data = self::where(['pid' => 0,'value' => $value])->find();
'pid' => 0,
'value' => $value
])->find();
if (!empty($data)) { if (!empty($data)) {
$list = self::where('pid', $data['id'])->select(); $list = self::where('pid', $data['id'])->select();
} }

View File

@@ -339,7 +339,7 @@ if (!function_exists('release')) {
*/ */
function release() function release()
{ {
return getenv('APP_DEBUG') ? \system\Random::alphaNum() : config('app.version'); return config('app.version');
} }
} }
@@ -1322,9 +1322,12 @@ if (!function_exists('plugin_refresh_hooks')) {
$events[$hook][] = [$namespace, $hook]; $events[$hook][] = [$namespace, $hook];
} }
$taglibPath = plugin_path($name) . 'taglib.php'; $taglibPath = plugin_path($name . DIRECTORY_SEPARATOR . 'taglib');
if (is_file($taglibPath)) {
$taglib[] = 'plugin\\' . $name . '\\taglib.php'; $tagList = glob($taglibPath . '*.php');
foreach ($tagList as $index => $tag) {
$tag = pathinfo($tag, PATHINFO_FILENAME);
$taglib[] = 'plugin\\' . $name . '\\taglib\\' . $tag;
} }
} }

View File

@@ -74,24 +74,6 @@ a {
display: none; display: none;
margin-left: -15px; margin-left: -15px;
} }
/*.layui-layer-iframe .layui-layer-setwin {*/
/* right: 25px!important;*/
/*}*/
/*.layui-layer-iframe .layui-layer-setwin .layui-layer-close2 {*/
/* position: relative;*/
/* right: unset;*/
/* top: unset;*/
/* width: 15px;*/
/* height: 15px;*/
/* margin-left: 8px;*/
/* background-position: 1px -40px;*/
/* _display: none;*/
/*}*/
/*.layui-layer-iframe .layui-layer-setwin .layui-layer-close2:hover {*/
/* background-position: 1px -40px;*/
/*}*/
.layui-table td, .layui-table th, .layui-table-col-set, .layui-table-fixed-r, .layui-table-grid-down, .layui-table-header, .layui-table-page, .layui-table-tips-main, .layui-table-tool, .layui-table-total, .layui-table-view, .layui-table[lay-skin=line], .layui-table[lay-skin=row] { .layui-table td, .layui-table th, .layui-table-col-set, .layui-table-fixed-r, .layui-table-grid-down, .layui-table-header, .layui-table-page, .layui-table-tips-main, .layui-table-tool, .layui-table-total, .layui-table-view, .layui-table[lay-skin=line], .layui-table[lay-skin=row] {
border: 1px #e6e6e6; border: 1px #e6e6e6;
@@ -2204,7 +2186,7 @@ a {
/*input标签*/ /*input标签*/
.layui-form-label { .layui-form-label {
padding: 6px 15px; padding: 6px 15px;
white-space: nowrap; /*white-space: nowrap;*/
} }
.layui-form-pane .layui-form-label { .layui-form-pane .layui-form-label {
@@ -2548,8 +2530,7 @@ xm-select > .xm-body .xm-tree-icon:hover {
#console .layui-table[lay-skin="nob"] th, .layui-table[lay-skin="nob"] td { #console .layui-table[lay-skin="nob"] th, .layui-table[lay-skin="nob"] td {
white-space: nowrap; white-space: nowrap;
max-width: 50px; min-width: 50px;
overflow: hidden;
} }
#console ul.layui-timeline { #console ul.layui-timeline {

View File

@@ -692,7 +692,8 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form', 'rate', 'table', 'sl
options.iframeAuto && layer.iframeAuto(index); options.iframeAuto && layer.iframeAuto(index);
if (options.type <= 1) { if (options.type <= 1) {
// 禁止滚动条
$(layero).children('.layui-layer-content').css('overflow', 'visible');
if (typeof tableThis !== 'undefined' && !options.disableform) { if (typeof tableThis !== 'undefined' && !options.disableform) {
form.val(options.id, tableThis.data); form.val(options.id, tableThis.data);
} }
@@ -1414,12 +1415,11 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form', 'rate', 'table', 'sl
layui.each($('.layui-tags'), function (i, e) { layui.each($('.layui-tags'), function (i, e) {
$(e).remove(); $(e).remove();
}) })
layui.each($('*[lay-tags]'), function (index, elem) { layui.each($('*[lay-tags]'), function (index, elem) {
let url = $(elem).data('url') || '';
var isTags = layui.tags.render({ let isTags = layui.tags.render({
elem: elem, elem: elem,
url: '/Ajax/getTags', url: url,
done: function (key, all) { done: function (key, all) {
} }
}); });

View File

@@ -138,7 +138,7 @@ layui.define(function(exports){
$('#'+ this.config.id + ' .layui-tags-input').before(html); $('#'+ this.config.id + ' .layui-tags-input').before(html);
// 限定隐藏元素 // 限定隐藏元素
if (this.getData().length == this.config.limit) { if (this.getData().length === this.config.limit) {
$('#'+this.config.id + ' .layui-tags-input').hide(); $('#'+this.config.id + ' .layui-tags-input').hide();
} }
@@ -195,11 +195,10 @@ layui.define(function(exports){
// 监听输入框键盘事件 // 监听输入框键盘事件
$('body').on('keyup',input,function(e) { $('body').on('keyup',input,function(e) {
var elem = $(this),keyCode = e.keyCode; var elem = $(this),keyCode = e.keyCode;
if (options.url !== undefined && keyCode != 13) { if (options.url !== undefined && keyCode !== 13) {
if (elem.val() != that.TAG_NAME) { if (elem.val() !== that.TAG_NAME && options.url) {
$.ajax({ $.ajax({
type: "get", type: "get",
url: options.url, url: options.url,
@@ -208,7 +207,7 @@ layui.define(function(exports){
}, },
// 获取TAGS关键词 // 获取TAGS关键词
success: function(res) { success: function(res) {
if (res.code == 200) { if (res.code === 200) {
that.drawHtml(res.data,elem); that.drawHtml(res.data,elem);
} }
} }
@@ -219,16 +218,16 @@ layui.define(function(exports){
var self = $('.'+LAY_TAG_THIS); var self = $('.'+LAY_TAG_THIS);
// 上键 // 上键
if (keyCode == 38) { if (keyCode === 38) {
var prev = self.prev(); var prev = self.prev();
if (prev.length != 0) { if (prev.length !== 0) {
self.removeClass(LAY_TAG_THIS); self.removeClass(LAY_TAG_THIS);
prev.addClass(LAY_TAG_THIS); prev.addClass(LAY_TAG_THIS);
} }
} // 下键 } // 下键
else if (keyCode == 40) { else if (keyCode === 40) {
var next = self.next(); var next = self.next();
if (next.length != 0) { if (next.length !== 0) {
self.removeClass(LAY_TAG_THIS); self.removeClass(LAY_TAG_THIS);
next.addClass(LAY_TAG_THIS); next.addClass(LAY_TAG_THIS);
} }