Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yl16_ai_cartoon
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
yl16_ai_cartoon
Commits
3aa1f628
Commit
3aa1f628
authored
Mar 12, 2026
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
ab5f0a59
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
337 additions
and
97 deletions
+337
-97
index.css
form/index.css
+23
-0
index.html
form/index.html
+31
-11
index.js
form/index.js
+191
-20
package-lock.json
package-lock.json
+92
-66
No files found.
form/index.css
View file @
3aa1f628
...
@@ -283,10 +283,26 @@ body{
...
@@ -283,10 +283,26 @@ body{
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
.quiz-dialog
.el-dialog
{
height
:
70vh
;
display
:
flex
;
flex-direction
:
column
;
}
.quiz-dialog
.el-dialog__body
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
overflow
:
hidden
;
}
.quiz-list
{
.quiz-list
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
gap
:
12px
;
gap
:
12px
;
overflow
:
auto
;
padding-right
:
6px
;
flex
:
1
;
}
}
.quiz-item
{
.quiz-item
{
...
@@ -351,6 +367,13 @@ body{
...
@@ -351,6 +367,13 @@ body{
gap
:
6px
;
gap
:
6px
;
}
}
.quiz-inline
{
flex
:
1
;
display
:
flex
;
gap
:
8px
;
align-items
:
center
;
}
.quiz-option
,
.quiz-option
,
.quiz-answer
{
.quiz-answer
{
display
:
flex
;
display
:
flex
;
...
...
form/index.html
View file @
3aa1f628
...
@@ -207,13 +207,15 @@
...
@@ -207,13 +207,15 @@
<el-dialog
<el-dialog
title=
"录入习题"
title=
"录入习题"
:visible
.
sync=
"quizDialogVisible"
:visible
.
sync=
"quizDialogVisible"
width=
"80%"
width=
"90%"
class=
"quiz-dialog"
@
close=
"closeQuizDialog"
>
@
close=
"closeQuizDialog"
>
<div
class=
"quiz-toolbar"
>
<div
class=
"quiz-toolbar"
>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('choice')"
>
新增选择题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('choice')"
>
新增选择题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('
text
')"
>
新增问答题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('
query
')"
>
新增问答题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('judge')"
>
新增判断题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('judge')"
>
新增判断题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('blank')"
>
新增填空题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('blank')"
>
新增填空题
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"addQuestion('reading')"
>
新增跟读题
</el-button>
</div>
</div>
<div
class=
"quiz-list"
v-if=
"quizList.length"
>
<div
class=
"quiz-list"
v-if=
"quizList.length"
>
<div
<div
...
@@ -235,9 +237,13 @@
...
@@ -235,9 +237,13 @@
</div>
</div>
<div
class=
"quiz-item-body"
>
<div
class=
"quiz-item-body"
>
<div
class=
"quiz-row"
>
<div
class=
"quiz-row"
v-if=
"q.type !== 'reading'"
>
<div
class=
"quiz-label"
>
题干
</div>
<div
class=
"quiz-label"
>
题干
</div>
<el-input
size=
"mini"
v-model=
"q.question"
@
input=
"saveData"
></el-input>
<el-input
size=
"mini"
:ref=
"'quizQuestionInput_' + qIndex"
v-model=
"q.question"
@
input=
"saveData"
></el-input>
</div>
</div>
<div
class=
"quiz-row"
v-if=
"q.type === 'choice'"
>
<div
class=
"quiz-row"
v-if=
"q.type === 'choice'"
>
...
@@ -260,16 +266,21 @@
...
@@ -260,16 +266,21 @@
</el-radio-group>
</el-radio-group>
</div>
</div>
<div
class=
"quiz-row"
v-if=
"q.type === '
text
'"
>
<div
class=
"quiz-row"
v-if=
"q.type === '
query
'"
>
<div
class=
"quiz-label"
>
参考答案
</div>
<div
class=
"quiz-label"
>
参考答案
</div>
<div
class=
"quiz-answers"
>
<el-input
size=
"mini"
v-model=
"q.answer"
@
input=
"saveData"
></el-input>
<div
class=
"quiz-answer"
v-for=
"(ans, ansIndex) in q.answers"
:key=
"ansIndex"
>
<el-input
size=
"mini"
v-model=
"q.answers[ansIndex]"
@
input=
"saveData"
></el-input>
<el-button
size=
"mini"
type=
"text"
:disabled=
"q.answers.length <= 1"
@
click=
"removeAnswer(qIndex, ansIndex)"
>
删除
</el-button>
</div>
</div>
<el-button
size=
"mini"
type=
"primary"
plain
@
click=
"addAnswer(qIndex)"
>
新增答案
</el-button>
<div
class=
"quiz-row"
v-if=
"q.type === 'query'"
>
<div
class=
"quiz-label"
>
备注
</div>
<div
class=
"quiz-inline"
>
<el-input
size=
"mini"
v-model=
"q.hint"
@
input=
"saveData"
></el-input>
<el-button
size=
"mini"
type=
"primary"
plain
@
click=
"fillQueryHint(q)"
>
一键填入图片理解内容
</el-button>
</div>
</div>
</div>
</div>
<div
class=
"quiz-row"
v-if=
"q.type === 'query'"
>
<div
class=
"quiz-label"
>
提示
</div>
<el-input
size=
"mini"
v-model=
"q.tip"
@
input=
"saveData"
></el-input>
</div>
<div
class=
"quiz-row"
v-if=
"q.type === 'blank'"
>
<div
class=
"quiz-row"
v-if=
"q.type === 'blank'"
>
<div
class=
"quiz-label"
>
参考答案
</div>
<div
class=
"quiz-label"
>
参考答案
</div>
...
@@ -281,6 +292,15 @@
...
@@ -281,6 +292,15 @@
<el-button
size=
"mini"
type=
"primary"
plain
@
click=
"addAnswer(qIndex)"
>
新增答案
</el-button>
<el-button
size=
"mini"
type=
"primary"
plain
@
click=
"addAnswer(qIndex)"
>
新增答案
</el-button>
</div>
</div>
</div>
</div>
<div
class=
"quiz-row"
v-if=
"q.type === 'reading'"
>
<div
class=
"quiz-label"
>
题干
</div>
<el-input
size=
"mini"
:ref=
"'quizReadingInput_' + qIndex"
v-model=
"q.text"
@
input=
"saveData"
></el-input>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
form/index.js
View file @
3aa1f628
...
@@ -87,21 +87,89 @@ new Vue({
...
@@ -87,21 +87,89 @@ new Vue({
if
(
data
.
image
)
{
if
(
data
.
image
)
{
_this
.
imagePreviewUrl
=
data
.
image
;
_this
.
imagePreviewUrl
=
data
.
image
;
}
}
if
(
data
.
audio_url
)
{
_this
.
audioPreviewUrl
=
data
.
audio_url
;
}
if
(
Array
.
isArray
(
data
.
points
))
{
_this
.
aiTagData
=
data
.
points
;
}
if
(
typeof
data
.
aiImageContent
===
'
string
'
)
{
if
(
typeof
data
.
aiImageContent
===
'
string
'
)
{
_this
.
aiImageContent
=
data
.
aiImageContent
;
_this
.
aiImageContent
=
data
.
aiImageContent
;
}
}
if
(
Array
.
isArray
(
data
.
quizList
))
{
_this
.
quizList
=
data
.
quizList
;
}
if
(
data
.
ai_script
)
{
if
(
data
.
ai_script
)
{
_this
.
scriptText
=
data
.
ai_script
;
_this
.
scriptText
=
data
.
ai_script
;
}
}
if
(
Array
.
isArray
(
data
.
action
))
{
_this
.
quizList
=
[];
data
.
action
.
forEach
(
function
(
item
)
{
if
(
!
item
||
!
item
.
type
)
{
return
;
}
if
(
item
.
type
===
'
lyrics
'
)
{
var
content
=
Array
.
isArray
(
item
.
content
)
?
item
.
content
[
0
]
:
null
;
if
(
content
&&
content
.
audio_url
)
{
_this
.
audioPreviewUrl
=
content
.
audio_url
;
}
if
(
content
&&
Array
.
isArray
(
content
.
points
))
{
_this
.
aiTagData
=
content
.
points
;
}
return
;
}
if
(
item
.
type
===
'
query
'
)
{
_this
.
quizList
.
push
({
id
:
'
q_
'
+
Date
.
now
()
+
'
_
'
+
Math
.
random
().
toString
(
16
).
slice
(
2
),
type
:
'
query
'
,
question
:
item
.
text
||
''
,
answer
:
item
.
answer
||
''
,
hint
:
item
.
hint
||
''
,
tip
:
item
.
tip
||
''
});
return
;
}
if
(
item
.
type
===
'
choice
'
)
{
_this
.
quizList
.
push
({
id
:
'
q_
'
+
Date
.
now
()
+
'
_
'
+
Math
.
random
().
toString
(
16
).
slice
(
2
),
type
:
'
choice
'
,
question
:
item
.
question
||
''
,
options
:
Array
.
isArray
(
item
.
options
)
&&
item
.
options
.
length
?
item
.
options
.
map
(
function
(
opt
)
{
return
{
text
:
opt
.
text
||
''
,
isCorrect
:
!!
opt
.
isCorrect
};
})
:
[
{
text
:
''
,
isCorrect
:
true
},
{
text
:
''
,
isCorrect
:
false
}
]
});
return
;
}
if
(
item
.
type
===
'
judge
'
)
{
var
correct
=
true
;
if
(
Array
.
isArray
(
item
.
options
)
&&
item
.
options
.
length
)
{
correct
=
!!
item
.
options
.
find
(
function
(
opt
)
{
return
opt
.
isCorrect
;
});
}
else
if
(
typeof
item
.
correct
===
'
boolean
'
)
{
correct
=
item
.
correct
;
}
_this
.
quizList
.
push
({
id
:
'
q_
'
+
Date
.
now
()
+
'
_
'
+
Math
.
random
().
toString
(
16
).
slice
(
2
),
type
:
'
judge
'
,
question
:
item
.
question
||
''
,
correct
:
correct
});
return
;
}
if
(
item
.
type
===
'
blank
'
)
{
_this
.
quizList
.
push
({
id
:
'
q_
'
+
Date
.
now
()
+
'
_
'
+
Math
.
random
().
toString
(
16
).
slice
(
2
),
type
:
'
blank
'
,
question
:
item
.
question
||
''
,
answers
:
Array
.
isArray
(
item
.
answers
)
&&
item
.
answers
.
length
?
item
.
answers
:
[
''
]
});
return
;
}
if
(
item
.
type
===
'
reading
'
)
{
_this
.
quizList
.
push
({
id
:
'
q_
'
+
Date
.
now
()
+
'
_
'
+
Math
.
random
().
toString
(
16
).
slice
(
2
),
type
:
'
reading
'
,
text
:
item
.
text
||
''
});
}
});
}
}
}
_this
.
validateJson
();
_this
.
validateJson
();
},
key
);
},
key
);
...
@@ -170,28 +238,52 @@ new Vue({
...
@@ -170,28 +238,52 @@ new Vue({
{
text
:
''
,
isCorrect
:
true
},
{
text
:
''
,
isCorrect
:
true
},
{
text
:
''
,
isCorrect
:
false
}
{
text
:
''
,
isCorrect
:
false
}
];
];
}
else
if
(
type
===
'
text
'
)
{
}
else
if
(
type
===
'
query
'
)
{
item
.
answers
=
[
''
];
item
.
answer
=
''
;
item
.
hint
=
''
;
item
.
tip
=
''
;
}
else
if
(
type
===
'
judge
'
)
{
}
else
if
(
type
===
'
judge
'
)
{
item
.
correct
=
true
;
item
.
correct
=
true
;
}
else
if
(
type
===
'
blank
'
)
{
}
else
if
(
type
===
'
blank
'
)
{
item
.
answers
=
[
''
];
item
.
answers
=
[
''
];
}
else
if
(
type
===
'
reading
'
)
{
item
.
text
=
''
;
}
}
this
.
quizList
.
push
(
item
);
this
.
quizList
.
push
(
item
);
this
.
saveData
();
this
.
saveData
();
this
.
$nextTick
(
function
()
{
this
.
focusNewQuestionInput
(
this
.
quizList
.
length
-
1
,
type
);
}.
bind
(
this
));
},
},
removeQuestion
:
function
(
index
)
{
removeQuestion
:
function
(
index
)
{
if
(
index
<
0
||
index
>=
this
.
quizList
.
length
)
{
if
(
index
<
0
||
index
>=
this
.
quizList
.
length
)
{
return
;
return
;
}
}
this
.
$confirm
(
'
删除后无法恢复,确定删除该题吗?
'
,
'
确认删除
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(
function
()
{
this
.
quizList
.
splice
(
index
,
1
);
this
.
quizList
.
splice
(
index
,
1
);
this
.
saveData
();
this
.
saveData
();
}.
bind
(
this
)).
catch
(
function
()
{});
},
focusNewQuestionInput
:
function
(
index
,
type
)
{
var
refName
=
type
===
'
reading
'
?
'
quizReadingInput_
'
+
index
:
'
quizQuestionInput_
'
+
index
;
var
ref
=
this
.
$refs
[
refName
];
var
inputRef
=
Array
.
isArray
(
ref
)
?
ref
[
0
]
:
ref
;
if
(
inputRef
&&
inputRef
.
$el
)
{
var
inputEl
=
inputRef
.
$el
.
querySelector
(
'
input
'
);
if
(
inputEl
)
{
inputEl
.
focus
();
}
}
},
},
getQuizTypeLabel
:
function
(
type
)
{
getQuizTypeLabel
:
function
(
type
)
{
if
(
type
===
'
choice
'
)
{
if
(
type
===
'
choice
'
)
{
return
'
选择题
'
;
return
'
选择题
'
;
}
}
if
(
type
===
'
text
'
)
{
if
(
type
===
'
query
'
)
{
return
'
问答题
'
;
return
'
问答题
'
;
}
}
if
(
type
===
'
judge
'
)
{
if
(
type
===
'
judge
'
)
{
...
@@ -200,6 +292,9 @@ new Vue({
...
@@ -200,6 +292,9 @@ new Vue({
if
(
type
===
'
blank
'
)
{
if
(
type
===
'
blank
'
)
{
return
'
填空题
'
;
return
'
填空题
'
;
}
}
if
(
type
===
'
reading
'
)
{
return
'
跟读题
'
;
}
return
'
未知
'
;
return
'
未知
'
;
},
},
addChoiceOption
:
function
(
qIndex
)
{
addChoiceOption
:
function
(
qIndex
)
{
...
@@ -237,6 +332,17 @@ new Vue({
...
@@ -237,6 +332,17 @@ new Vue({
item
.
answers
.
splice
(
ansIndex
,
1
);
item
.
answers
.
splice
(
ansIndex
,
1
);
this
.
saveData
();
this
.
saveData
();
},
},
fillQueryHint
:
function
(
item
)
{
if
(
!
item
||
item
.
type
!==
'
query
'
)
{
return
;
}
if
(
!
this
.
aiImageContent
)
{
this
.
$message
.
warning
(
'
请先进行AI图片理解
'
);
return
;
}
item
.
hint
=
this
.
aiImageContent
;
this
.
saveData
();
},
onQuizDragStart
:
function
(
index
,
event
)
{
onQuizDragStart
:
function
(
index
,
event
)
{
this
.
dragIndex
=
index
;
this
.
dragIndex
=
index
;
if
(
event
&&
event
.
dataTransfer
)
{
if
(
event
&&
event
.
dataTransfer
)
{
...
@@ -588,12 +694,77 @@ new Vue({
...
@@ -588,12 +694,77 @@ new Vue({
if
(
!
window
.
courseware
||
!
window
.
courseware
.
setData
)
{
if
(
!
window
.
courseware
||
!
window
.
courseware
.
setData
)
{
return
;
return
;
}
}
var
action
=
[];
if
(
this
.
audioPreviewUrl
||
(
this
.
aiTagData
&&
this
.
aiTagData
.
length
))
{
action
.
push
({
type
:
'
lyrics
'
,
content
:
[
{
audio_url
:
this
.
audioPreviewUrl
,
points
:
this
.
aiTagData
||
[]
}
]
});
}
if
(
Array
.
isArray
(
this
.
quizList
))
{
this
.
quizList
.
forEach
(
function
(
item
)
{
if
(
!
item
||
!
item
.
type
)
{
return
;
}
if
(
item
.
type
===
'
choice
'
)
{
action
.
push
({
type
:
'
choice
'
,
question
:
item
.
question
||
''
,
options
:
Array
.
isArray
(
item
.
options
)
?
item
.
options
.
map
(
function
(
opt
)
{
return
{
text
:
opt
.
text
||
''
,
isCorrect
:
!!
opt
.
isCorrect
};
})
:
[]
});
return
;
}
if
(
item
.
type
===
'
query
'
)
{
action
.
push
({
type
:
'
query
'
,
text
:
item
.
question
||
''
,
answer
:
item
.
answer
||
''
,
hint
:
item
.
hint
||
''
,
tip
:
item
.
tip
||
''
});
return
;
}
if
(
item
.
type
===
'
judge
'
)
{
action
.
push
({
type
:
'
judge
'
,
question
:
item
.
question
||
''
,
options
:
[
{
text
:
'
对
'
,
isCorrect
:
item
.
correct
===
true
},
{
text
:
'
错
'
,
isCorrect
:
item
.
correct
===
false
}
]
});
return
;
}
if
(
item
.
type
===
'
blank
'
)
{
action
.
push
({
type
:
'
blank
'
,
question
:
item
.
question
||
''
,
answers
:
Array
.
isArray
(
item
.
answers
)
?
item
.
answers
:
[]
});
return
;
}
if
(
item
.
type
===
'
reading
'
)
{
action
.
push
({
type
:
'
reading
'
,
text
:
item
.
text
||
''
});
}
});
}
var
data
=
{
var
data
=
{
image
:
this
.
imagePreviewUrl
,
image
:
this
.
imagePreviewUrl
,
audio_url
:
this
.
audioPreviewUrl
,
action
:
action
,
points
:
this
.
aiTagData
,
aiImageContent
:
this
.
aiImageContent
,
aiImageContent
:
this
.
aiImageContent
,
quizList
:
this
.
quizList
,
ai_script
:
this
.
scriptText
ai_script
:
this
.
scriptText
};
};
// console.log('saveData payload', JSON.stringify(data, null, 2));
// console.log('saveData payload', JSON.stringify(data, null, 2));
...
...
package-lock.json
View file @
3aa1f628
This diff is collapsed.
Click to expand it.
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