Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-qa
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-qa
Commits
6cf762b3
提交
6cf762b3
authored
2月 23, 2022
作者:
matian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:获取所有项目列表接口
上级
1f814c47
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
154 行增加
和
170 行删除
+154
-170
base.js
src/api/base.js
+4
-0
api.js
src/modules/paper/api.js
+3
-104
QuestionList.vue
src/modules/paper/components/QuestionList.vue
+79
-30
QuestionListItems.vue
src/modules/paper/components/QuestionListItems.vue
+1
-1
Detail.vue
src/modules/paper/views/Detail.vue
+11
-11
List.vue
src/modules/paper/views/List.vue
+10
-4
NewPaper.vue
src/modules/paper/views/NewPaper.vue
+32
-18
index.js
src/store/index.js
+14
-2
没有找到文件。
src/api/base.js
浏览文件 @
6cf762b3
...
...
@@ -27,3 +27,7 @@ export function uploadFile(data) {
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
// 获取可访问的所有项目
export
function
getPermissionProject
()
{
return
httpRequest
.
get
(
'/qbs/admin/v1/projects'
)
}
src/modules/paper/api.js
浏览文件 @
6cf762b3
import
httpRequest
from
'@/utils/axios'
/**
* 获取
应用列表
* 获取
知识点/标签
*/
export
function
getAppList
(
params
)
{
return
httpRequest
.
get
(
'/api/permissions/admin/v1/applications'
,
{
params
})
}
/**
* 获取应用详情
*/
export
function
getApp
(
id
,
params
)
{
return
httpRequest
.
get
(
`/api/permissions/admin/v1/
${
id
}
/application`
,
{
params
})
}
/**
* 创建应用
*/
export
function
createApp
(
data
)
{
return
httpRequest
.
post
(
'/api/permissions/admin/v1/application'
,
data
)
}
/**
* 更新应用
*/
export
function
updateApp
(
id
,
data
)
{
return
httpRequest
.
put
(
`/api/permissions/admin/v1/
${
id
}
/application`
,
data
)
}
/**
* 删除应用
*/
export
function
deleteApp
(
id
,
data
)
{
return
httpRequest
.
delete
(
`/api/permissions/admin/v1/
${
id
}
/application`
,
data
)
}
/**
* 更新应用签名秘钥
*/
export
function
updateAppSecretKey
(
id
,
data
)
{
return
httpRequest
.
patch
(
`/api/permissions/admin/v1/
${
id
}
/application/secret-key`
,
data
)
}
/**
* 获取应用管理员
*/
export
function
getAppAdminUsers
(
params
)
{
return
httpRequest
.
get
(
`/api/permissions/admin/v1/
${
params
.
app_id
}
/application/assign/app-users`
,
{
params
})
}
/**
* 删除应用管理员
*/
export
function
deleteAppAdminUsers
(
appid
,
data
)
{
return
httpRequest
.
post
(
`/api/permissions/admin/v1/
${
appid
}
/application/assign/remove-app-users`
,
data
)
}
/**
* 创建成员
*/
export
function
createUser
(
appid
,
data
)
{
return
httpRequest
.
post
(
`/api/permissions/admin/v1/
${
appid
}
/application/user`
,
data
)
}
/**
* 创建应用管理员
*/
export
function
createAppAdminUsers
(
appid
,
data
)
{
return
httpRequest
.
post
(
`/api/permissions/admin/v1/
${
appid
}
/application/assign/users-to-app`
,
data
)
}
/**
* 获取事件列表
*/
export
function
getEventList
(
params
)
{
return
httpRequest
.
get
(
`/api/permissions/admin/v1/
${
params
.
app_id
}
/events`
,
{
params
})
}
/**
* 创建事件
*/
export
function
createEvent
(
appid
,
data
)
{
return
httpRequest
.
post
(
`/api/permissions/admin/v1/
${
appid
}
/event/create`
,
data
)
}
/**
* 更新事件
*/
export
function
updateEvent
(
id
,
data
)
{
return
httpRequest
.
put
(
`/api/permissions/admin/v1/event/
${
id
}
/update`
,
data
)
}
/**
* 删除事件
*/
export
function
deleteEvents
(
data
)
{
return
httpRequest
.
post
(
'/api/permissions/admin/v1/event/batch-delete'
,
data
)
}
/**
* 获取事件详情
*/
export
function
getEvent
(
params
)
{
return
httpRequest
.
get
(
`/api/permissions/admin/v1/event/
${
params
.
id
}
/detail`
,
{
params
})
}
/**
* 刷新事件token
*/
export
function
refreshEventToken
(
params
)
{
return
httpRequest
.
patch
(
`/api/permissions/admin/v1/event/
${
params
.
id
}
/refresh-token`
,
{
params
})
}
/**
* 获取获取事件回调记录列表
*/
export
function
getEventRecordList
(
params
)
{
return
httpRequest
.
get
(
`/api/permissions/admin/v1/
${
params
.
app_id
}
/event/records`
,
{
params
})
export
function
getKnowledge
(
params
)
{
return
httpRequest
.
get
(
'/admin/v1/knowledge-point/search/x1'
,
{
params
})
}
src/modules/paper/components/QuestionList.vue
浏览文件 @
6cf762b3
<
template
>
<div
style=
"margin-top: 32px"
>
<el-row
:gutter=
"
2
0"
>
<el-row
:gutter=
"
6
0"
>
<!-- 试题列表 -->
<el-col
:span=
"18"
>
<el-card
id=
"questionMain"
...
...
@@ -21,7 +21,7 @@
/>
<!-- 选题组卷无数据情况下显示 -->
<div
class=
"nonePaper"
v-show=
"questionList.length === 0"
>
<
!--
<el-result
icon=
"info"
subTitle=
"该试卷无试题,去添加试题吧"
></el-result>
--
>
<
el-result
icon=
"info"
subTitle=
"该试卷无试题,去添加试题吧"
></el-result
>
</div>
</el-card>
</el-col>
...
...
@@ -42,8 +42,9 @@
</el-card>
</el-col>
</el-row>
<AutomaticPaper
:visible
.
sync=
"visible"
v-if=
"paperMode === '自动组卷'"
/>
<!-- 选题组卷弹框 -->
<AutomaticPaper
:visible
.
sync=
"visible"
v-if=
"paperMode === '选题组卷'"
/>
<!-- 手动组卷弹框 -->
<addPaper
:visible
.
sync=
"visible"
v-else
/>
</div>
</
template
>
...
...
@@ -62,6 +63,10 @@ export default {
paperMode
:
{
type
:
String
,
default
:
''
},
paperTotalScore
:
{
type
:
Number
,
default
:
0
}
},
data
()
{
...
...
@@ -91,7 +96,8 @@ export default {
],
question_answer
:
'示向功能'
,
group_id
:
'1001'
,
score
:
2
score
:
2
,
question_order
:
2
},
{
question_title
:
'多选题'
,
...
...
@@ -119,7 +125,8 @@ export default {
}
],
question_answer
:
'示向功能、示向----'
,
group_id
:
'1002'
group_id
:
'1002'
,
question_order
:
1
},
{
question_title
:
'判断题'
,
...
...
@@ -142,7 +149,8 @@ export default {
}
],
question_answer
:
'正确'
,
group_id
:
'1003'
group_id
:
'1003'
,
question_order
:
3
},
{
question_title
:
'简答题'
,
...
...
@@ -153,7 +161,8 @@ export default {
child_question_type
:
0
,
question_answer
:
'2021年一季度华北市场的脱脂牛奶交易笔数为12000笔'
,
group_id
:
'1004'
,
score
:
2
score
:
2
,
question_order
:
4
},
{
question_title
:
'案例题'
,
...
...
@@ -164,7 +173,8 @@ export default {
child_question_type
:
0
,
question_answer
:
null
,
group_id
:
'1005'
,
score
:
8
score
:
8
,
question_order
:
5
},
{
question_title
:
'单选题'
,
...
...
@@ -186,7 +196,8 @@ export default {
],
question_answer
:
'2000'
,
group_id
:
'1005'
,
score
:
2
score
:
2
,
question_order
:
1
},
{
question_title
:
'多选题'
,
...
...
@@ -214,7 +225,8 @@ export default {
],
question_answer
:
'示向功能、示向----'
,
group_id
:
'1005'
,
score
:
2
score
:
2
,
question_order
:
2
},
{
question_title
:
'判断题'
,
...
...
@@ -237,7 +249,8 @@ export default {
],
question_answer
:
'正确'
,
group_id
:
'1005'
,
score
:
2
score
:
2
,
question_order
:
3
},
{
question_title
:
'简答题'
,
...
...
@@ -248,9 +261,21 @@ export default {
child_question_type
:
3
,
question_answer
:
'2021年一季度华北市场的脱脂牛奶交易笔数为12000笔'
,
group_id
:
'1005'
,
score
:
2
score
:
2
,
question_order
:
4
},
{
question_title
:
'简答题'
,
question_content
:
'<p>1111复购率在金融数字化营销中是反应用户对品牌忠诚度的一个重要指标,锡盟高钙奶是一家专门生产乳制品的企业,其中脱脂牛奶的销量一直不太理想,2021年一季度华北市场的脱脂牛奶交易笔数为12000笔,4000人实现二次购买,而这4000人当中2000人实现了三次购买。</p>'
,
question_type
:
5
,
is_parent
:
0
,
child_question_type
:
3
,
question_answer
:
'2021年一季度华北市场的脱脂牛奶交易笔数为12000笔'
,
group_id
:
'1005'
,
score
:
2
,
question_order
:
5
},
{
question_title
:
'情景题'
,
question_content
:
...
...
@@ -260,7 +285,8 @@ export default {
child_question_type
:
0
,
question_answer
:
null
,
group_id
:
'1006'
,
score
:
8
score
:
8
,
question_order
:
6
},
{
question_title
:
'单选题'
,
...
...
@@ -282,7 +308,8 @@ export default {
],
question_answer
:
'2000'
,
group_id
:
'1006'
,
score
:
2
score
:
2
,
question_order
:
1
},
{
question_title
:
'多选题'
,
...
...
@@ -310,7 +337,8 @@ export default {
],
question_answer
:
'示向功能、示向----'
,
group_id
:
'1006'
,
score
:
2
score
:
2
,
question_order
:
2
},
{
question_title
:
'判断题'
,
...
...
@@ -333,7 +361,8 @@ export default {
],
question_answer
:
'正确'
,
group_id
:
'1006'
,
score
:
2
score
:
2
,
question_order
:
3
},
{
question_title
:
'简答题'
,
...
...
@@ -344,7 +373,8 @@ export default {
child_question_type
:
3
,
question_answer
:
'2021年一季度华北市场的脱脂牛奶交易笔数为12000笔'
,
group_id
:
'1006'
,
score
:
2
score
:
2
,
question_order
:
4
},
{
...
...
@@ -356,7 +386,8 @@ export default {
child_question_type
:
0
,
question_answer
:
null
,
group_id
:
'1007'
,
score
:
8
score
:
8
,
question_order
:
7
},
{
question_title
:
'单选题'
,
...
...
@@ -378,7 +409,8 @@ export default {
],
question_answer
:
'2000'
,
group_id
:
'1007'
,
score
:
2
score
:
2
,
question_order
:
4
},
{
question_title
:
'多选题'
,
...
...
@@ -406,7 +438,8 @@ export default {
],
question_answer
:
'示向功能、示向----'
,
group_id
:
'1007'
,
score
:
2
score
:
2
,
question_order
:
3
},
{
question_title
:
'判断题'
,
...
...
@@ -429,7 +462,8 @@ export default {
],
question_answer
:
'正确'
,
group_id
:
'1007'
,
score
:
2
score
:
2
,
question_order
:
2
},
{
question_title
:
'简答题'
,
...
...
@@ -440,7 +474,8 @@ export default {
child_question_type
:
3
,
question_answer
:
'2021年一季度华北市场的脱脂牛奶交易笔数为12000笔'
,
group_id
:
'1007'
,
score
:
2
score
:
2
,
question_order
:
1
}
]
}
...
...
@@ -468,6 +503,7 @@ export default {
return
'情'
}
},
// 试题列表数据组装
getlist
()
{
const
newQuestionList
=
[]
const
bigData
=
this
.
questionList
.
filter
(
item
=>
item
.
is_parent
===
1
)
// 大题
...
...
@@ -478,17 +514,25 @@ export default {
if
(
bigData
[
i
].
group_id
===
smallData
[
j
].
group_id
)
{
// 如果大题的group_id和小题group_id相等就push listArray数组中,然后赋值给bigData[i].list 相当于加个list属性
listArray
.
push
(
smallData
[
j
])
// 符合就push listArray数组暂存
listArray
.
sort
(
compare
(
'question_order'
))
// 小题排序
bigData
[
i
].
list
=
listArray
}
}
newQuestionList
.
push
(
bigData
[
i
])
console
.
log
(
newQuestionList
)
}
this
.
questionList
=
newQuestionList
newQuestionList
.
sort
(
compare
(
'question_order'
))
// 大题排序
this
.
questionList
=
newQuestionList
// 组装完成的试题列表
// 根据属性值大小进行排序
function
compare
(
property
)
{
return
function
(
a
,
b
)
{
const
v1
=
a
[
property
]
const
v2
=
b
[
property
]
return
v1
-
v2
}
}
},
// 增加试题
addPaper
()
{
console
.
log
(
'dfjsf'
)
this
.
visible
=
true
},
// 切换题目编号
...
...
@@ -503,12 +547,17 @@ export default {
},
// 保存试卷
savePaper
()
{
// 校验小题分数和总分数是否相等
const
arr
=
this
.
questionList
.
map
(
item
=>
item
.
score
)
// 校验单个小题分数是否等于大题分数
// 校验大题分数和总分数是否相等
const
arr
=
this
.
questionList
.
map
(
item
=>
parseInt
(
item
.
score
))
const
r2
=
arr
.
reduce
((
pre
,
item
)
=>
(
pre
+=
item
),
0
)
if
(
r2
!==
this
.
paperTotalScore
)
{
this
.
$message
.
warning
(
'请校验分数'
)
}
console
.
log
(
r2
)
console
.
log
(
arr
)
console
.
log
(
this
.
questionList
)
//
console.log(this.questionList)
},
// 删除所选试题
delCheckedQuestion
()
{
...
...
src/modules/paper/components/QuestionListItems.vue
浏览文件 @
6cf762b3
...
...
@@ -65,7 +65,7 @@
</div>
</div>
</div>
<div
class=
"intricacyBoxMain"
v-for=
"(v, index) in item.list"
:key=
"index"
style=
"margintop: 20px"
>
<div
class=
"intricacyBoxMain"
v-for=
"(v, index) in item.list"
:key=
"index"
style=
"margin
-
top: 20px"
>
<div
class=
"intricacyHeader"
>
<div
class=
"intricacyDsc"
>
<div
class=
"intricacyTitle"
>
{{
index
+
1
}}
、
{{
v
.
question_title
}}
</div>
...
...
src/modules/paper/views/Detail.vue
浏览文件 @
6cf762b3
...
...
@@ -20,7 +20,7 @@
</el-descriptions>
</el-card>
<!-- 试卷列表 -->
<QuestionList
:paperMode=
"paperDetail.paperMode"
/>
<QuestionList
:paperMode=
"paperDetail.paperMode"
:paperTotalScore=
"paperDetail.paperTotalScore"
/>
</div>
</template>
...
...
@@ -33,16 +33,16 @@ export default {
return
JSON
.
parse
(
this
.
$route
.
query
.
paperDetail
)
}
},
watch
:
{
paperDetail
:
{
paperDetail
:
{
immediate
:
true
,
handler
(
data
)
{
this
.
form
=
Object
.
assign
({},
this
.
form
,
data
)
}
}
}
},
//
watch: {
//
paperDetail: {
//
paperDetail: {
//
immediate: true,
//
handler(data) {
//
this.form = Object.assign({}, this.form, data)
//
}
//
}
//
}
//
},
methods
:
{
// 编辑试卷
editPaper
()
{
...
...
src/modules/paper/views/List.vue
浏览文件 @
6cf762b3
<
template
>
<app-card>
<app-list
v-bind=
"tableOptions"
ref=
"list"
@
selection-change=
"handleSelectionChange"
>
<
template
#
header-aside
>
<
div
class=
"btn_operate"
>
<el-button
type=
"primary"
icon=
"el-icon-plus"
@
click=
"handleCreatePaper"
>
新建试卷
</el-button>
<el-button
type=
"primary"
icon=
"el-icon-plus"
@
click=
"batchDelete"
>
批量删除
</el-button>
</
template
>
</
div
>
<template
v-slot:table-x=
"
{ row }">
<el-button
type=
"text"
@
click=
"handleDdit(row)"
>
编辑
</el-button>
<el-button
type=
"text"
@
click=
"handleDetail(row)"
>
查看详情
</el-button>
...
...
@@ -15,7 +15,6 @@
</template>
<
script
>
// import { getAppList } from '../api'
const
paperMode
=
[
{
label
:
'选题组卷'
,
value
:
0
},
{
label
:
'自动组卷'
,
value
:
1
}
...
...
@@ -104,7 +103,7 @@ export default {
this
.
$router
.
push
({
path
:
'newPapers'
,
query
:
{
paper
Detail
:
row
,
row
Detail
:
row
,
isEdit
:
true
}
})
...
...
@@ -133,3 +132,10 @@ export default {
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.btn_operate
{
display
:
flex
;
justify-content
:
flex-end
;
margin-bottom
:
30px
;
}
</
style
>
src/modules/paper/views/NewPaper.vue
浏览文件 @
6cf762b3
<
template
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"160px"
:label-position=
"labelPosition"
>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"试卷名称"
prop=
"paperName"
...
...
@@ -31,7 +31,7 @@
</el-col>
</el-row>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"试卷分类"
prop=
"classification"
>
<el-select
v-model=
"form.classification"
placeholder=
"请选择试卷分类"
style=
"width: 100%"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
...
...
@@ -40,7 +40,7 @@
</el-col>
</el-row>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"组卷模式"
prop=
"paperMode"
>
<el-select
v-model=
"form.paperMode"
placeholder=
"请选择组卷模式"
style=
"width: 100%"
>
<el-option
label=
"自动组卷"
:value=
"0"
>
</el-option>
...
...
@@ -48,7 +48,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
10
"
>
<el-form-item
label=
"试题顺序"
:rules=
"[
{ message: '请选择试题顺序', required: true, trigger: 'change' }]"
...
...
@@ -63,7 +63,7 @@
</el-col>
</el-row>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"试卷总分"
prop=
"paperTotalScore"
...
...
@@ -81,7 +81,7 @@
></el-input-number>
</el-form-item>
</el-col>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
10
"
>
<el-form-item
label=
"及格分数"
prop=
"paperPassScore"
...
...
@@ -102,7 +102,7 @@
</el-col>
</el-row>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"考试时长"
prop=
"examDuration"
...
...
@@ -120,7 +120,7 @@
>
分钟
</el-form-item>
</el-col>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"最短交卷时长"
prop=
"minSubtime"
...
...
@@ -141,7 +141,7 @@
</el-col>
</el-row>
<el-row>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"多次考试"
:rules=
"[
{ required: true, trigger: 'blur' }]">
<el-radio-group
v-model=
"form.moreExam"
>
<el-radio
label=
"0"
>
否
</el-radio>
...
...
@@ -149,7 +149,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"
8
"
>
<el-col
:span=
"
12
"
>
<el-form-item
label=
"多次考试成绩计算规则"
style=
"padding-left: 20px"
v-if=
"form.moreExam === '1'"
>
<el-radio-group
v-model=
"form.rule"
>
<el-radio
label=
"0"
>
平均计算法
</el-radio>
...
...
@@ -204,6 +204,12 @@ export default {
}
},
watch
:
{
rowDetail
:
{
immediate
:
true
,
handler
(
data
)
{
this
.
form
=
Object
.
assign
({},
this
.
form
,
data
)
}
},
paperDetail
:
{
immediate
:
true
,
handler
(
data
)
{
...
...
@@ -226,10 +232,12 @@ export default {
history
.
go
(
-
1
)
})
}
else
{
setTimeout
(()
=>
{
// 表单校验不通过聚焦至第一个不通过的输入框
// const isError = document.getElementsByClassName('is-error')
// isError[0].querySelector('input').focus()
// return false
const
isError
=
document
.
getElementsByClassName
(
'is-error'
)
isError
[
0
].
querySelector
(
'input'
).
focus
()
},
100
)
return
false
}
})
},
...
...
@@ -240,13 +248,19 @@ export default {
this
.
$confirm
(
'保存成功!'
,
{
confirmButtonText
:
'确定'
}).
then
(()
=>
{
// 待确认
// 调用接口
// this.$router.push({
// path: 'detail'
// })
})
}
else
{
// // 表单校验不通过聚焦至第一个不通过的输入框
// const isErrors = document.getElementsByClassName('is-error')
// isErrors[0].querySelector('el-input').focus()
// return false
setTimeout
(()
=>
{
// 表单校验不通过聚焦至第一个不通过的输入框
const
isError
=
document
.
getElementsByClassName
(
'is-error'
)
isError
[
0
].
querySelector
(
'input'
).
focus
()
},
100
)
return
false
}
})
}
...
...
src/store/index.js
浏览文件 @
6cf762b3
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
{
getUser
,
logout
}
from
'@/api/base'
import
{
getUser
,
logout
,
getPermissionProject
}
from
'@/api/base'
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
state
:
{
user
:
{}
user
:
{},
projects
:
[]
},
mutations
:
{
setUser
(
state
,
user
)
{
state
.
user
=
user
},
setProject
(
state
,
projects
)
{
state
.
projects
=
projects
}
},
actions
:
{
...
...
@@ -43,8 +47,16 @@ const store = new Vuex.Store({
return
false
})
return
isLogin
},
getPermissionProject
({
commit
})
{
getPermissionProject
().
then
(
response
=>
{
const
{
projects
=
[]
}
=
response
.
data
commit
(
'setProject'
,
projects
)
return
response
.
data
})
}
}
})
store
.
dispatch
(
'getPermissionProject'
)
export
default
store
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论