Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
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
罗超
confucius
Commits
c6595a93
Commit
c6595a93
authored
Jan 13, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
9a9d5a5d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
285 additions
and
39 deletions
+285
-39
common.js
src/api/common/common.js
+38
-29
question-upload.vue
src/components/question/question-upload.vue
+213
-0
course.vue
src/pages/course/course.vue
+2
-7
question.vue
src/pages/course/question.vue
+32
-3
No files found.
src/api/common/common.js
View file @
c6595a93
...
...
@@ -62,38 +62,47 @@ export function UploadSelfFile(path, file, callback, configObj) {
/**
* 上传到当前站点
*/
export
function
UploadLocalSystem
(
configObj
,
fileObj
,
successCall
)
{
var
uploadLoadding
=
Loading
;
uploadLoadding
.
show
({
message
:
'正在上传文件,请稍后...'
})
let
url
=
process
.
env
.
API
+
"/Upload/UploadFile"
;
let
formData
=
new
FormData
()
if
(
configObj
)
{
formData
.
append
(
"params"
,
configObj
);
*/
export
function
UploadLocalSystem
(
configObj
,
fileObj
,
successCall
)
{
var
uploadLoadding
=
Loading
;
uploadLoadding
.
show
({
message
:
'正在上传文件,请稍后...'
})
let
url
=
process
.
env
.
API
+
"/Upload/UploadFile"
;
let
formData
=
new
FormData
()
if
(
configObj
)
{
formData
.
append
(
"params"
,
configObj
);
}
formData
.
append
(
'myfile'
,
fileObj
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
()
{
uploadLoadding
.
hide
();
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
&&
jsonObj
.
StatusCode
&&
jsonObj
.
StatusCode
==
1
&&
successCall
)
{
var
uploadResult
=
{
Code
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
process
.
env
.
API
+
jsonObj
.
FilePath
,
VideoCoverImg
:
process
.
env
.
API
+
jsonObj
.
VideoCoverImg
,
Data
:
jsonObj
.
Data
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
}
formData
.
append
(
'myfile'
,
fileObj
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
()
{
uploadLoadding
.
hide
();
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
.
StatusCode
==
1
&&
successCall
)
{
var
uploadResult
=
{
Code
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
process
.
env
.
API
+
jsonObj
.
FilePath
,
VideoCoverImg
:
process
.
env
.
API
+
jsonObj
.
VideoCoverImg
,
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
if
(
jsonObj
&&
jsonObj
.
Code
&&
jsonObj
.
Code
==
1
&&
successCall
)
{
var
uploadResult
=
{
Code
:
1
,
Data
:
jsonObj
.
Data
,
Message
:
jsonObj
.
Message
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
}
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}
/**
...
...
src/components/question/question-upload.vue
0 → 100644
View file @
c6595a93
<
style
>
</
style
>
<
template
>
<q-dialog
v-model=
"persistent"
persistent
content-class=
"bg-grey-1"
transition-show=
"scale"
transition-hide=
"scale"
>
<q-card
style=
"width: 1400px;max-width:900px;"
>
<q-card-section>
<div
class=
"text-h6"
>
{{
importType
==
1
?
'模板导入(EXCEL)'
:
'智能导入(WORD)'
}}
</div>
</q-card-section>
<table>
<tr>
<td>
<el-upload
class=
"avatar-uploader"
action=
""
:accept=
"accept"
:show-file-list=
"false"
:http-request=
"UploadAttachment"
>
<div
class=
"app-upload"
flex=
"main:center cross:center"
style=
"width: 100px; height: 100px;"
>
<i
class=
"el-icon-upload"
></i>
</div>
</el-upload>
</td>
</tr>
</table>
<br
/>
<table>
<tr>
<td>
<template
v-for=
"(item,index) in questionData"
>
<div
style=
"margin-bottom:20px;"
>
<span>
{{
index
+
1
}}
. [
{{
item
.
QuestionTypeName
}}
]
{{
item
.
Title
}}
</span><br
/>
<template
v-if=
"item.QuestionTypeName=='单选题'||item.QuestionTypeName=='多选题'"
>
<template
v-if=
"item.OptionA"
>
<span>
A.
{{
item
.
OptionA
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionB"
>
<span>
B.
{{
item
.
OptionB
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionC"
>
<span>
C.
{{
item
.
OptionC
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionD"
>
<span>
D.
{{
item
.
OptionD
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionE"
>
<span>
E.
{{
item
.
OptionE
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionF"
>
<span>
F.
{{
item
.
OptionF
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionG"
>
<span>
G.
{{
item
.
OptionG
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.OptionH"
>
<span>
H.
{{
item
.
OptionH
}}
</span><br
/>
</
template
>
</template>
<span>
答案:{{item.QuestionAnswer}}
</span><br
/>
<
template
v-if=
"item.AnswerAnalysis"
>
<span>
答案解析:
{{
item
.
AnswerAnalysis
}}
</span><br
/>
</
template
>
<
template
v-if=
"item.EasyType"
>
<span
v-if=
"item.EasyType"
>
难易程度:
{{
item
.
EasyType
}}
</span><br
/>
</
template
>
</div>
</template>
</td>
</tr>
</table>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
@
click=
"closeCourseForm"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveCourseLoading"
@
click=
"setQuestion"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<
script
>
import
{
queryQuestionTypeList
,
queryDifficultyType
,
saveQuestion
,
queryQuestionInfo
}
from
'../../api/question/question'
import
{
CreateQuestion
,
//生成问题
}
from
'../../api/question/questionconfig'
import
{
UploadSelfFile
,
UploadLocalSystem
}
from
'../../api/common/common'
import
UeEditor
from
'../editor/UeEditor'
//知识点列表
import
questionpoint
from
'./questionpoint'
import
single
from
'../questiontype/single'
import
multiple
from
'../questiontype/multiple'
import
fillIn
from
'../questiontype/fill-in'
import
judge
from
'../questiontype/judge'
import
shortAnswer
from
'../questiontype/short-answer'
import
entryProblem
from
'../questiontype/entry-problem'
import
matching
from
'../questiontype/matching'
import
sortingProblem
from
'../questiontype/sorting-problem'
import
cloze
from
'../questiontype/cloze'
import
readingComprehensio
from
'../questiontype/reading-comprehensio'
import
sharingChoose
from
'../questiontype/sharing-choose'
export
default
{
components
:
{
UeEditor
,
questionpoint
,
//知识点
single
,
//单选题
multiple
,
//多选题
fillIn
,
//填空题
judge
,
//判断题
shortAnswer
,
//简答题
entryProblem
,
//分录题
matching
,
//连线题
sortingProblem
,
//排序题
cloze
,
//完型填空
readingComprehensio
,
//阅读理解
sharingChoose
,
//共用选择题
},
props
:
{
importType
:
{
type
:
Number
,
default
:
0
//1-模板导入(Excel),2-智能导入(Word)
},
CourseId
:
{
type
:
String
,
default
:
"0"
,
}
},
data
()
{
return
{
config
:
{
initialFrameWidth
:
null
,
initialFrameHeight
:
80
,
},
persistent
:
true
,
objOption
:
{
QuestionId
:
0
,
//问题编号
CourseId
:
0
,
//课程编号
Title
:
""
,
//问题名称
DifficultyType
:
1
,
//难易程度
AnswerParse
:
""
,
//答案解析JSON
QuestionTypeId
:
0
,
//问题类型
QuestionTypeKey
:
""
,
//问题类型Key
Knowledge
:
""
,
//知识点编号
IsUpdateJobExam
:
0
,
//是否同步修改引用此题目的作业和考试(1-是)
SortNum
:
0
,
//排序
Answer
:
""
,
//问题JSON
IsMutex
:
0
,
//填空题(答案顺序打乱也判正确)
},
AnswerList
:
[],
optionTitle
:
""
,
questionObj
:
{},
//题目类型对象
firstTypeList
:
[],
//前5个数组
secondTypeList
:
[],
//后面的题型
questionDifficultyTypeList
:
[],
//问题难易程度列表
saveCourseLoading
:
false
,
isShowPoint
:
false
,
//是否显示知识点弹窗
choosePointArray
:
[],
//知识点列表
questionData
:
[],
//导入问题列表
}
},
computed
:
{
accept
:
{
get
()
{
if
(
this
.
importType
==
1
)
{
return
'.xls,.xlsx'
;
}
if
(
this
.
importType
==
2
)
{
return
'.doc,.docx'
;
}
return
'*/*'
;
},
},
},
created
()
{
},
mounted
()
{
},
methods
:
{
UploadAttachment
(
files
)
{
var
fileParams
=
{
Analysis
:
1
,
CourseId
:
this
.
CourseId
,
Uid
:
this
.
getLocalStorage
().
Id
}
if
(
this
.
importType
==
2
)
{
fileParams
.
Word
=
1
;
}
else
{
fileParams
.
Excel
=
1
;
}
UploadLocalSystem
(
JSON
.
stringify
(
fileParams
),
files
.
file
,
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
questionData
=
res
.
Data
;
}
})
},
//关闭弹窗
closeCourseForm
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
setQuestion
()
{
}
},
}
</
script
>
src/pages/course/course.vue
View file @
c6595a93
...
...
@@ -35,7 +35,7 @@
</
template
>
<
template
v-slot:body-cell-CourseIntro=
"props"
>
<q-td
:props=
"props"
>
<span
v-html=
"props.value"
></span>
<span
v-html=
"props.value"
></span>
</q-td>
</
template
>
<
template
v-slot:body-cell-Status=
"props"
>
...
...
@@ -105,12 +105,7 @@
field
:
'CoverImg'
,
align
:
'left'
},
{
name
:
'CourseIntro'
,
label
:
'课程介绍'
,
field
:
'CourseIntro'
,
align
:
'left'
},
{
name
:
'CreateByName'
,
label
:
'创建人'
,
...
...
src/pages/course/question.vue
View file @
c6595a93
<
style
>
.page-content
p
{
margin
:
16px
0
0
0
!important
;
.page-content
p
{
margin
:
16px
0
0
0
!important
;
}
</
style
>
<
template
>
<div
class=
"page-body"
>
...
...
@@ -35,6 +36,20 @@
<q-space
/>
<div
class=
"page-option"
>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"add"
label=
"新增题目"
@
click=
"EditQuestion(null)"
/>
<q-btn-dropdown
color=
"accent"
label=
"批量导入"
size=
"sm"
class=
"q-mr-md"
style=
"margin-left:5px;"
>
<q-list>
<q-item
clickable
v-close-popup
>
<q-item-section
@
click=
"importQuestion(1)"
>
<q-item-label>
模板导入(EXCEL)
</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
>
<q-item-section
@
click=
"importQuestion(2)"
>
<q-item-label>
智能导入(WORD)
</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</
template
>
<
template
v-slot:body-cell-Title=
"props"
>
...
...
@@ -57,6 +72,9 @@
<question-form
v-if=
"isShowQuestionForm"
:CourseId=
"msg.CourseId"
:seting-obj=
"questionObj"
@
close=
"closeQuestion"
@
success=
"refreshQuestion"
>
</question-form>
<question-upload
v-if=
"isShowImportUpload"
:CourseId=
"msg.CourseId"
:importType=
"importType"
@
close=
"closeQuestion"
@
success=
"refreshQuestion"
>
</question-upload>
</div>
</div>
</template>
...
...
@@ -68,12 +86,14 @@
queryDifficultyType
}
from
'../../api/question/question'
;
import
questionForm
from
'../../components/question/question-form'
;
import
questionUpload
from
'../../components/question/question-upload'
;
export
default
{
meta
:
{
title
:
"题库列表"
},
components
:
{
questionForm
questionForm
,
questionUpload
},
data
()
{
return
{
...
...
@@ -130,6 +150,8 @@
questionDifficultyTypeList
:
[],
//问题难易程度列表
isShowQuestionForm
:
false
,
questionObj
:
null
,
importType
:
0
,
//导入类型(1-模板导入;2-智能导入)
isShowImportUpload
:
false
,
//是否显示导入模板
}
},
created
()
{
...
...
@@ -143,6 +165,10 @@
this
.
getQuestionList
();
},
methods
:
{
importQuestion
(
type
)
{
this
.
importType
=
type
;
this
.
isShowImportUpload
=
true
;
},
//获取题型列表
getQuestionType
()
{
queryQuestionTypeList
({}).
then
(
res
=>
{
...
...
@@ -220,6 +246,7 @@
//刷新页面
refreshQuestion
()
{
this
.
isShowQuestionForm
=
false
;
this
.
isShowImportUpload
=
false
;
this
.
getQuestionList
();
},
//新增修改问题
...
...
@@ -235,6 +262,8 @@
closeQuestion
()
{
this
.
isShowQuestionForm
=
false
;
this
.
questionObj
=
null
;
this
.
isShowImportUpload
=
false
;
this
.
importType
=
0
;
},
}
}
...
...
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