Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
school-paper-admin-front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
school-paper
school-paper-admin-front
Commits
ad73f2de
Commit
ad73f2de
authored
Jul 24, 2023
by
裴梁博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/v1/plb' into 'feature/v1/zmj'
Feature/v1/plb See merge request
!1
parents
837b90ca
d4a680a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
226 additions
and
194 deletions
+226
-194
src/components/Editor/index.vue
+21
-14
src/views/school-paper/questionBank/index.vue
+205
-180
No files found.
src/components/Editor/index.vue
View file @
ad73f2de
...
@@ -56,13 +56,19 @@ export default {
...
@@ -56,13 +56,19 @@ export default {
type
:
{
type
:
{
type
:
String
,
type
:
String
,
default
:
"url"
,
default
:
"url"
,
}
},
iconType
:
{
type
:
Array
,
default
:
()
=>
{
return
[
"link"
,
"image"
,
"video"
];
// 链接、图片、视频
},
},
},
},
data
()
{
data
()
{
return
{
return
{
uploadUrl
:
process
.
env
.
VUE_APP_BASE_API
+
"/system/oss/upload"
,
// 上传的图片服务器地址
uploadUrl
:
process
.
env
.
VUE_APP_BASE_API
+
"/system/oss/upload"
,
// 上传的图片服务器地址
headers
:
{
headers
:
{
Authorization
:
"Bearer "
+
getToken
()
Authorization
:
"Bearer "
+
getToken
()
,
},
},
Quill
:
null
,
Quill
:
null
,
currentValue
:
""
,
currentValue
:
""
,
...
@@ -73,16 +79,16 @@ export default {
...
@@ -73,16 +79,16 @@ export default {
modules
:
{
modules
:
{
// 工具栏配置
// 工具栏配置
toolbar
:
[
toolbar
:
[
[
"bold"
,
"italic"
,
"underline"
,
"strike"
],
// 加粗 斜体 下划线 删除线
[
"bold"
,
"italic"
,
"underline"
,
"strike"
],
// 加粗 斜体 下划线 删除线
[
"blockquote"
,
"code-block"
],
// 引用 代码块
[
"blockquote"
,
"code-block"
],
// 引用 代码块
[{
list
:
"ordered"
},
{
list
:
"bullet"
}],
// 有序、无序列表
[{
list
:
"ordered"
},
{
list
:
"bullet"
}],
// 有序、无序列表
[{
indent
:
"-1"
},
{
indent
:
"+1"
}],
// 缩进
[{
indent
:
"-1"
},
{
indent
:
"+1"
}],
// 缩进
[{
size
:
[
"small"
,
false
,
"large"
,
"huge"
]
}],
// 字体大小
[{
size
:
[
"small"
,
false
,
"large"
,
"huge"
]
}],
// 字体大小
[{
header
:
[
1
,
2
,
3
,
4
,
5
,
6
,
false
]
}],
// 标题
[{
header
:
[
1
,
2
,
3
,
4
,
5
,
6
,
false
]
}],
// 标题
[{
color
:
[]
},
{
background
:
[]
}],
// 字体颜色、字体背景颜色
[{
color
:
[]
},
{
background
:
[]
}],
// 字体颜色、字体背景颜色
[{
align
:
[]
}],
// 对齐方式
[{
align
:
[]
}],
// 对齐方式
[
"clean"
],
// 清除文本格式
[
"clean"
],
// 清除文本格式
[
"link"
,
"image"
,
"video"
]
// 链接、图片、视频
this
.
iconType
,
// 链接、图片、视频
],
],
},
},
placeholder
:
"请输入内容"
,
placeholder
:
"请输入内容"
,
...
@@ -126,7 +132,7 @@ export default {
...
@@ -126,7 +132,7 @@ export default {
const
editor
=
this
.
$refs
.
editor
;
const
editor
=
this
.
$refs
.
editor
;
this
.
Quill
=
new
Quill
(
editor
,
this
.
options
);
this
.
Quill
=
new
Quill
(
editor
,
this
.
options
);
// 如果设置了上传地址则自定义图片上传事件
// 如果设置了上传地址则自定义图片上传事件
if
(
this
.
type
==
'url'
)
{
if
(
this
.
type
==
"url"
)
{
let
toolbar
=
this
.
Quill
.
getModule
(
"toolbar"
);
let
toolbar
=
this
.
Quill
.
getModule
(
"toolbar"
);
toolbar
.
addHandler
(
"image"
,
(
value
)
=>
{
toolbar
.
addHandler
(
"image"
,
(
value
)
=>
{
this
.
uploadType
=
"image"
;
this
.
uploadType
=
"image"
;
...
@@ -191,7 +197,8 @@ export default {
...
@@ -191,7 +197,8 @@ export default {
</
script
>
</
script
>
<
style
>
<
style
>
.editor
,
.ql-toolbar
{
.editor
,
.ql-toolbar
{
white-space
:
pre-wrap
!important
;
white-space
:
pre-wrap
!important
;
line-height
:
normal
!important
;
line-height
:
normal
!important
;
}
}
...
...
src/views/school-paper/questionBank/index.vue
View file @
ad73f2de
...
@@ -237,7 +237,7 @@
...
@@ -237,7 +237,7 @@
>
</div>
>
</div>
<div
class=
"app-container-list-item-footer"
>
<div
class=
"app-container-list-item-footer"
>
<el-button
icon=
"el-icon-edit-outline"
>
编辑
</el-button>
<el-button
icon=
"el-icon-edit-outline"
>
编辑
</el-button>
<el-button
icon=
"el-icon-
edit-
delete"
>
删除
</el-button>
<el-button
icon=
"el-icon-delete"
>
删除
</el-button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -311,191 +311,215 @@
...
@@ -311,191 +311,215 @@
/>
/>
<!-- 添加或修改题库主对话框 -->
<!-- 添加或修改题库主对话框 -->
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"70%"
append-to-body
>
<
template
v-if=
"open"
>
<el-form
<el-dialog
ref=
"form"
:title=
"title"
:model=
"form"
:visible
.
sync=
"open"
:rules=
"rules"
width=
"70%"
label-width=
"120px"
append-to-body
label-position=
"top"
destroy-on-close
class=
"app-container-form"
>
>
<el-row
:gutter=
"24"
>
<el-form
<el-col
:span=
"6"
>
ref=
"form"
<el-form-item
label=
"题库类别"
prop=
"categoryId"
>
:model=
"form"
<el-select
:rules=
"rules"
clearable
label-width=
"120px"
v-model=
"form.categoryId"
label-position=
"top"
placeholder=
"请选择题库类别"
class=
"app-container-form"
>
>
<el-option
<el-row
:gutter=
"24"
>
v-for=
"item in [
<el-col
:span=
"6"
>
{ label: '集合', value: '1' },
<el-form-item
label=
"题库类别"
prop=
"categoryId"
>
{ label: '不等式', value: '2' },
<el-select
{ label: '函数', value: '3' },
clearable
{ label: '数列', value: '4' },
v-model=
"form.categoryId"
{ label: '立体几何', value: '5' },
placeholder=
"请选择题库类别"
]"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
>
</el-option>
<el-option
</el-select>
v-for=
"item in [
</el-form-item>
{ label: '集合', value: '1' },
<el-form-item
label=
"年级阶段"
prop=
"phaseId"
>
{ label: '不等式', value: '2' },
<el-select
{ label: '函数', value: '3' },
clearable
{ label: '数列', value: '4' },
v-model=
"form.phaseId"
{ label: '立体几何', value: '5' },
placeholder=
"请选择阶段"
]"
@
change=
"handleQuery"
:key="item.value"
>
:label="item.label"
<el-option
:value="item.value"
v-for=
"item in [
>
{ label: '高一', value: '1' },
</el-option>
{ label: '高二', value: '2' },
</el-select>
{ label: '高三', value: '3' },
</el-form-item>
]"
<el-form-item
label=
"年级阶段"
prop=
"phaseId"
>
:key=
"item.value"
<el-select
:label=
"item.label"
clearable
:value=
"item.value"
v-model=
"form.phaseId"
placeholder=
"请选择阶段"
@
change=
"handleQuery"
>
>
</el-option>
<el-option
</el-select>
v-for=
"item in [
</el-form-item>
{ label: '高一', value: '1' },
<el-form-item
label=
"强度分类:"
prop=
"intensity"
>
{ label: '高二', value: '2' },
<!-- 1基础,2中等,3提高 -->
{ label: '高三', value: '3' },
<el-select
]"
clearable
:key="item.value"
v-model=
"form.intensity
"
:label="item.label
"
placeholder=
"请选择强度
"
:value="item.value
"
>
>
<el-option
</el-option>
v-for=
"item in [
</el-select>
{ label: '基础', value: '1' },
</el-form-item>
{ label: '中等', value: '2' },
<el-form-item
label=
"强度分类:"
prop=
"intensity"
>
{ label: '提高', value: '3' },
<!-- 1基础,2中等,3提高 -->
]"
<el-select
:key=
"item.value"
clearable
:label=
"item.label
"
v-model=
"form.intensity
"
:value=
"item.value
"
placeholder=
"请选择强度
"
>
>
</el-option>
<el-option
</el-select>
v-for=
"item in [
</el-form-item>
{ label: '基础', value: '1' },
<el-form-item
label=
"习题种类:"
prop=
"species"
>
{ label: '中等', value: '2' },
<!-- 1填空,2选择,3解答 -->
{ label: '提高', value: '3' },
<el-select
]"
clearable
:key="item.value"
v-model=
"form.species
"
:label="item.label
"
placeholder=
"请选择习题种类
"
:value="item.value
"
@
change=
"changeSpecies"
>
>
</el-option
>
<
el-option
<
/el-select>
v-for=
"item in [
</el-form-item>
{ label: '填空', value: '1' },
<el-form-item
label=
"习题种类:"
prop=
"species"
>
{ label: '选择', value: '2' },
<!-- 1填空,2选择,3解答 -->
{ label: '解答', value: '3' },
<el-select
]"
clearable
:key=
"item.value
"
v-model=
"form.species
"
:label=
"item.label
"
placeholder=
"请选择习题种类
"
:value=
"item.value
"
@
change=
"changeSpecies
"
>
>
</el-option>
<el-option
</el-select>
v-for=
"item in [
</el-form-item>
{ label: '填空', value: '1' },
</el-col>
{ label: '选择', value: '2' },
<el-col
:span=
"18"
>
{ label: '解答', value: '3' },
<el-form-item
label=
"题目"
prop=
"topic"
>
]"
<editor
v-model=
"form.topic"
:min-height=
"192"
/>
:key="item.value"
</el-form-item>
:label="item.label"
<
template
v-if=
"[1, '1', 3, '3'].includes(form.species)"
>
:value="item.value"
<el-form-item
label=
"答案"
prop=
"answer"
>
>
<editor
v-model=
"form.answer"
:min-height=
"192"
/>
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"答案图片"
prop=
"rightAnswersPic"
>
</el-col>
<imageUpload
:limit=
"9"
v-model=
"form.rightAnswersPic"
/>
<el-col
:span=
"18"
>
<el-form-item
label=
"题目"
prop=
"topic"
>
<editor
v-model=
"form.topic"
:min-height=
"192"
:iconType=
"['image']"
/>
</el-form-item>
</el-form-item>
</
template
>
<template
v-if=
"[1, '1', 3, '3'].includes(form.species)"
>
<
template
v-if=
"[2, '2'].includes(form.species)"
>
<el-form-item
label=
"答案"
prop=
"answer"
>
<el-form-item
label=
"选项"
prop=
"checkList"
>
<editor
<div
class=
"app-container-form-check"
>
v-model=
"form.answer"
<i
:min-height=
"192"
class=
"el-icon-circle-plus-outline app-container-form-check-add"
:iconType=
"['image']"
v-if=
"!form.checkList || !form.checkList.length"
/>
@
click=
"clickAddCheckList"
</el-form-item>
></i>
<el-form-item
label=
"答案图片"
prop=
"rightAnswersPic"
>
<div
<imageUpload
:limit=
"9"
v-model=
"form.rightAnswersPic"
/>
v-for=
"(item, index) in form.checkList"
</el-form-item>
:key=
"index"
</
template
>
class=
"app-container-form-check-item"
<
template
v-if=
"[2, '2'].includes(form.species)"
>
>
<el-form-item
label=
"选项"
prop=
"checkList"
>
<span
class=
"app-container-form-check-item-type"
>
{{
<div
class=
"app-container-form-check"
>
index
|
filterType
(
form
.
checkList
)
}}
</span
><i
v-if=
"index + 1 === form.checkList.length"
class=
"el-icon-circle-plus-outline app-container-form-check-item-add"
@
click=
"clickCheckItemAdd(index)"
></i>
<i
<i
class=
"el-icon-
remove-outline app-container-form-check-item-del
"
class=
"el-icon-
circle-plus-outline app-container-form-check-add
"
v-
else
v-
if=
"!form.checkList || !form.checkList.length"
@
click=
"click
CheckItemDel(index)
"
@
click=
"click
AddCheckList
"
></i>
></i>
<editor
v-model=
"item.html"
:min-height=
"192"
/>
<div
v-for=
"(item, index) in form.checkList"
:key=
"index"
class=
"app-container-form-check-item"
>
<span
class=
"app-container-form-check-item-type"
>
{{
index
|
filterType
(
form
.
checkList
)
}}
</span
><i
v-if=
"index + 1 === form.checkList.length"
class=
"el-icon-circle-plus-outline app-container-form-check-item-add"
@
click=
"clickCheckItemAdd(index)"
></i>
<i
class=
"el-icon-remove-outline app-container-form-check-item-del"
v-else
@
click=
"clickCheckItemDel(index)"
></i>
<editor
v-model=
"item.html"
:min-height=
"192"
:iconType=
"['image']"
/>
</div>
</div>
</div>
</div>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
label=
"标准答案"
label=
"标准答案"
prop=
"rightAnswers"
prop=
"rightAnswers"
v-if=
"form.checkList && form.checkList.length"
v-if=
"form.checkList && form.checkList.length"
>
>
<el-radio-group
v-model=
"form.rightAnswers"
>
<el-radio-group
v-model=
"form.rightAnswers"
>
<el-radio
<el-radio
:label=
"index"
:label=
"index"
v-for=
"(item, index) in form.checkList"
v-for=
"(item, index) in form.checkList"
:key=
"index"
:key=
"index"
>
{{
index
|
filterType
(
form
.
checkList
)
}}
</el-radio
>
{{
index
|
filterType
(
form
.
checkList
)
}}
</el-radio
>
>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
</
template
>
</
template
>
<el-form-item
label=
"典例精讲"
prop=
"explain"
>
<el-form-item
label=
"典例精讲"
prop=
"explain"
>
<el-switch
<el-switch
@
change=
"changeExplain"
@
change=
"changeExplain"
v-model=
"form.explain"
v-model=
"form.explain"
active-color=
"#409eff"
active-color=
"#409eff"
>
>
</el-switch>
</el-switch>
</el-form-item>
<
template
v-if=
"form.explain"
>
<el-form-item
label=
"解答过程"
prop=
"resolveCourse"
>
<editor
v-model=
"form.resolveCourse"
:min-height=
"192"
/>
</el-form-item>
<el-form-item
label=
"解答视频"
prop=
"resolveVideo"
>
<fileUpload
v-model=
"form.resolveVideo"
:limit=
"1"
:fileSize=
"10000"
:fileType=
"['mp4', 'mp3']"
/>
</el-form-item>
</el-form-item>
</
template
>
<
template
v-if=
"form.explain"
>
</el-col>
<el-form-item
label=
"解答过程"
prop=
"resolveCourse"
>
</el-row>
<editor
<!-- <el-form-item label="备注" prop="remark">
v-model=
"form.resolveCourse"
:min-height=
"192"
:iconType=
"['image']"
/>
</el-form-item>
<el-form-item
label=
"解答视频"
prop=
"resolveVideo"
>
<fileUpload
v-model=
"form.resolveVideo"
:limit=
"1"
:fileSize=
"1024"
:fileType=
"['mp4', 'mp3']"
/>
</el-form-item>
</
template
>
</el-col>
</el-row>
<!-- <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item> -->
</el-form-item> -->
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
:loading=
"buttonLoading"
type=
"primary"
@
click=
"submitForm"
<el-button
:loading=
"buttonLoading"
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button
>
确 定
</el-button
>
>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
</template>
</div>
</div>
</template>
</template>
...
@@ -760,7 +784,7 @@ export default {
...
@@ -760,7 +784,7 @@ export default {
isKong
=
false
;
isKong
=
false
;
if
(
index
<
25
)
{
if
(
index
<
25
)
{
self
.
form
.
checkList
.
forEach
((
item
,
ik
)
=>
{
self
.
form
.
checkList
.
forEach
((
item
,
ik
)
=>
{
if
(
self
.
IsEmptyStr
(
self
.
getWangEditorText
(
item
.
html
+
''
)
+
""
))
{
if
(
self
.
IsEmptyStr
(
self
.
getWangEditorText
(
item
.
html
+
""
)
+
""
))
{
isKong
=
true
;
isKong
=
true
;
}
}
});
});
...
@@ -839,7 +863,7 @@ export default {
...
@@ -839,7 +863,7 @@ export default {
});
});
},
},
getWangEditorText
(
str
)
{
getWangEditorText
(
str
)
{
console
.
log
(
str
,
"========str"
)
console
.
log
(
str
,
"========str"
);
if
(
str
)
{
if
(
str
)
{
return
str
return
str
.
replace
(
/<
[^
<p>
]
+>/g
,
""
)
// 将所有
<
p
>
标签
replace
''
.
replace
(
/<
[^
<p>
]
+>/g
,
""
)
// 将所有
<
p
>
标签
replace
''
...
@@ -859,18 +883,19 @@ export default {
...
@@ -859,18 +883,19 @@ export default {
},
},
/** 提交按钮 */
/** 提交按钮 */
submitForm
()
{
submitForm
()
{
let
self
=
this
,
isKong
=
false
;
let
self
=
this
,
isKong
=
false
;
self
.
isEditor
(
"topic"
);
self
.
isEditor
(
"topic"
);
if
(
self
.
form
.
checkList
&&
self
.
form
.
checkList
.
length
)
{
if
(
self
.
form
.
checkList
&&
self
.
form
.
checkList
.
length
)
{
self
.
form
.
checkList
.
forEach
((
item
,
ik
)
=>
{
self
.
form
.
checkList
.
forEach
((
item
,
ik
)
=>
{
console
.
log
(
item
.
html
)
console
.
log
(
item
.
html
)
;
if
(
self
.
IsEmptyStr
(
self
.
getWangEditorText
(
item
.
html
+
''
)
+
""
))
{
if
(
self
.
IsEmptyStr
(
self
.
getWangEditorText
(
item
.
html
+
""
)
+
""
))
{
isKong
=
true
;
isKong
=
true
;
}
}
});
});
if
(
isKong
)
{
if
(
isKong
)
{
self
.
$message
.
warning
(
"请填写选项内容"
);
self
.
$message
.
warning
(
"请填写选项内容"
);
self
.
$refs
.
form
.
validateField
(
'checkList'
);
self
.
$refs
.
form
.
validateField
(
"checkList"
);
}
}
}
}
if
(
self
.
form
.
explain
)
{
if
(
self
.
form
.
explain
)
{
...
...
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