feat: 我的课程接口对接

This commit is contained in:
cgd_mac 2022-01-16 10:26:12 +08:00
parent c7f51a10dc
commit 04c18d2561
17 changed files with 381 additions and 294 deletions

View File

@ -48,4 +48,13 @@ export default {
justify-content: center; justify-content: center;
} }
//
.ant-pro-basicLayout-children-content-wrap{
height: 100%;
}
.ant-pro-grid-content{
height: 100%;
}
</style> </style>

58
src/api/mycourse/index.js Normal file
View File

@ -0,0 +1,58 @@
import request from '@/utils/request'
const mycourseApi = {
mycourseList: 'myCourse/getMyCourseList', // 我的课程列表,课程搜索
addMyCourse: 'myCourse/addMyCourse', // 添加课程
centerList: 'focused/training/list', // 集中培训列表
centerDetail: 'focused/training/list', // 集中培训详情
recommendList: 'sys/recommend/listPage', // 系统推荐课程列表
recommendDetail: 'sys/recommend/detail' // 系统课程推荐详情
}
export function reqMyCourseList (params) {
return request({
url: mycourseApi.mycourseList,
method: 'get',
params: params
})
}
export function reqAddMyCourse (params) {
return request({
url: mycourseApi.addMyCourse,
method: 'get',
params: params
})
}
export function reqCourseCenterList (params) {
return request({
url: mycourseApi.centerList,
method: 'get',
params: params
})
}
export function reqCourseCenterDetail (params) {
return request({
url: mycourseApi.centerDetail,
method: 'get',
params: params
})
}
export function reqRecommendList (params) {
return request({
url: mycourseApi.recommendList,
method: 'get',
params: params
})
}
export function recommendDetail (params) {
return request({
url: mycourseApi.recommendDetail,
method: 'get',
params: params
})
}

13
src/api/myexam/exam.js Normal file
View File

@ -0,0 +1,13 @@
import request from '@/utils/request'
const examApi = {
examList: 'exam/list', // 我的考试-预约考试列表
}
export function reqExamList (params) {
return request({
url: examApi.examList,
method: 'get',
params: params
})
}

View File

@ -0,0 +1,13 @@
import request from '@/utils/request'
const countApi = {
myexamCount: 'studyStatistics/getMyCourseList' // 学习统计
}
export function getMyexamCount (params) {
return request({
url: countApi.myexamCount,
method: 'get',
params: params
})
}

View File

@ -0,0 +1,22 @@
import request from '@/utils/request'
const answerApi = {
answerViewReport: 'answer/viewReport', // 查看报告
answerViewResolution: 'answer/viewResolution' // 查看解析
}
export function answerViewReport (params) {
return request({
url: answerApi.answerViewReport,
method: 'get',
params: params
})
}
export function answerViewResolution (params) {
return request({
url: answerApi.answerViewResolution,
method: 'get',
params: params
})
}

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="report-box"> <div class="report-box">
<a-row :gutter="30"> <a-row :gutter="30">
<a-col :span="12"> <a-col :span="24">
<a-card title="得分统计" :bordered="false"> <a-card title="得分统计" :bordered="false">
<a-row :gutter="30" style="margin: 15px 0;"> <a-row :gutter="30" style="margin: 15px 0;">
<a-col :span="12" class="flex-center"> <a-col :span="12" class="flex-center">
@ -16,7 +16,7 @@
</a-card> </a-card>
</a-col> </a-col>
<!-- <a-divider type="vertical" /> --> <!-- <a-divider type="vertical" /> -->
<a-col :span="12"> <!-- <a-col :span="12">
<a-card title="答题分析" :bordered="false"> <a-card title="答题分析" :bordered="false">
<a-table :columns="columns" :data-source="dataList" size="small" :pagination="false" :bordered="false"> <a-table :columns="columns" :data-source="dataList" size="small" :pagination="false" :bordered="false">
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
@ -24,7 +24,7 @@
</span> </span>
</a-table> </a-table>
</a-card> </a-card>
</a-col> </a-col> -->
<a-col :span="24" style="margin-top: 15px;"> <a-col :span="24" style="margin-top: 15px;">
<a-card title="答题卡" :bordered="false"> <a-card title="答题卡" :bordered="false">
<ul class="answer-box"> <ul class="answer-box">

View File

@ -41,8 +41,8 @@
<div><span style="margin-right: 20px;">答题情况做对{{ item.rightQuestions }}/{{ item.totalQuestions }}</span><span>交卷时间{{ item.submitTime }}</span></div> <div><span style="margin-right: 20px;">答题情况做对{{ item.rightQuestions }}/{{ item.totalQuestions }}</span><span>交卷时间{{ item.submitTime }}</span></div>
</div> </div>
<div style="flex: 0 0 200px; text-align: right;"> <div style="flex: 0 0 200px; text-align: right;">
<div :span="24" style="margin-bottom: 10px;"><a-button type="primary" size="small" >查看报告</a-button></div> <div @click="handlerGoReport(item, 1)" :span="24" style="margin-bottom: 10px;"><a-button type="primary" size="small" >查看报告</a-button></div>
<div :span="24"><a-button type="primary" size="small">查看解析</a-button></div> <div @click="handlerGoReport(item, 2)" :span="24"><a-button type="danger" size="small">查看解析</a-button></div>
</div> </div>
</div> </div>
</a-card> </a-card>
@ -85,7 +85,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.activeTab = this.$route.query.type || '1', this.activeTab = this.$route.query.type || '1'
this.initData() this.initData()
}, },
methods: { methods: {
@ -124,6 +124,13 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this[`getPractice${type}PageList`]() this[`getPractice${type}PageList`]()
}) })
},
// /
handlerGoReport (item, type) {
this.$router.push({
path: '/myreport',
query: { type: type, reportId: item.reportId }
})
} }
} }
} }

View File

@ -86,15 +86,23 @@ export default {
.exam-detail { .exam-detail {
display: flex; display: flex;
max-height: 100%; max-height: 100%;
height: 100%;
.exam-box { .exam-box {
flex: 1; flex: 1;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
} }
.exam-line { .exam-line {
flex: 0 0 10px; flex: 0 0 10px;
} }
.answer-card { .answer-card {
flex: 0 0 400px; flex: 0 0 400px;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
} }
} }

View File

@ -10,10 +10,19 @@
:showPagination="false" :showPagination="false"
:data-source="dataList" :data-source="dataList"
:rowKey="record => record.id"> :rowKey="record => record.id">
<span slot="action" slot-scope="text, record, index"> <template slot="trainSdate" slot-scope="text, record">
<a v-if="index % 3 == 1" @click="$refs.userForm.edit(record)">添加课程</a> {{ record.trainSdate }}{{ record.trainEdate }}
<a v-if="index % 3 == 2" @click="$refs.userForm.edit(record)">继续学习</a> </template>
<a v-if="index % 3 == 0">已完成学习</a> <span slot="status" slot-scope="text, record">
<a-tag v-if="record.status === 1" color="orange">未发布</a-tag>
<a-tag v-if="record.status === 2" color="orange">未开始</a-tag>
<a-tag v-if="record.status === 3" color="blue">进行中</a-tag>
<a-tag v-if="record.status === 4" color="green">已结束</a-tag>
<a-tag v-if="record.status === 5" color="red">已中止</a-tag>
<template v-else>-</template>
</span>
<span slot="action" slot-scope="text, record">
<a @click="handlerDetail(record)">培训详情</a>
</span> </span>
</a-table> </a-table>
<CentralizedTrainingDetail ref="centralizedTrainingDetail"></CentralizedTrainingDetail> <CentralizedTrainingDetail ref="centralizedTrainingDetail"></CentralizedTrainingDetail>
@ -21,10 +30,7 @@
</template> </template>
<script> <script>
import { userPage, userDel, passwordReset } from '@/api/security/user' import { reqCourseCenterList } from '@/api/mycourse/index'
import { getCourseList, deleteCourse } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { dictToTree } from '@/utils/util'
import CentralizedTrainingDetail from './CentralizedTrainingDetail.vue' import CentralizedTrainingDetail from './CentralizedTrainingDetail.vue'
export default { export default {
components: { components: {
@ -38,16 +44,16 @@ export default {
columns: [ columns: [
{ {
title: '培训名称', title: '培训名称',
dataIndex: 'courseName', dataIndex: 'trainName'
scopedSlots: { customRender: 'courseName' }
}, },
{ {
title: '培训时间', title: '培训时间',
dataIndex: 'courseTypeName' dataIndex: 'trainSdate',
scopedSlots: { customRender: 'trainSdate' }
}, },
{ {
title: '培训地点', title: '培训地点',
dataIndex: 'date' dataIndex: 'address'
}, },
{ {
title: '培训状态', title: '培训状态',
@ -62,7 +68,7 @@ export default {
], ],
// Promise // Promise
loadData: parameter => { loadData: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return reqCourseCenterList({ pageNum: 1, pageSize: 5 }).then(res => {
return res return res
}) })
}, },
@ -70,47 +76,16 @@ export default {
options: {} options: {}
} }
}, },
created () { mounted () {
this.dictionaryDropDown() setTimeout(() => {
this.loading = false
}, 800)
}, },
methods: { methods: {
tabChange (key) {
console.log('key', key)
},
// //
handlerDetail () { handlerDetail (row) {
this.$refs.aycourseDetail.getDetail(row)
this.$refs.aycourseDetail.visible = true this.$refs.aycourseDetail.visible = true
},
//
dictionaryDropDown () {
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.loading = false
this.queryOptions[1].options = dictToTree(res.data, [], 0)
})
},
classificationChange (value) {
this.queryParam.classification = value
},
//
handleRefresh () {
},
sysUserDelete (param) {
userDel(param)
.then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.msg)
}
})
.catch(err => {
this.$message.error('删除错误:' + err.msg)
})
},
handleOk () {
this.$refs.table.refresh()
} }
} }
} }

View File

@ -1,36 +1,53 @@
<template> <template>
<a-modal title="集中培训详情" :width="800" :visible="visible" :confirmLoading="confirmLoading" :footer="null"> <a-modal title="集中培训详情" :width="800" v-model="visible" :confirmLoading="confirmLoading" :footer="null">
<a-descriptions title="User Info"> <a-descriptions :column="1" title="">
<a-descriptions-item label="UserName"> <a-descriptions-item label="培训名称">
Zhou Maomao {{ data.trainName }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="Telephone"> <a-descriptions-item label="培训时间">
1810000000 {{ data.trainSdate }}{{ data.trainEdate }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="Live"> <a-descriptions-item label="主持人">
Hangzhou, Zhejiang {{ data.host }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="Remark"> <a-descriptions-item label="会议人数">
empty {{ data.personNum }}/{{ data.personNum }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="Address"> <a-descriptions-item label="学习内容">
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China {{ data.learningContent }}
</a-descriptions-item>
<a-descriptions-item label="联系人">
{{ data.contact }}({{ data.phone }})
</a-descriptions-item>
<a-descriptions-item label="备注">
{{ data.remark }}
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<div v-if="data.status === 3" class="flex-center">
<a-button @click="handlerJoin" type="primary">报名参加</a-button>
</div>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { reqCourseCenterDetail } from '@/api/mycourse/index'
export default { export default {
data () { data () {
return { return {
visible: false, visible: false,
confirmLoading: false confirmLoading: false,
data: {}
} }
}, },
methods: { methods: {
// getDetail (row) {
handlerStartLearn () {} reqCourseCenterDetail({ projectId: row.id }).then(res => {
this.data = res.data
})
},
handlerJoin () {
}
} }
} }
</script> </script>

View File

@ -30,102 +30,27 @@
</template> </template>
<script> <script>
import { userPage, userDel, passwordReset } from '@/api/security/user' import { reqRecommendList } from '@/api/mycourse/index'
import { getCourseList, deleteCourse } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { dictToTree } from '@/utils/util'
import { STable, SearchCom } from '@/components'
export default { export default {
components: { components: {
STable,
SearchCom
}, },
data () { data () {
return { return {
dataList: [], dataList: [],
activeTab: '1', loading: true
loading: true,
queryParam: {
classification: '' //
},
queryOptions: [
{ type: 'input', placeholder: '课程名称', key: 'courseName' },
{ type: 'select-dic-tree', placeholder: '请选择课程类别', key: 'courseType', options: [] }
],
//
columns: [
{
title: '课程名称',
dataIndex: 'courseName',
scopedSlots: { customRender: 'courseName' }
},
{
title: '课程类别',
dataIndex: 'courseTypeName'
},
{
title: '学习时间',
dataIndex: 'date'
},
{
title: '操作',
width: '150px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
}
],
// Promise
loadData: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => {
return res
})
},
selectedRows: [], //
options: {}
} }
}, },
created () { mounted () {
this.dictionaryDropDown() this.initData()
}, },
methods: { methods: {
tabChange (key) { initData () {
console.log('key', key) reqRecommendList({ pageSize: 20, pageNum: 1 }).then(res => {
}, this.dataList = res.rows
//
handlerDetail () {
this.$refs.aycourseDetail.visible = true
},
//
dictionaryDropDown () {
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.queryOptions[1].options = dictToTree(res.data, [], 0)
this.loading = false this.loading = false
}) })
}, }
classificationChange (value) {
this.queryParam.classification = value
},
//
handleRefresh () {
},
sysUserDelete (param) {
userDel(param)
.then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.msg)
}
})
.catch(err => {
this.$message.error('删除错误:' + err.msg)
})
},
handleOk () {
this.$refs.table.refresh()
}
} }
} }
</script> </script>

View File

@ -18,7 +18,6 @@
:pageSize="5" :pageSize="5"
:columns="columns" :columns="columns"
:data="loadData" :data="loadData"
:alert="options.alert"
:rowKey="record => record.id"> :rowKey="record => record.id">
<span slot="index" slot-scope="text, record, index"> <span slot="index" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
@ -27,34 +26,29 @@
<a-button @click="handlerDetail(record)" type="link" >{{ record.courseName }}</a-button> <a-button @click="handlerDetail(record)" type="link" >{{ record.courseName }}</a-button>
</template> </template>
<span slot="status" slot-scope="text, record"> <span slot="status" slot-scope="text, record">
<a-tag color="red">未开始</a-tag> <a-tag v-if="record.status === 1" color="red">未开始</a-tag>
<a-tag v-if="record.status === 2" color="blue">进行中</a-tag>
<a-tag v-if="record.status === 3" color="green">已完成</a-tag>
<template v-else>-</template>
</span> </span>
<template slot="progress" slot-scope="text, record"> <template slot="schedule" slot-scope="text, record">
<a-progress :percent="30" /> <a-progress :percent="record.schedule" />
</template> </template>
<span slot="action" slot-scope="text, record, index"> <template slot="learnHours" slot-scope="text, record">
<a v-if="index % 3 == 1" @click="$refs.userForm.edit(record)">添加课程</a> {{ record.learnHours }}小时
<a v-if="index % 3 == 2" @click="$refs.userForm.edit(record)">继续学习</a> </template>
<a v-if="index % 3 == 0">已完成学习</a> <span slot="action" slot-scope="text, record">
<!-- <a-divider type="vertical" /> <a-popconfirm
<a-dropdown v-if="hasPerm('sys:user:resetPwd') || hasPerm('sys:user:grantRole') || hasPerm('sys:user:del')"> v-if="record.status === 1"
<a class="ant-dropdown-link"> 更多 <a-icon type="down" /> </a> :title="`确定要添加${record.name}课程吗?`"
<a-menu slot="overlay"> ok-text="添加"
<a-menu-item v-if="hasPerm('sys:user:resetPwd')"> cancel-text="取消"
<a-popconfirm placement="topRight" title="确认重置密码?" @confirm="() => resetPwd(record)"> @confirm="handlerAddCourse(record)"
<a>重置密码</a> >
<a>添加课程</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item> <a v-if="record.status === 2" @click="handlerContinue(record)">继续学习</a>
<a-menu-item v-if="hasPerm('sys:user:grantRole')"> <a v-if="record.status === 3">已完成学习</a>
<a @click="$refs.userRoleForm.userRole(record)">授权角色</a>
</a-menu-item>
<a-menu-item v-if="hasPerm('sys:user:delete')">
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown> -->
</span> </span>
</s-table> </s-table>
<MycourseDetail ref="aycourseDetail"></MycourseDetail> <MycourseDetail ref="aycourseDetail"></MycourseDetail>
@ -62,8 +56,7 @@
</template> </template>
<script> <script>
import { userPage, userDel, passwordReset } from '@/api/security/user' import { reqMyCourseList } from '@/api/mycourse/index'
import { getCourseList, deleteCourse } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem' import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { dictToTree } from '@/utils/util' import { dictToTree } from '@/utils/util'
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
@ -80,11 +73,12 @@ export default {
return { return {
loading: true, loading: true,
queryParam: { queryParam: {
classification: '' // name: '', //
trainWay: ''
}, },
queryOptions: [ queryOptions: [
{ type: 'input', placeholder: '课程名称', key: 'courseName' }, { type: 'input', placeholder: '课程名称', key: 'name' },
{ type: 'select-dic-tree', placeholder: '课程类别', key: 'courseType', options: [] } { type: 'select-dic-tree', placeholder: '课程类别', key: 'trainWay', options: [] }
], ],
// //
columns: [ columns: [
@ -96,16 +90,16 @@ export default {
}, },
{ {
title: '课程名称', title: '课程名称',
dataIndex: 'courseName', dataIndex: 'name',
scopedSlots: { customRender: 'courseName' } scopedSlots: { customRender: 'name' }
}, },
{ {
title: '课程类别', title: '课程类别',
dataIndex: 'courseTypeName' dataIndex: 'trainType'
}, },
{ {
title: '学习时间', title: '开始时间',
dataIndex: 'date' dataIndex: 'startDate'
}, },
{ {
title: '课程状态', title: '课程状态',
@ -115,19 +109,21 @@ export default {
}, },
{ {
title: '课程进度', title: '课程进度',
dataIndex: 'progress', dataIndex: 'schedule',
scopedSlots: { customRender: 'progress' }, scopedSlots: { customRender: 'schedule' },
width: '180px' width: '180px'
}, },
{ {
title: '已休学时', title: '已休学时',
dataIndex: 'yxxs', dataIndex: 'learnHours',
scopedSlots: { customRender: 'present' } scopedSlots: { customRender: 'learnHours' }
} }
], ],
// Promise // Promise
loadData: parameter => { loadData: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { const { info: userInfo } = this.$store.state.user
const params = { ...parameter, ...this.queryParam, personId: userInfo.id }
return reqMyCourseList(params).then(res => {
return res return res
}) })
}, },
@ -162,23 +158,22 @@ export default {
// //
handleRefresh () { handleRefresh () {
},
sysUserDelete (param) {
userDel(param)
.then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.msg)
}
})
.catch(err => {
this.$message.error('删除错误:' + err.msg)
})
}, },
handleOk () { handleOk () {
this.$refs.table.refresh() this.$refs.table.refresh()
},
//
handlerAddCourse (row) {
const _this = this
this.$emit('add', {
row: row,
callback: function () {
_this.$refs.table.refresh()
} })
},
//
handlerContinue (row) {
this.$emit('continue', { row: row })
} }
} }
} }

View File

@ -5,62 +5,66 @@
> >
<a-tabs :default-active-key="activeTab" @change="tabChange"> <a-tabs :default-active-key="activeTab" @change="tabChange">
<a-tab-pane key="1" tab="年度培训计划"> <a-tab-pane key="1" tab="年度培训计划">
<a-table <s-table
ref="table" ref="yearTable"
:pageSize="5" :pageSize="5"
:columns="columns" :columns="columns"
:showPagination="false" :data="loadDataYear"
:data-source="dataList"
:rowKey="record => record.id"> :rowKey="record => record.id">
<span slot="action" slot-scope="text, record, index"> <span slot="action" slot-scope="text, record">
<a v-if="index % 3 == 1" @click="$refs.userForm.edit(record)">添加课程</a> <a-popconfirm
<a v-if="index % 3 == 2" @click="$refs.userForm.edit(record)">继续学习</a> v-if="record.status === 1"
<a v-if="index % 3 == 0">已完成学习</a> :title="`确定要添加${record.name}课程吗?`"
ok-text="添加"
cancel-text="取消"
@confirm="handlerAddCourse(record)"
>
<a>添加课程</a>
</a-popconfirm>
<a v-if="record.status === 2" @click="handlerContinue(record)">继续学习</a>
<a v-if="record.status === 3">已完成学习</a>
</span> </span>
</a-table> </s-table>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="单位培训计划"> <a-tab-pane key="2" tab="单位培训计划">
<a-table <s-table
ref="table" ref="unitTable"
:pageSize="5" :pageSize="5"
:columns="columns" :columns="columns"
:showPagination="false" :data="loadDataUnit"
:data-source="dataList"
:rowKey="record => record.id"> :rowKey="record => record.id">
<span slot="action" slot-scope="text, record, index"> <span slot="action" slot-scope="text, record">
<a v-if="index % 3 == 1" @click="$refs.userForm.edit(record)">添加课程</a> <a-popconfirm
<a v-if="index % 3 == 2" @click="$refs.userForm.edit(record)">继续学习</a> v-if="record.status === 1"
<a v-if="index % 3 == 0">已完成学习</a> :title="`确定要添加${record.name}课程吗?`"
ok-text="添加"
cancel-text="取消"
@confirm="handlerAddCourse(record)"
>
<a>添加课程</a>
</a-popconfirm>
<a v-if="record.status === 2" @click="handlerContinue(record)">继续学习</a>
<a v-if="record.status === 3">已完成学习</a>
</span> </span>
</a-table> </s-table>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-card> </a-card>
</template> </template>
<script> <script>
import { userPage, userDel, passwordReset } from '@/api/security/user' import { reqMyCourseList } from '@/api/mycourse/index'
import { getCourseList, deleteCourse } from '@/api/course/course' import { STable } from '@/components'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { dictToTree } from '@/utils/util'
import { STable, SearchCom } from '@/components'
export default { export default {
components: { components: {
STable, STable
SearchCom
}, },
data () { data () {
return { return {
dataList: [], dataListYear: [],
dataListUnit: [],
activeTab: '1', activeTab: '1',
loading: true, loading: true,
queryParam: {
classification: '' //
},
queryOptions: [
{ type: 'input', placeholder: '课程名称', key: 'courseName' },
{ type: 'select-dic-tree', placeholder: '请选择课程类别', key: 'courseType', options: [] }
],
// //
columns: [ columns: [
{ {
@ -84,57 +88,46 @@ export default {
} }
], ],
// Promise // Promise
loadData: parameter => { loadDataYear: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { const { info: userInfo } = this.$store.state.user
return reqMyCourseList({ personId: userInfo.id, type: 2, pageNum: 1, pageSize: 5 }).then(res => {
return res return res
}) })
}, },
selectedRows: [], // loadDataUnit: parameter => {
options: {} const { info: userInfo } = this.$store.state.user
return reqMyCourseList({ personId: userInfo.id, type: 3, pageNum: 1, pageSize: 5 }).then(res => {
return res
})
}
} }
}, },
created () { mounted () {
this.dictionaryDropDown() setTimeout(() => {
this.loading = false
}, 800)
}, },
methods: { methods: {
tabChange (key) { tabChange (key) {
console.log('key', key) console.log('key', key)
if (key == 1) {
this.$refs.yearTable.refresh()
}
if (key == 2) {
this.$refs.unitTable.refresh()
}
}, },
// //
handlerDetail () { handlerDetail () {
this.$refs.aycourseDetail.visible = true this.$refs.aycourseDetail.visible = true
}, },
// handlerAddCourse (row) {
dictionaryDropDown () { this.$emit('add', { row: row })
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.queryOptions[1].options = dictToTree(res.data, [], 0)
this.loading = false
})
}, },
classificationChange (value) { handlerContinue (row) {
this.queryParam.classification = value this.$emit('continue', { row: row })
}, }
//
handleRefresh () {
},
sysUserDelete (param) {
userDel(param)
.then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.msg)
}
})
.catch(err => {
this.$message.error('删除错误:' + err.msg)
})
},
handleOk () {
this.$refs.table.refresh()
}
} }
} }
</script> </script>

View File

@ -2,12 +2,12 @@
<div> <div>
<a-card :bordered="false" > <a-card :bordered="false" >
<a-card title="我的课程" :bodyStyle="{padding: '0px !important'}" > <a-card title="我的课程" :bodyStyle="{padding: '0px !important'}" >
<MyCourseList></MyCourseList> <MyCourseList @add="handlerAddCourse" @continue="handlerContinue"></MyCourseList>
</a-card> </a-card>
<br /> <br />
<a-card title="培训计划" :bodyStyle="{padding: '0px !important'}"> <a-card title="培训计划" :bodyStyle="{padding: '0px !important'}">
<a slot="extra" href="#">查看更多</a> <a slot="extra" href="#">查看更多</a>
<TrainingPlan></TrainingPlan> <TrainingPlan @add="handlerAddCourse" @continue="handlerContinue"></TrainingPlan>
</a-card> </a-card>
<br /> <br />
<a-card title="集中培训" :bodyStyle="{padding: '0px !important'}"> <a-card title="集中培训" :bodyStyle="{padding: '0px !important'}">
@ -27,6 +27,7 @@ import MyCourseList from './MyCourseList.vue' // 我的课程
import TrainingPlan from './TrainingPlan.vue' // import TrainingPlan from './TrainingPlan.vue' //
import CentralizedTraining from './CentralizedTraining.vue' // import CentralizedTraining from './CentralizedTraining.vue' //
import CourseRecommendation from './CourseRecommendation.vue' // import CourseRecommendation from './CourseRecommendation.vue' //
import { reqAddMyCourse } from '@/api/mycourse/index'
export default { export default {
components: { components: {
MyCourseList, MyCourseList,
@ -41,6 +42,23 @@ export default {
}, },
methods: { methods: {
//
handlerAddCourse (row, callback) {
const { info: userInfo } = this.$store.state.user
reqAddMyCourse({ personId: userInfo.id, projectId: row.id }).then(res => {
if (res.code === 200) {
this.$message.success('添加课程成功!')
callback && callback()
}
})
},
//
handlerContinue (row) {
this.$router.push({
path: '/mycourse/courseLearn',
query: { courseId: row.id }
})
}
} }
} }
</script> </script>

View File

@ -51,7 +51,7 @@
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { getCourseList } from '@/api/course/course' import { reqExamList } from '@/api/myexam/exam'
export default { export default {
components: { STable, SearchCom }, components: { STable, SearchCom },
@ -142,12 +142,12 @@ export default {
} }
], ],
loadExamData: parameter => { loadExamData: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return reqExamList(Object.assign(parameter, this.queryParam)).then(res => {
return res return res
}) })
}, },
loadExamDoneData: parameter => { loadExamDoneData: parameter => {
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return reqExamList(Object.assign(parameter, this.queryParam)).then(res => {
return res return res
}) })
} }

View File

@ -55,6 +55,7 @@ import {
NumberInfo, NumberInfo,
MiniSmoothArea MiniSmoothArea
} from '@/components' } from '@/components'
import { getMyexamCount } from '@/api/myexamCount/index.js'
export default { export default {
components: { components: {
ChartCard, ChartCard,
@ -71,6 +72,18 @@ export default {
return { return {
loading: false loading: false
} }
},
mounted () {
this.initData()
},
methods: {
initData () {
console.log('this.$sotre', this.$store)
const { info: userInfo } = this.$store.state.user
getMyexamCount({ personId: userInfo.id }).then(res => {
console.log('data', res)
})
}
} }
} }
</script> </script>

View File

@ -1,24 +1,24 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<a-tabs :default-active-key="activeTab"> <a-tabs v-if="query.type" :default-active-key="query.type">
<a-tab-pane key="1" tab="答题报告"> <a-tab-pane key="1" tab="答题报告">
<a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}"> <a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template slot="title"> <template slot="title">
<h3>建筑施工安全培训第一期课程学习</h3> <h3>{{viewReport.courseName}}</h3>
<div class="sub-info"><span>交卷时间2021年06月11日 15:06</span><span>答题用时31分19秒</span></div> <div class="sub-info"><span>交卷时间{{viewReport.submitTime}}</span><span v-if="viewReport.totalScore">答题用时{{viewReport.totalScore}}</span></div>
<DbReport></DbReport> <DbReport :data="viewReport.reportItems"></DbReport>
</template> </template>
</a-card> </a-card>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="查看解析"> <a-tab-pane key="2" tab="查看解析">
<a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}"> <a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template slot="title"> <template slot="title">
<h4>建筑施工安全培训第一期课程学习</h4> <h4>{{viewReport.courseName}}</h4>
<div class="sub-info"><span>选择题30/30</span><span>选择题30/30</span><span>选择题30/30</span></div> <div class="sub-info"><span>选择题30/30</span><span>选择题30/30</span><span>选择题30/30</span></div>
</template> </template>
<template v-for="(item, index) in 10" > <template v-for="(item, index) in viewResolution" >
<div :key="index"> <div :key="index">
<DbQuestionInfoItem :questionIndex="index+1" ></DbQuestionInfoItem> <DbQuestionInfoItem :data="item" :questionIndex="index+1" ></DbQuestionInfoItem>
<a-divider></a-divider> <a-divider></a-divider>
</div> </div>
</template> </template>
@ -31,12 +31,33 @@
<script> <script>
import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue' import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue'
import DbReport from '@/components/DbReport/index.vue' import DbReport from '@/components/DbReport/index.vue'
import { answerViewReport, answerViewResolution } from '@/api/practice/report'
export default { export default {
components: { DbQuestionInfoItem, DbReport }, components: { DbQuestionInfoItem, DbReport },
data () { data () {
return { return {
activeTab: '1' query: {},
activeTab: '',
viewReport: {}, //
viewResolution: [] //
}
},
mounted () {
this.query = this.$route.query
this.getAnswerViewReport()
this.getAnswerViewResolution()
},
methods: {
getAnswerViewReport () {
answerViewReport({ reportId: Number(this.query.reportId) }).then(res => {
this.viewReport = res.data
})
},
getAnswerViewResolution () {
answerViewResolution({ reportId: Number(this.query.reportId) }).then(res => {
this.viewResolution = res.data
})
} }
} }
} }