Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yl14_aicourse
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
yl14_aicourse
Commits
96220e6b
Commit
96220e6b
authored
Mar 24, 2026
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
9edc2e35
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
915 additions
and
6 deletions
+915
-6
ImagesActionsTemplate.md
form/ImagesActionsTemplate.md
+850
-0
ImagesActionsTemplateData.md
form/ImagesActionsTemplateData.md
+8
-0
index.html
form/index.html
+3
-0
index.js
form/index.js
+54
-6
No files found.
form/ImagesActionsTemplate.md
0 → 100644
View file @
96220e6b
This diff is collapsed.
Click to expand it.
form/ImagesActionsTemplateData.md
0 → 100644
View file @
96220e6b
```
CoursewarePageModel(
id: '1',
type: CoursewareTemplateType.imagesActions,
content: {}
)
```
form/index.html
View file @
96220e6b
...
...
@@ -283,6 +283,9 @@
<span>
AI 编排脚本区
</span>
<el-button
type=
"text"
size=
"mini"
@
click=
"toggleRightPanel"
>
收起
</el-button>
</div>
<div
class=
"panel-actions"
>
<el-button
type=
"primary"
size=
"small"
@
click=
"handleAiGenerateDownload"
>
AI生成
</el-button>
</div>
<el-input
type=
"textarea"
:rows=
"16"
...
...
form/index.js
View file @
96220e6b
...
...
@@ -596,10 +596,7 @@ Atmosphere and Colors: [Fill in content]
}
}
},
saveData
:
function
()
{
if
(
!
window
.
courseware
||
!
window
.
courseware
.
setData
)
{
return
;
}
buildCoursewareData
:
function
()
{
var
action
=
[];
if
(
this
.
audioPreviewUrl
||
(
this
.
aiTagData
&&
this
.
aiTagData
.
length
))
{
action
.
push
({
...
...
@@ -626,15 +623,66 @@ Atmosphere and Colors: [Fill in content]
});
});
}
var
data
=
{
return
{
image
:
this
.
imagePreviewUrl
,
action
:
action
,
aiImageContent
:
this
.
aiImageContent
,
ai_script
:
this
.
scriptText
};
// console.log('saveData payload', JSON.stringify(data, null, 2));
},
saveData
:
function
()
{
if
(
!
window
.
courseware
||
!
window
.
courseware
.
setData
)
{
return
;
}
var
data
=
this
.
buildCoursewareData
();
window
.
courseware
.
setData
(
data
,
function
()
{},
key
);
},
downloadTextFile
:
function
(
filename
,
text
)
{
var
blob
=
new
Blob
([
text
],
{
type
:
'
text/markdown;charset=utf-8
'
});
var
url
=
URL
.
createObjectURL
(
blob
);
var
a
=
document
.
createElement
(
'
a
'
);
a
.
href
=
url
;
a
.
download
=
filename
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
URL
.
revokeObjectURL
(
url
);
},
handleAiGenerateDownload
:
async
function
()
{
var
_this
=
this
;
try
{
var
tplRes
=
await
fetch
(
'
./ImagesActionsTemplate.md
'
);
if
(
!
tplRes
.
ok
)
{
throw
new
Error
(
'
无法读取 ImagesActionsTemplate.md
'
);
}
var
tplText
=
await
tplRes
.
text
();
_this
.
downloadTextFile
(
'
ImagesActionsTemplate.md
'
,
tplText
);
var
dataRes
=
await
fetch
(
'
./ImagesActionsTemplateData.md
'
);
if
(
!
dataRes
.
ok
)
{
throw
new
Error
(
'
无法读取 ImagesActionsTemplateData.md
'
);
}
var
dataTemplate
=
await
dataRes
.
text
();
var
jsonPretty
=
JSON
.
stringify
(
this
.
buildCoursewareData
(),
null
,
2
);
var
inner
=
jsonPretty
.
split
(
'
\n
'
).
map
(
function
(
line
)
{
return
'
'
+
line
;
}).
join
(
'
\n
'
);
// 支持 content: {} 或 content: { \n } 等空对象写法
var
filled
=
dataTemplate
.
replace
(
/
(\s
*content:
\s
*
)\{\s
*
\}
/
,
'
$1{
\n
'
+
inner
+
'
\n
}
'
);
if
(
filled
===
dataTemplate
)
{
throw
new
Error
(
'
ImagesActionsTemplateData.md 中未找到可替换的空 content(需为 content: {})
'
);
}
setTimeout
(
function
()
{
_this
.
downloadTextFile
(
'
ImagesActionsTemplateData.md
'
,
filled
);
},
200
);
this
.
$message
.
success
(
'
已开始下载两个 MD 文件
'
);
}
catch
(
err
)
{
this
.
$message
.
error
((
err
&&
err
.
message
)
?
err
.
message
:
'
下载失败
'
);
}
},
validateJson
:
function
()
{
if
(
!
this
.
scriptText
)
{
this
.
jsonError
=
''
;
...
...
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