Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecttwo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangtao
projecttwo
Commits
3733310e
Commit
3733310e
authored
Sep 05, 2025
by
wangtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
课时图文
parent
d7db028e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
48 deletions
+2
-48
Cert.php
app/admin/controller/cert/Cert.php
+0
-2
edit.html
app/admin/view/cert/cert/edit.html
+2
-46
No files found.
app/admin/controller/cert/Cert.php
View file @
3733310e
...
...
@@ -117,8 +117,6 @@ class Cert extends AdminBase
}
$data
=
$this
->
cert
->
append
([
'starttimetxt'
,
'endtimetxt'
])
->
where
(
'id'
,
$post
[
'id'
])
->
find
();
$data
->
content
=
json_encode
(
$data
->
content
);
$catemodel
=
new
CertCategory
();
$categorydata
=
$catemodel
->
catetree
(
isset
(
$data
[
'cate_id'
])
?
$data
[
'cate_id'
]
:
0
);
...
...
app/admin/view/cert/cert/edit.html
View file @
3733310e
...
...
@@ -150,55 +150,11 @@
data
:
str
});
// PHP 内容输出
var
phpContent
=
"<?= htmlspecialchars($data['content'], ENT_QUOTES, 'UTF-8') ?>"
;
phpContent
=
phpContent
.
replace
(
'"'
,
''
);
function
removeLastDoubleQuote
(
str
)
{
const
index
=
str
.
lastIndexOf
(
'"'
);
if
(
index
!==
-
1
)
{
return
str
.
slice
(
0
,
index
)
+
str
.
slice
(
index
+
6
);
}
return
str
;
// 没有双引号时返回原字符串
}
phpContent
=
removeLastDoubleQuote
(
phpContent
);
console
.
log
(
phpContent
);
// 高级解码函数
function
decodePHPContent
(
encoded
)
{
try
{
// 解码 JSON
let
decoded
=
JSON
.
parse
(
encoded
);
// 创建临时容器处理 PHP 标签
const
tempDiv
=
document
.
createElement
(
'div'
);
tempDiv
.
innerHTML
=
decoded
;
// 查找所有代码块
const
codeBlocks
=
tempDiv
.
querySelectorAll
(
'pre[class*="brush:"]'
);
// 修复 PHP 标签
codeBlocks
.
forEach
(
pre
=>
{
pre
.
innerHTML
=
pre
.
innerHTML
.
replace
(
/<
\?
php/g
,
'<?php'
)
.
replace
(
/
\?
>/g
,
'?>'
)
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
);
});
return
tempDiv
.
innerHTML
;
}
catch
(
e
)
{
console
.
error
(
'内容解码错误:'
,
e
);
return
encoded
;
// 返回原始内容作为后备
}
}
var
editorContent
=
decodePHPContent
(
phpContent
);
var
str
=
[{
"name"
:
"content"
,
"title"
:
"文章内容"
,
//
"value": '{$data.content|default=""}',
"value"
:
editorContent
,
"value"
:
'{$data.content|default=""}'
,
//
"value": editorContent,
"type"
:
"ueditor"
,
"style"
:
"height:500px"
,
}];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment