Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wolfcode
EasyAdmin8-webman
提交
35064f72
E
EasyAdmin8-webman
项目概览
wolfcode
/
EasyAdmin8-webman
5 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
EasyAdmin8-webman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
35064f72
编写于
11月 20, 2023
作者:
W
wolfcode
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
编辑器兼容curd自动生成
上级
00ccd891
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
8 deletion
+19
-8
app/admin/view/admin/mall/goods/add.blade.php
app/admin/view/admin/mall/goods/add.blade.php
+1
-1
app/admin/view/admin/mall/goods/edit.blade.php
app/admin/view/admin/mall/goods/edit.blade.php
+1
-1
app/common/services/curd/BuildCurd.php
app/common/services/curd/BuildCurd.php
+14
-2
app/common/services/curd/templates/view/module/editor.code
app/common/services/curd/templates/view/module/editor.code
+1
-1
app/functions.php
app/functions.php
+2
-3
未找到文件。
app/admin/view/admin/mall/goods/add.blade.php
浏览文件 @
35064f72
...
...
@@ -62,7 +62,7 @@
<
div
class
=
"layui-form-item"
>
<
label
class
=
"layui-form-label"
>
商品描述
</
label
>
<
div
class
=
"layui-input-block"
>
{
!!
editor_textarea
(
[]
,
'describe'
)
!!
}
{
!!
editor_textarea
(
''
,
'describe'
)
!!
}
</
div
>
</
div
>
...
...
app/admin/view/admin/mall/goods/edit.blade.php
浏览文件 @
35064f72
...
...
@@ -63,7 +63,7 @@
<
div
class
=
"layui-form-item"
>
<
label
class
=
"layui-form-label"
>
商品描述
</
label
>
<
div
class
=
"layui-input-block"
>
{
!!
editor_textarea
(
$row
,
'describe'
)
!!
}
{
!!
editor_textarea
(
$row
[
"describe"
]
,
'describe'
)
!!
}
</
div
>
</
div
>
...
...
app/common/services/curd/BuildCurd.php
浏览文件 @
35064f72
...
...
@@ -871,7 +871,7 @@ class BuildCurd
}
// 判断富文本
if
(
in_array
(
$field
,
$this
->
editorFields
))
{
if
(
in_array
(
$field
,
$this
->
editorFields
)
||
in_array
(
$val
[
'type'
],
[
'text'
,
'tinytext'
,
'mediumtext'
,
'longtext'
])
)
{
$this
->
tableColumns
[
$field
][
'formType'
]
=
'editor'
;
continue
;
}
...
...
@@ -939,7 +939,7 @@ class BuildCurd
}
// 判断富文本
if
(
in_array
(
$field
,
$this
->
editorFields
))
{
if
(
in_array
(
$field
,
$this
->
editorFields
)
||
in_array
(
$val
[
'type'
],
[
'text'
,
'tinytext'
,
'mediumtext'
,
'longtext'
])
)
{
$this
->
relationArray
[
$table
][
'tableColumns'
][
$field
][
'formType'
]
=
'editor'
;
continue
;
}
...
...
@@ -1134,6 +1134,12 @@ class BuildCurd
$templateFile
=
"view
{
$this
->
DS
}
module
{
$this
->
DS
}
input"
;
$define
=
''
;
// 根据formType去获取具体模板
if
(
$val
[
'formType'
]
==
'editor'
)
{
$templateFile
=
"view
{
$this
->
DS
}
module
{
$this
->
DS
}
editor"
;
$val
[
'default'
]
=
'""'
;
}
$addFormList
.
=
CommonTool
::
replaceTemplate
(
$this
->
getTemplate
(
$templateFile
),
[
...
...
@@ -1166,6 +1172,12 @@ class BuildCurd
$define
=
''
;
$value
=
'{{$row[\''
.
$field
.
'\']}}'
;
// 根据formType去获取具体模板
if
(
$val
[
'formType'
]
==
'editor'
)
{
$templateFile
=
"view
{
$this
->
DS
}
module
{
$this
->
DS
}
editor"
;
$value
=
'$row["'
.
$field
.
'"]'
;
}
$editFormList
.
=
CommonTool
::
replaceTemplate
(
$this
->
getTemplate
(
$templateFile
),
[
...
...
app/common/services/curd/templates/view/module/editor.code
浏览文件 @
35064f72
...
...
@@ -2,6 +2,6 @@
<div class="layui-form-item">
<label class="layui-form-label">{{comment}}</label>
<div class="layui-input-block">
<textarea name="{{field}}" rows="20" class="layui-textarea editor" {{comment}} placeholder="请输入{{comment}}">{{value}}</textarea>
{!! editor_textarea({{value}},"{{field}}","{{comment}}") !!}
</div>
</div>
\ No newline at end of file
app/functions.php
浏览文件 @
35064f72
...
...
@@ -154,15 +154,14 @@ if (!function_exists('updateFields')) {
}
/**
* @param
$row
* @param
string $detail
* @param string $name
* @param string $placeholder
* @return string
*/
function
editor_textarea
(
$row
,
string
$name
=
'desc'
,
string
$placeholder
=
'请输入'
):
string
function
editor_textarea
(
string
$detail
,
string
$name
=
'desc'
,
string
$placeholder
=
'请输入'
):
string
{
$editor_type
=
sysconfig
(
'site'
,
'editor_type'
);
$detail
=
$row
[
$name
]
??
''
;
return
match
(
$editor_type
)
{
'ckeditor'
=>
"<textarea name='
{
$name
}
' rows='20' class='layui-textarea editor' placeholder='
{
$placeholder
}
'>
{
$detail
}
</textarea>"
,
default
=>
"<script type='text/plain' id='
{
$name
}
' name='
{
$name
}
' class='editor' data-content='
{
$detail
}
'></script>"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录