|
@@ -77,8 +77,7 @@
|
|
|
<span>{{ $t('vote.voteResult') }}</span>
|
|
|
<div class="hw-box-header-tools">
|
|
|
<div>
|
|
|
- <span class="hw-box-header-tools-tool" @click="changeTableView"
|
|
|
- v-show="tableData.length">
|
|
|
+ <span class="hw-box-header-tools-tool" @click="changeTableView">
|
|
|
<Icon type="md-podium" />
|
|
|
{{ isOptionView ? $t('vote.stuListView') : $t('vote.optionView') }}
|
|
|
</span>
|
|
@@ -100,7 +99,7 @@
|
|
|
</BaseVoteSsTable>
|
|
|
<div style="display:flex">
|
|
|
<BaseVotePie pieId="votePie" :pieData="studentsTable"
|
|
|
- v-show="studentsTable.length"></BaseVotePie>
|
|
|
+ v-show="tableData.length"></BaseVotePie>
|
|
|
<BaseVoteBar pieId="votePie2" v-if="tableData.length" :pieData="tableData">
|
|
|
</BaseVoteBar>
|
|
|
</div>
|
|
@@ -297,27 +296,28 @@
|
|
|
/* 获取正在进行中的投票活动的投票数据 */
|
|
|
async getVoteRecord(voteItem) {
|
|
|
return new Promise(async (r, j) => {
|
|
|
- // 如果是进行中的活动 则从cosmos获取实时作答数据
|
|
|
- if (voteItem.progress === 'going') {
|
|
|
- this.$api.learnActivity.FindVoteRecord({
|
|
|
- id: voteItem.id,
|
|
|
- code: voteItem.code,
|
|
|
- }).then(res => {
|
|
|
- if (!res.error) {
|
|
|
- r(res)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- j(err)
|
|
|
- })
|
|
|
- } else { // 如果是已结束的活动 则从blob读取作答数据
|
|
|
- try {
|
|
|
- let curItemRecord = await this.getBlobJsonFile(voteItem.scope, voteItem
|
|
|
- .recordUrl)
|
|
|
- r(curItemRecord)
|
|
|
- } catch (e) {
|
|
|
- j(e)
|
|
|
- }
|
|
|
+ try {
|
|
|
+ let curItemRecord = await this.getBlobJsonFile(voteItem.scope, voteItem
|
|
|
+ .recordUrl)
|
|
|
+ r(curItemRecord)
|
|
|
+ } catch (e) {
|
|
|
+ j(e)
|
|
|
}
|
|
|
+ // 如果是进行中的活动 则从cosmos获取实时作答数据
|
|
|
+ // if (voteItem.progress === 'going') {
|
|
|
+ // this.$api.learnActivity.FindVoteRecord({
|
|
|
+ // id: voteItem.id,
|
|
|
+ // code: voteItem.code,
|
|
|
+ // }).then(res => {
|
|
|
+ // if (!res.error) {
|
|
|
+ // r(res)
|
|
|
+ // }
|
|
|
+ // }).catch(err => {
|
|
|
+ // j(err)
|
|
|
+ // })
|
|
|
+ // } else { // 如果是已结束的活动 则从blob读取作答数据
|
|
|
+
|
|
|
+ // }
|
|
|
|
|
|
})
|
|
|
},
|
|
@@ -409,29 +409,35 @@
|
|
|
let records = await this.getVoteRecord(voteItem)
|
|
|
// 先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
|
|
|
console.log('当前投票的作答数据======', records)
|
|
|
- this.$api.schoolSetting.getClassroomStudent({
|
|
|
+ this.$api.schoolSetting.getStusByClassId({
|
|
|
school_code: this.$store.state.userInfo.schoolCode,
|
|
|
ids: voteItem.classes.length ? voteItem.classes : voteItem.stuLists,
|
|
|
- scope: voteItem.scope
|
|
|
}).then(res => {
|
|
|
- if (!res.error && res.stus.length) {
|
|
|
- let list = []
|
|
|
- res.stus.forEach(classStus => {
|
|
|
- classStus.forEach(i => {
|
|
|
+ if (!res.error) {
|
|
|
+ let list = [] //学生清单
|
|
|
+ let arr = [] //选项清单
|
|
|
+ res.list.forEach(classStus => {
|
|
|
+ classStus.class.stuInfos.forEach(i => {
|
|
|
list.push({
|
|
|
id: i.id,
|
|
|
name: i.name,
|
|
|
- no: i.no,
|
|
|
- classroomName: i.className
|
|
|
+ no: i.no || 0,
|
|
|
+ classroomName: classStus.class.name
|
|
|
+ })
|
|
|
+ })
|
|
|
+ classStus.class.tmdInfos.forEach(i => {
|
|
|
+ list.push({
|
|
|
+ id: i.id,
|
|
|
+ name: i.name,
|
|
|
+ no: i.no || 0,
|
|
|
+ classroomName: classStus.class.name
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
- console.log(list)
|
|
|
this.studentsTable = list
|
|
|
+
|
|
|
// 要根据作答情况 结合两张表 处理表格显示的数据
|
|
|
if (records.options.length) {
|
|
|
- let arr = []
|
|
|
- this.studentsTable = list
|
|
|
records.options.forEach((item, index) => {
|
|
|
arr.push({
|
|
|
option: item.code ? this.$t('vote.option') + (index +
|
|
@@ -445,11 +451,19 @@
|
|
|
i.option = matchList.length ? Object.keys(matchList[0].opt).join(
|
|
|
',') : null
|
|
|
})
|
|
|
+ this.tableData = arr
|
|
|
console.log(arr)
|
|
|
console.log(this.studentsTable)
|
|
|
- this.tableData = arr
|
|
|
} else {
|
|
|
- this.studentsTable = []
|
|
|
+ // 如果是还没有投票作答数据 则默认显示0
|
|
|
+ // this.currentVote.forEach((item, index) => {
|
|
|
+ // arr.push({
|
|
|
+ // option: item.code ? this.$t('vote.option') + (index +
|
|
|
+ // 1) : this.$t('vote.noVote'),
|
|
|
+ // key: item.code || '',
|
|
|
+ // result: 0
|
|
|
+ // })
|
|
|
+ // })
|
|
|
this.tableData = []
|
|
|
}
|
|
|
} else {
|