Forráskód Böngészése

Merge branch 'develop3.0' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0

zhouj1203@hotmail.com 4 éve
szülő
commit
9e6173ffc0

+ 7 - 0
TEAMModelOS/ClientApp/src/api/learnActivity.js

@@ -122,6 +122,13 @@ export default {
     FindRecordByHwId: function (data) {
         return post('/api/HomeWork/findRecord', data)
     },
+	
+	/*
+	* 保存作业学生作答数据
+	*/
+	SaveRecords:function (data) {
+        return post('/api/HomeWork/upsertRecord', data)
+    },
 
     /*
      * 查询老师的评语罐头

+ 3 - 0
TEAMModelOS/ClientApp/src/boot-app.js

@@ -29,6 +29,9 @@ import access from './access/index';
 import _ from 'lodash'
 import Icon from './icons/index.js'
 
+import mockAnswer from '@/utils/mockAnswer.js'
+// mockAnswer.initMockAnswers()
+
 require('@/utils/azure-storage-blob.js')
 require('video.js/dist/video-js.css')
 require('vue-video-player/src/custom-theme.css')

+ 0 - 8
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwForm.vue

@@ -1,28 +1,20 @@
 <template>
     <div class="component-hw-form">
         <Form ref="hwForm" :model="hwForm" label-position="top" :rules="ruleValidate" :disabled="!hwFormEdit">
-
-
-
             <FormItem label="作业名称" prop="name">
                 <Input :class="!hwFormEdit ? 'hw-form-disabled':''" v-model="hwForm.name" placeholder="请输入作业名称"></Input>
             </FormItem>
-
             <FormItem label="" prop="other">
                 <CheckboxGroup v-model="hwForm.other">
                     <Checkbox label="view">开放观摩</Checkbox>
                     <Checkbox label="comment">开放互评</Checkbox>
                 </CheckboxGroup>
             </FormItem>
-
-
-
             <FormItem label="作业对象" prop="target">
                 <Select multiple v-model="hwForm.target" :class="!hwFormEdit ? 'hw-form-disabled':''" placeholder="请选择作业发布对象">
                     <Option v-for="item in classRooms" :value="item.classroomCode" :key="item.classroomCode">{{ item.classroomName }}</Option>
                 </Select>
             </FormItem>
-
             <FormItem label="发布时间" prop="publishModel">
                 <RadioGroup v-model="hwForm.publishModel" v-show="hwFormEdit">
                     <Radio label="0" :disabled="currentState !== 100 && !isAdd">立即发布</Radio>

+ 76 - 0
TEAMModelOS/ClientApp/src/utils/mockAnswer.js

@@ -0,0 +1,76 @@
+/* 
+ * 模拟部分活动模块的学生作答数据(作业活动/投票活动/问卷活动等)
+ * 获取学生名单 - 自定义作答数据结构 - 保存活动数据
+ * 2020-07-20 OnePsycho
+ * */
+import apiTools from '@/api'
+var Mock = require('mockjs')
+
+const CLASS_CODE = ["HBCN0101", "HBCN0102"]
+const SCHOOL_CODE = 'HBCN'
+const activityId = '40e3da01-b9c8-4524-a588-fec246eaeb5f'
+const activityType = 'homework'
+let studentList = []
+let resultList = []
+
+async function initMockAnswers(){
+	studentList = await getStudentList()
+	let mockData = doMock(studentList)
+	let resultData = await saveMockData(mockData)
+	console.log(resultData)
+}
+
+
+/* 获取学生清单 */
+function getStudentList(){
+	return new Promise((r,j) => {
+		apiTools.courseMgmt.getClassroomStudent({
+			classroomCode: CLASS_CODE,
+			schoolCode: SCHOOL_CODE
+		}).then(res => {
+			if (!res.error && res.result.data) {
+				r(res.result.data)
+			} else {
+				j(500)
+			}
+		})
+	})
+}
+
+/* 根据活动类型模拟作答数据 */
+function doMock(arr){
+	let result = []
+	arr.forEach(i => {
+		result.push({
+			id:activityId,
+			code:i.code,
+			content:[{
+				answers:Mock.mock('@cparagraph(2)'),
+				resource:[]
+			}],
+			submit:true,
+			submitTime: Math.round(new Date() / 1000)
+		})
+	})
+	return result
+}
+
+/* 获取学生清单 */
+function saveMockData(list){
+	return new Promise((r,j) => {
+		apiTools.learnActivity.SaveRecords(list).then(res => {
+			if (!res.error && res.result.data) {
+				r(res.result.data)
+			} else {
+				j(500)
+			}
+		})
+	})
+}
+
+
+export default {
+	initMockAnswers
+}
+
+

+ 97 - 90
TEAMModelOS/ClientApp/src/view/evaluation/bank/index.vue

@@ -1,105 +1,112 @@
 <template>
-    <div class="bank-container">
-        <Tabs :value="tabName" name="listTab" @on-click="onTabClick">
-            <TabPane label="试题库" name="exercise" tab="listTab">
-                <ExerciseList ref="exList" @toggleChange="onToggleChange"></ExerciseList>
-            </TabPane>
-            <TabPane label="试卷库" name="paper" tab="listTab">
-                <PaperList></PaperList>
-            </TabPane>
-        </Tabs>
-        <div class="ev-list-operation">
-            <div class="import-exercise">
-                <Button type="success" @click="goCreatePaper" v-show="currentTab === 'paper' && $access.can('admin.*|Paper_Add')">新建试卷</Button>
-                <Button type="info" @click="goCreateExercise" v-show="currentTab === 'exercise' && $access.can('admin.*|Exercise_Add')">新建习题</Button>
-                <Button type="info" @click="onHandleToggle" v-show="currentTab === 'exercise'">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
-                <!--<BaseImport></BaseImport>-->
-            </div>
-        </div>
-    </div>
+	<div class="bank-container">
+		<Tabs :value="tabName" name="listTab" @on-click="onTabClick">
+			<TabPane label="试题库" name="exercise" tab="listTab">
+				<ExerciseList ref="exList" @toggleChange="onToggleChange"></ExerciseList>
+			</TabPane>
+			<TabPane label="试卷库" name="paper" tab="listTab">
+				<PaperList></PaperList>
+			</TabPane>
+		</Tabs>
+		<div class="ev-list-operation">
+			<div class="import-exercise">
+				<Button type="success" @click="goCreatePaper" v-show="currentTab === 'paper' && $access.can('admin.*|Paper_Add')">新建试卷</Button>
+				<Button type="info" @click="goCreateExercise" v-show="currentTab === 'exercise' && $access.can('admin.*|Exercise_Add')">新建习题</Button>
+				<Button type="info" @click="onHandleToggle" v-show="currentTab === 'exercise'">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
+				<!--<BaseImport></BaseImport>-->
+			</div>
+		</div>
+	</div>
 </template>
 <script>
-    import BaseImport from '../components/BaseImport'
-    import PaperList from './TestPaperList'
-    import ExerciseList from './ExerciseList'
-    export default {
-        components: { PaperList, ExerciseList, BaseImport },
-        data() {
-            return {
-                tabName: 'exercise',
-                currentTab: 'exercise',
-                isAllOpen:false
-            }
-        },
-        created() {
+	import BaseImport from '../components/BaseImport'
+	import PaperList from './TestPaperList'
+	import ExerciseList from './ExerciseList'
+	export default {
+		components: {
+			PaperList,
+			ExerciseList,
+			BaseImport
+		},
+		data() {
+			return {
+				tabName: 'exercise',
+				currentTab: 'exercise',
+				isAllOpen: false
+			}
+		},
+		created() {
 
-        },
-        methods: {
+		},
+		methods: {
 
-            onTabClick(val) {
-                this.currentTab = val
-            },
+			onTabClick(val) {
+				this.currentTab = val
+			},
 
-            /** 切换全部展开与折叠 */
-            onHandleToggle() {
-                this.$refs.exList.onHandleToggle(this.isAllOpen)
-                this.isAllOpen = !this.isAllOpen
-            },
+			/** 切换全部展开与折叠 */
+			onHandleToggle() {
+				this.$refs.exList.onHandleToggle(this.isAllOpen)
+				this.isAllOpen = !this.isAllOpen
+			},
 
-            /**
-             * exList的collapseList变化
-             * @param list
-             */
-            onToggleChange(list) {
-                this.isAllOpen = list.length !== 0
-            },
+			/**
+			 * exList的collapseList变化
+			 * @param list
+			 */
+			onToggleChange(list) {
+				this.isAllOpen = list.length !== 0
+			},
 
-            /** 返回创建试题页面 */
-            goCreateExercise() {
-                this.$router.push({
-                    name: 'createExercises'
-                })
-            },
+			/** 返回创建试题页面 */
+			goCreateExercise() {
+				this.$router.push({
+					name: 'createExercises'
+				})
+			},
 
-            /** 前往组卷页面 */
-            goCreatePaper() {
-                this.$router.push({
-                    name: 'createPaper'
-                })
-            },
-        },
-        mounted() {
-            let parentVm = this.$parent.$parent.$parent
-            parentVm.$refs['evScroll'].scrollTo(
-                    {
-                        y: 0
-                    },
-                    500, 'easeInQuad'
-                )
-            if (this.$route.params.tabName) this.tabName = this.$route.params.tabName
-        }
-    }
+			/** 前往组卷页面 */
+			goCreatePaper() {
+				this.$router.push({
+					name: 'createPaper'
+				})
+			},
+		},
+		mounted() {
+			let parentVm = this.$parent.$parent.$parent
+			parentVm.$refs['evScroll'].scrollTo({
+					y: 0
+				},
+				500, 'easeInQuad'
+			)
+
+			if (this.$route.params.tabName) {
+				this.currentTab = this.$route.params.tabName
+				this.tabName = this.$route.params.tabName
+			}
+		}
+	}
 </script>
 <style src="./index.less" lang="less" scoped></style>
 <style>
-    .bank-container .ivu-tabs-bar {
-        border-bottom: 1px solid Silver;
-        margin: 10px 20px;
-        font-family: '微軟正黑體', 'Heiti TC' !important;
-    }
+	.bank-container .ivu-tabs-bar {
+		border-bottom: 1px solid Silver;
+		margin: 10px 20px;
+		font-family: '微軟正黑體', 'Heiti TC' !important;
+	}
 
-    .bank-container .ivu-tabs-nav .ivu-tabs-tab:active,
-    .bank-container .ivu-tabs-nav .ivu-tabs-tab:hover,
-    .bank-container .ivu-tabs-nav .ivu-tabs-tab-active,
-    .bank-container .ivu-tabs-nav .ivu-tabs-tab {
-        color: #515050;
-        font-weight: bold;
-        font-size: 16px;
-    }
+	.bank-container .ivu-tabs-nav .ivu-tabs-tab:active,
+	.bank-container .ivu-tabs-nav .ivu-tabs-tab:hover,
+	.bank-container .ivu-tabs-nav .ivu-tabs-tab-active,
+	.bank-container .ivu-tabs-nav .ivu-tabs-tab {
+		color: #515050;
+		font-weight: bold;
+		font-size: 16px;
+	}
 
-    .bank-container .ivu-tabs-ink-bar {
-        height: 4px;
-        background: #5d6260;
-        /*margin-left:20px;*/
-    }
+	.bank-container .ivu-tabs-ink-bar {
+		height: 4px;
+		background: #5d6260;
+		/*margin-left:20px;*/
+	}
 </style>

+ 4 - 5
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseExerciseList.vue

@@ -225,12 +225,11 @@
              * @param ids
              */
             getPointsByIds(ids) {
-                if (typeof (ids[0]) !== 'string'){
-                    ids = ids.map(item => item.id)
-                }
+				// 去除空值后
+				let idsArr = this._.compact(ids)
                 return new Promise((r, j) => {
-                    if (ids.length) {
-                        this.$api.knowledge.FindKnowledgebyId(ids).then(res => {
+                    if (idsArr.length) {
+                        this.$api.knowledge.FindKnowledgebyId(idsArr).then(res => {
                             if (!res.error && res.result.data.length) {
                                 r(res.result.data)
                             } else {

+ 35 - 1
TEAMModelOS/ClientApp/src/view/evaluation/index/CreatePaper.vue

@@ -1,4 +1,4 @@
-<template>
+<template>
     <div class="create-evaluation-container">
         <div class="create-header">
             <p class="create-header-title">创建试卷</p>
@@ -147,6 +147,11 @@
                     paperSubject: 0,
                     score: 100,
                     item: [],
+					markConfig: {
+						auto: false,
+						type: 0,
+						score: 0
+					},
                     startTime: 0,
                     endTime: 0,
                     testPaper: [
@@ -257,6 +262,8 @@
                         periodCode: this.schoolInfo.period[this.evaluationInfo.paperPeriod].periodCode,
                         name: this.evaluationInfo.name,
                         item: this.evaluationInfo.item,
+						markConfig:this.evaluationInfo.markConfig,
+						answers:this.getAnswers(this.evaluationInfo.item),
                         score: this.evaluationInfo.score
                     }
                     this.$api.learnActivity.SaveExamPaper(requestData).then(
@@ -282,6 +289,33 @@
                     this.$Message.warning('未选择任何试题!')
                 }
             },
+			
+			/* 获取整张试卷的答案合计Answers */
+			getAnswers(items){
+				let arr = []
+				items.forEach((i,index) => {
+					if(i.type === 'Complete'){
+						i.answer.forEach(j => {
+							arr.push({
+								num:arr.length,
+								group:index,
+								type:i.type,
+								ans:[j],
+								score:i.score / i.answer.length
+							})
+						})
+					}else{
+						arr.push({
+							num:arr.length,
+							group:index,
+							type:i.type,
+							ans:i.answer,
+							score:i.score
+						})
+					}
+				})
+				return arr
+			},
             
         },
         

+ 20 - 0
TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.less

@@ -262,6 +262,26 @@
         }
     }
 }
+
+.rules-modal{
+	
+	.ivu-modal-body{
+		
+		.rule-item{
+			display: flex;
+			flex-direction: column;
+			
+			&-title{
+				margin: 10px 0;
+				font-weight: bold;
+			}
+		}
+		
+	}
+	
+}
+
+
 /*横向垂直水平居中*/
 .flex-row-center {
     display: flex;

+ 384 - 295
TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.vue

@@ -1,327 +1,416 @@
 <template>
-    <div class="paper-container">
-        <div class="paper-main-wrap">
-            <!-- 试卷内容 -->
-            <div class="paper-content">
-                <div class="paper-line" style="margin-top:7%">
-                    <div id="pui_seal" title="点击设置&quot;装订线&quot;" style="display: block;">
-                        <img alt="装订线" title="装订线" src="http://zujuan.xkw.com/resource/image/v2/peal_line.png">
-                    </div>
-                </div>
-                <div class="paper-body">
-                    <!-- 试卷基础信息 -->
-                    <div class="paper-base-info" v-show="isShowBaseInfo">
-                        <div>
-                            <span class="base-info-item">分数:<span class="analysis-info" @click="isSetScore = !isSetScore">{{ paperInfo.score }}</span>分</span>
-                            <span class="base-info-item">题量:<span class="analysis-info">{{ paperInfo.item ? paperInfo.item.length : 0 }}</span></span>
-                            <span class="base-info-item">难度:<span class="analysis-info">{{ paperInfo.item.length ? paperDiff : 0 }}</span></span>
-                        </div>
-                        <div>
-                            <Button class="base-info-btn" type="success" v-show="isShowSave" @click="onBackToBank">返回</Button>
-                            <Button class="base-info-btn" type="success" v-show="isShowSave" @click="savePaper">保存试卷</Button>
-                            <Button class="base-info-btn" type="info" @click="onHandleToggle" v-show="paperInfo.item.length">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
-                            <Button class="base-info-btn" type="info" @click="onSetScoreByType" v-show="paperInfo.item.length">题型配分</Button>
-                        </div>
-                    </div>
+	<div class="paper-container">
+		<div class="paper-main-wrap">
+			<!-- 试卷内容 -->
+			<div class="paper-content">
+				<div class="paper-line" style="margin-top:7%">
+					<div id="pui_seal" title="点击设置&quot;装订线&quot;" style="display: block;">
+						<img alt="装订线" title="装订线" src="http://zujuan.xkw.com/resource/image/v2/peal_line.png">
+					</div>
+				</div>
+				<div class="paper-body">
+					<!-- 试卷基础信息 -->
+					<div class="paper-base-info" v-show="isShowBaseInfo">
+						<div>
+							<span class="base-info-item">分数:<span class="analysis-info" @click="isSetScore = !isSetScore">{{ paperInfo.score }}</span>分</span>
+							<span class="base-info-item">题量:<span class="analysis-info">{{ paperInfo.item ? paperInfo.item.length : 0 }}</span></span>
+							<span class="base-info-item">难度:<span class="analysis-info">{{ paperInfo.item.length ? paperDiff : 0 }}</span></span>
+						</div>
+						<div>
+							<Button class="base-info-btn" type="success" v-show="isShowSave" @click="onBackToBank">返回</Button>
+							<Button class="base-info-btn" type="success" v-show="isShowSave" @click="savePaper">保存试卷</Button>
+							<Button class="base-info-btn" type="info" @click="onHandleToggle" v-show="paperInfo.item.length">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
+							<Button class="base-info-btn" type="info" @click="onSetScoreByType" v-show="paperInfo.item.length">题型配分</Button>
+							<Button class="base-info-btn" type="info" @click="isSetRules = true" v-show="paperInfo.item.length">阅卷规则</Button>
+						</div>
+					</div>
 
-                    <!-- 试卷头部信息 -->
-                    <div class="paper-header flex-col-center">
-                        <Tooltip content="点击可编辑修改主标题" placement="right">
-                            <p class="paper-title" v-show="isShowTitle" contenteditable="true" @blur="titleChange($event)">{{paperInfo.name}}</p>
-                        </Tooltip>
-                    </div>
-                    <!-- 题目类型及列表 -->
-                    <BaseExerciseList :paper="paperInfo" @dataUpdate="onListUpdate" ref="exList" :isShowTools="isShowTools" @toggleChange="onToggleChange"></BaseExerciseList>
-                </div>
-            </div>
+					<!-- 试卷头部信息 -->
+					<div class="paper-header flex-col-center">
+						<Tooltip content="点击可编辑修改主标题" placement="right">
+							<p class="paper-title" v-show="isShowTitle" contenteditable="true" @blur="titleChange($event)">{{paperInfo.name}}</p>
+						</Tooltip>
+					</div>
+					<!-- 题目类型及列表 -->
+					<BaseExerciseList :paper="paperInfo" @dataUpdate="onListUpdate" ref="exList" :isShowTools="isShowTools"
+					 @toggleChange="onToggleChange"></BaseExerciseList>
+				</div>
+			</div>
 
-            <!-- 试题解析部分 -->
-            <div class="paper-analysis" style="display:none">
-                <div class="analysis-btns">
-                    <Button type="success" @click="savePaper">保存试卷</Button>
-                    <Button type="info" @click="goToPickExercise">重新选题</Button>
-                    <Button type="info" @click="onSetScoreByType">题型配分</Button>
-                </div>
-                <div class="analysis-infos">
-                    <RadioGroup v-model="viewModel" @on-change="onViewModelChange">
-                        <Radio label="type">题型视图</Radio>
-                        <Radio label="list">清单视图</Radio>
-                    </RadioGroup>
-                    <p class="analysis-title">基础信息</p>
-                    <div class="flex-row-center">
-                        <span>分数:<span class="analysis-info">{{ paperInfo.score }}</span>分</span>
-                        <span>题量:<span class="analysis-info">{{ exersicesList ? exersicesList.length : 0 }}</span></span>
-                        <span>难度:<span class="analysis-info">0.9</span></span>
-                    </div>
-                    <p class="analysis-title">题目列表</p>
-                    <div class="analysis-index-wrap">
-                        <span class="exercise-index-item" v-for="(item,index) in exersicesList">{{ index + 1 }}</span>
-                    </div>
-                    <p class="analysis-title">试卷分析</p>
-                    <div style="padding-top:10px;">
-                        <Table border :columns="analysisColumns" :data="analysisTableData"></Table>
-                        <BaseTypePie :echartsData="analysisTableData"></BaseTypePie>
-                    </div>
-                </div>
-            </div>
-        </div>
+			<!-- 试题解析部分 -->
+			<div class="paper-analysis" style="display:none">
+				<div class="analysis-btns">
+					<Button type="success" @click="savePaper">保存试卷</Button>
+					<Button type="info" @click="goToPickExercise">重新选题</Button>
+					<Button type="info" @click="onSetScoreByType">题型配分</Button>
+				</div>
+				<div class="analysis-infos">
+					<RadioGroup v-model="viewModel" @on-change="onViewModelChange">
+						<Radio label="type">题型视图</Radio>
+						<Radio label="list">清单视图</Radio>
+					</RadioGroup>
+					<p class="analysis-title">基础信息</p>
+					<div class="flex-row-center">
+						<span>分数:<span class="analysis-info">{{ paperInfo.score }}</span>分</span>
+						<span>题量:<span class="analysis-info">{{ exersicesList ? exersicesList.length : 0 }}</span></span>
+						<span>难度:<span class="analysis-info">0.9</span></span>
+					</div>
+					<p class="analysis-title">题目列表</p>
+					<div class="analysis-index-wrap">
+						<span class="exercise-index-item" v-for="(item,index) in exersicesList">{{ index + 1 }}</span>
+					</div>
+					<p class="analysis-title">试卷分析</p>
+					<div style="padding-top:10px;">
+						<Table border :columns="analysisColumns" :data="analysisTableData"></Table>
+						<BaseTypePie :echartsData="analysisTableData"></BaseTypePie>
+					</div>
+				</div>
+			</div>
+		</div>
 
-        <Modal v-model="isSetScore"
-               title="设置试卷总分"
-               width="400px"
-               class="related-point-modal"
-               style="z-index:99999">
-            <span>总分</span>
-            <InputNumber :max="200" :min="1" v-model="paperInfo.score" style="margin-left:20px"></InputNumber>
-            <div slot="footer">
-                <Button type="text" @click="isSetScore = false">取消</Button>
-                <Button type="primary" @click="onSetScore">确定</Button>
-            </div>
-        </Modal>
-    </div>
+		<!-- 设置试卷配分 -->
+		<Modal v-model="isSetScore" title="设置试卷总分" width="400px" class="related-point-modal" style="z-index:99999">
+			<span>总分</span>
+			<InputNumber :max="200" :min="1" v-model="paperInfo.score" style="margin-left:20px"></InputNumber>
+			<div slot="footer">
+				<Button type="text" @click="isSetScore = false">取消</Button>
+				<Button type="primary" @click="onSetScore">确定</Button>
+			</div>
+		</Modal>
+
+		<!-- 设置阅卷规则 -->
+		<Modal v-model="isSetRules" title="设置阅卷规则" width="400px" class="related-point-modal rules-modal" style="z-index:99999">
+			<div class="rule-item">
+				<span class="rule-item-title">是否自动阅卷</span>
+				<i-switch v-model="paperInfo.markConfig.auto" />
+			</div>
+			<div class="rule-item" v-show="paperInfo.markConfig.auto">
+				<span class="rule-item-title">选择阅卷规则</span>
+				<RadioGroup v-model="paperInfo.markConfig.type" vertical>
+					<Radio :label="1">
+						<Icon type="social-android"></Icon>
+						<span>多选漏选不得分</span>
+					</Radio>
+					<Radio :label="2">
+						<Icon type="social-windows"></Icon>
+						<span>多选漏选的得一半分数</span>
+					</Radio>
+					<Radio :label="3">
+						<Icon type="social-windows"></Icon>
+						<span>多选漏选按个数得分</span>
+					</Radio>
+					<Radio :label="4">
+						<Icon type="social-windows"></Icon>
+						<span>多选漏选自定义分数</span>
+					</Radio>
+				</RadioGroup>
+			</div>
+			<div class="rule-item" v-show="paperInfo.markConfig.auto && paperInfo.markConfig.type === 4">
+				<span class="rule-item-title">设置多选选项分数</span>
+				<InputNumber :max="200" :min="1" v-model="paperInfo.markConfig.score"></InputNumber>
+			</div>
+
+			<div slot="footer">
+				<Button type="text" @click="isSetRules = false">取消</Button>
+				<Button type="primary" @click="onSetMarkingRules">确定</Button>
+			</div>
+		</Modal>
+	</div>
 </template>
 <script>
-    import BaseExerciseList from '../components/BaseExerciseList'
-    import BaseTypePie from '../components/BaseTypePie'
-    import questions from './list.json'
-    export default {
-        components: { BaseExerciseList, BaseTypePie },
-        props: {
-            paper: {
-                type: Object,
-                default:null
-            },
-            isShowTools: {
-                type: Boolean,
-                default:true
-            },
-            isShowBaseInfo: {
-                type: Boolean,
-                default:true
-            }
-        },
-        data() {
-            return {
-                isAllOpen: false,
-                isSetScore:false,
-                isShowSave:false,
-                exersicesList: [],
-                list: [],
-                schoolInfo: {},
-                paperInfo: {
-                    name: "",
-                    score: 100,
-                    item: []
-                },
-                exersicesType: {
-                    Single: '单选题',
-                    Multiple: '多选题',
-                    Judge: '判断题',
-                    Complete: '填空题',
-                    Subjective: '问答题',
-                    Compose:'综合题'
-                },
-                exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
-                diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
-                filterType: '0',
-                filterDiff: '0',
-                filterSort: '0',
-                pageSize: 5,
-                pageNum: 1,
-                totalNum: 100,
-                allList: questions.result.data,
-                isShowAnswer: false,
-                isShowPart: false,
-                isShowConcept: false,
-                isShowTitle: true,
-                isShowInfo: false,
-                analysisColumns: [
-                    {
-                        title: '题型',
-                        key: 'name'
-                    },
-                    {
-                        title: '数量(占比)',
-                        key: 'value'
-                    }
-                ],
-                analysisTableData: [],
-                viewModel: 'type',
-                paperDiff:0
+	import BaseExerciseList from '../components/BaseExerciseList'
+	import BaseTypePie from '../components/BaseTypePie'
+	import questions from './list.json'
+	export default {
+		components: {
+			BaseExerciseList,
+			BaseTypePie
+		},
+		props: {
+			paper: {
+				type: Object,
+				default: null
+			},
+			isShowTools: {
+				type: Boolean,
+				default: true
+			},
+			isShowBaseInfo: {
+				type: Boolean,
+				default: true
+			}
+		},
+		data() {
+			return {
+				isAllOpen: false,
+				isSetScore: false,
+				isSetRules: false,
+				isShowSave: false,
+				exersicesList: [],
+				list: [],
+				schoolInfo: {},
+				paperInfo: {
+					name: "",
+					score: 100,
+					answers:[],
+					markConfig: {
+						auto: false,
+						type: 0,
+						score: 0
+					},
+					item: []
+				},
+				exersicesType: {
+					Single: '单选题',
+					Multiple: '多选题',
+					Judge: '判断题',
+					Complete: '填空题',
+					Subjective: '问答题',
+					Compose: '综合题'
+				},
+				exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
+				diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
+				filterType: '0',
+				filterDiff: '0',
+				filterSort: '0',
+				pageSize: 5,
+				pageNum: 1,
+				totalNum: 100,
+				allList: questions.result.data,
+				isShowAnswer: false,
+				isShowPart: false,
+				isShowConcept: false,
+				isShowTitle: true,
+				isShowInfo: false,
+				analysisColumns: [{
+						title: '题型',
+						key: 'name'
+					},
+					{
+						title: '数量(占比)',
+						key: 'value'
+					}
+				],
+				analysisTableData: [],
+				viewModel: 'type',
+				paperDiff: 0
+
+			}
+		},
+		created() {
 
-            }
-        },
-        created() {
+		},
+		methods: {
 
-        },
-        methods: {
+			/**
+			 * 标题切换
+			 * @param e
+			 */
+			titleChange(e) {
+				this.paperInfo.name = e.target.innerHTML
+			},
 
-            /**
-             * 标题切换
-             * @param e
-             */
-            titleChange(e) {
-                this.paperInfo.name = e.target.innerHTML
-            },
+			onSetMarkingRules() {
+				this.isSetRules = false
+			},
 
-            /** 切换全部展开与折叠 */
-            onHandleToggle() {
-                this.$refs.exList.onHandleToggle(this.isAllOpen)
-                this.isAllOpen = !this.isAllOpen
-            },
+			/** 切换全部展开与折叠 */
+			onHandleToggle() {
+				this.$refs.exList.onHandleToggle(this.isAllOpen)
+				this.isAllOpen = !this.isAllOpen
+			},
 
-            /**
-             * exList的collapseList变化
-             * @param list
-             */
-            onToggleChange(list) {
-                this.isAllOpen = list.length !== 0
-            },
+			/**
+			 * exList的collapseList变化
+			 * @param list
+			 */
+			onToggleChange(list) {
+				this.isAllOpen = list.length !== 0
+			},
 
-            /** 返回试卷库 */
-            onBackToBank() {
-                this.$router.push({
-                    name: 'testPaperList',
-                    params: {
-                        tabName: 'paper'
-                    }
-                })
-            },
+			/** 返回试卷库 */
+			onBackToBank() {
+				this.$router.push({
+					name: 'testPaperList',
+					params: {
+						tabName: 'paper'
+					}
+				})
+			},
 
-            onSetScore() {
-                this.isSetScore = false
-                this.$refs.exList.exerciseList.map(item => item.score = 0)
-            },
+			onSetScore() {
+				this.isSetScore = false
+				this.$refs.exList.exerciseList.map(item => item.score = 0)
+			},
 
 
-            /** 保存试卷 */
-            savePaper() {
-                let hasSurplus = this.$refs.exList.surPlusScore === 0 // 判断是否有剩余分数未分配
-                let noScoreList = this.$refs.exList.exerciseList.filter(item => item.score === 0) // 判断是否有未配分的题目
-                if (hasSurplus) {
-                    if (!noScoreList.length) {
-                        this.paperInfo.item.forEach(i => {
-                            if (i.points.length && typeof (i.points[1]) !== 'string' && i.points[0]) {
-                                i.points = i.points.map(j => j.id)
-                            }
-                        })
-                        let saveParams = this.paperInfo
-                        this.$refs.exList.dataLoading = true
-                        this.$api.learnActivity.SaveExamPaper(saveParams).then(res => {
-                            if (res.error == null) {
-                                this.$refs.exList.dataLoading = false
-                                this.onBackToBank()
-                                this.$Message.success('保存成功!')
-                            } else {
-                                this.$Message.error('API ERROR!')
-                            }
-                        },
-                            err => {
-                                this.$Message.error('API ERROR!')
-                            }
-                        )
-                    } else {
-                        this.$Message.warning(`存在未配分的题目,请配分后再保存!`)
-                    }
-                } else {
-                    this.$Message.warning(`试卷配分未完成!剩余 ${this.$refs.exList.surPlusScore} 分数可分配`)
-                }
+			/** 保存试卷 */
+			savePaper() {
+				let hasSurplus = this.$refs.exList.surPlusScore === 0 // 判断是否有剩余分数未分配
+				let noScoreList = this.$refs.exList.exerciseList.filter(item => item.score === 0) // 判断是否有未配分的题目
+				if (hasSurplus) {
+					if (!noScoreList.length) {
+						this.paperInfo.item.forEach(i => {
+							if (i.points.length && typeof(i.points[1]) !== 'string' && i.points[0]) {
+								i.points = i.points.map(j => j.id)
+							}
+						})
+						this.paperInfo.answers = this.getAnswers(this.paperInfo.item)
+						let saveParams = this.paperInfo
+						this.$refs.exList.dataLoading = true
+						this.$api.learnActivity.SaveExamPaper(saveParams).then(res => {
+								if (res.error == null) {
+									this.$refs.exList.dataLoading = false
+									this.onBackToBank()
+									this.$Message.success('保存成功!')
+								} else {
+									this.$Message.error('API ERROR!')
+								}
+							},
+							err => {
+								this.$Message.error('API ERROR!')
+							}
+						)
+					} else {
+						this.$Message.warning(`存在未配分的题目,请配分后再保存!`)
+					}
+				} else {
+					this.$Message.warning(`试卷配分未完成!剩余 ${this.$refs.exList.surPlusScore} 分数可分配`)
+				}
 
-            },
+			},
+			
+			/* 获取整张试卷的答案合计Answers */
+			getAnswers(items){
+				let arr = []
+				items.forEach((i,index) => {
+					if(i.type === 'Complete'){
+						i.answer.forEach(j => {
+							arr.push({
+								num:arr.length,
+								group:index,
+								type:i.type,
+								ans:[j],
+								score:i.score / i.answer.length
+							})
+						})
+					}else{
+						arr.push({
+							num:arr.length,
+							group:index,
+							type:i.type,
+							ans:i.answer,
+							score:i.score
+						})
+					}
+				})
+				return arr
+			},
 
-            /**
-             * 组件更新删除题目时的处理
-             * @param list
-             */
-            onListUpdate(list) {
-                console.log(list)
-                list.forEach(i => {
-                    if (i.points.length && typeof (i.points[1]) !== 'string') {
-                        i.points = i.points.map(j => j.id)
-                    }
-                })
-                this.handleAnalysisData(list)
-            },
+			/**
+			 * 组件更新删除题目时的处理
+			 * @param list
+			 */
+			onListUpdate(list) {
+				console.log(list)
+				list.forEach(i => {
+					if (i.points.length && typeof(i.points[1]) !== 'string') {
+						i.points = i.points.map(j => j.id)
+					}
+				})
+				this.handleAnalysisData(list)
+			},
 
-            /**
-             * 处理试题分析数据
-             * @param list 试题列表
-             */
-            handleAnalysisData(list) {
-                let that = this
-                this.analysisTableData = []
-                this.exersicesList = list // 给试题列表组件传的值
-                this.paperInfo.item = list
-                const groupList = this._.groupBy(list, 'type')
-                this._.mapKeys(groupList, function (value, key) {
-                    that.analysisTableData.push({ name: that.exersicesType[key], value: value.length })
-                });
-            },
+			/**
+			 * 处理试题分析数据
+			 * @param list 试题列表
+			 */
+			handleAnalysisData(list) {
+				let that = this
+				this.analysisTableData = []
+				this.exersicesList = list // 给试题列表组件传的值
+				this.paperInfo.item = list
+				const groupList = this._.groupBy(list, 'type')
+				this._.mapKeys(groupList, function(value, key) {
+					that.analysisTableData.push({
+						name: that.exersicesType[key],
+						value: value.length
+					})
+				});
+			},
 
-            /** 重新挑题 */
-            goToPickExercise() {
-                this.$router.push({
-                    name: 'exercisesList',
-                    params: {
-                        paperInfo: this.paperInfo
-                    }
-                })
-            },
+			/** 重新挑题 */
+			goToPickExercise() {
+				this.$router.push({
+					name: 'exercisesList',
+					params: {
+						paperInfo: this.paperInfo
+					}
+				})
+			},
 
-            /** 点击题型配分 */
-            onSetScoreByType() {
-                this.$refs.exList.onSetScoreByType()
-            },
+			/** 点击题型配分 */
+			onSetScoreByType() {
+				this.$refs.exList.onSetScoreByType()
+			},
 
 
-            /**
-             * 试卷的视图模式切换
-             * @param val
-             */
-            onViewModelChange(val) {
-                this.$refs.exList.viewModel = val
-                this.$refs.exList.collapseList = []
-            },
+			/**
+			 * 试卷的视图模式切换
+			 * @param val
+			 */
+			onViewModelChange(val) {
+				this.$refs.exList.viewModel = val
+				this.$refs.exList.collapseList = []
+			},
 
-            /**
-             * 计算试卷题目平均难度
-             * @param arr 试题集合
-             */
-            handleDiffCalc(arr) {
-                let levelArr = arr.map(i => i.level)
-                return this._.meanBy(levelArr).toFixed(1)
-            }
+			/**
+			 * 计算试卷题目平均难度
+			 * @param arr 试题集合
+			 */
+			handleDiffCalc(arr) {
+				let levelArr = arr.map(i => i.level)
+				return this._.meanBy(levelArr).toFixed(1)
+			}
 
 
 
-        },
-        mounted() {
-            this.isShowSave = window.location.pathname === '/home/evaluation/testPaper'
-            let paper = this.paper || this.$route.params.paper || JSON.parse(localStorage.getItem('_paperInfo'))
-            if (!paper) return
-            localStorage.setItem('_paperInfo', JSON.stringify(paper))
-            this.paperInfo = paper // 自己页面的值
-            this.paperDiff = paper.item ? this.handleDiffCalc(paper.item) : 0
+		},
+		mounted() {
+			this.isShowSave = window.location.pathname === '/home/evaluation/testPaper'
+			let paper = this.paper || this.$route.params.paper || JSON.parse(localStorage.getItem('_paperInfo'))
+			if (!paper) return
+			localStorage.setItem('_paperInfo', JSON.stringify(paper))
+			this.paperInfo = paper // 自己页面的值
+			this.paperDiff = paper.item ? this.handleDiffCalc(paper.item) : 0
 
-        },
-        watch: {
-            paper: {
-                handler(newValue, oldValue) {
-                    console.log(newValue)
-                    this.paperInfo = newValue
-                    localStorage.setItem('_paperInfo', JSON.stringify(newValue))
-                    this.paperDiff = newValue.item ? this.handleDiffCalc(newValue.item) : 0
-                },
-                deep: true
-            }
-        }
-    }
+		},
+		computed: {
+			isAuto() {
+				return this.paperInfo.markConfig ? this.paperInfo.markConfig.auto : false
+			},
+			ruleType() {
+				return this.paperInfo.markConfig ? this.paperInfo.markConfig.type : 0
+			}
+		},
+		watch: {
+			paper: {
+				handler(newValue, oldValue) {
+					console.log(newValue)
+					this.paperInfo = newValue
+					localStorage.setItem('_paperInfo', JSON.stringify(newValue))
+					this.paperDiff = newValue.item ? this.handleDiffCalc(newValue.item) : 4
+				},
+				deep: true
+			}
+		}
+	}
 </script>
 <style src="../index/TestPaper.less" lang="less" scoped>
 </style>
 <style>
-    .complete-line {
-        padding: 0 45px;
-        border-bottom: 2px solid rgb(128, 128, 128);
-    }
+	.complete-line {
+		padding: 0 45px;
+		border-bottom: 2px solid rgb(128, 128, 128);
+	}
 </style>

+ 301 - 280
TEAMModelOS/ClientApp/src/view/selflearning/ManageHomeWork.vue

@@ -1,78 +1,78 @@
 <template>
-    <div class="hw-container">
-        <Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
-        <!-- 作业活动列表 -->
-        <div class="hw-col hw-list-box">
-            <div class="hw-box-header">
-                <span>作业活动列表</span>
-                <div>
-                    <Icon type="md-trash" class="to-create-icon" @click="onDeleteHw" style="margin-left:10px" v-show="hwList.length"/>
-                    <Icon type="md-add" class="to-create-icon" @click="goToCreate" />
-                </div>
-            </div>
-            <vuescroll>
-                <Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoadList"></Loading>
-                <div class="hw-item-wrap">
-                    <div v-if="hwList.length === 0">
-                        <EmptyBox :top="50"></EmptyBox>
-                    </div>
-                    <div style="width:100%" v-else>
-                        <div :class='["hw-item",index === activeHwIndex ? "item-active":""]'
-                             v-for="(item,index) in hwList"
-                             :key="index"
-                             @click="onHwClick(item,index)">
-                            <p class="hw-item-name">{{ item.name }}</p>
-                            <div class="hw-item-info">
-                                <span class="hw-item-nums"><Icon type="md-time" size="14" style="margin-right:5px"/>{{ $tools.formatTime(item.startTime) }}</span>
-                                <span class="hw-item-status"
-                                      :style="{ background: (item.status === 100 ? '#0BADD4' : item.status === 200 ? '#0fb68b' : '#949594')}">{{ item.status === 100 ? '待发布' : item.status === 200 ? '进行中' : '已结束' }}</span>
-                            </div>
-                        </div>
-                    </div>
+	<div class="hw-container">
+		<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
+		<!-- 作业活动列表 -->
+		<div class="hw-col hw-list-box">
+			<div class="hw-box-header">
+				<span>作业活动列表</span>
+				<div>
+					<Icon type="md-trash" class="to-create-icon" @click="onDeleteHw" style="margin-left:10px" v-show="hwList.length" />
+					<Icon type="md-add" class="to-create-icon" @click="goToCreate" />
+				</div>
+			</div>
+			<vuescroll>
+				<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoadList"></Loading>
+				<div class="hw-item-wrap">
+					<div v-if="hwList.length === 0">
+						<EmptyBox :top="50"></EmptyBox>
+					</div>
+					<div style="width:100%" v-else>
+						<div :class='["hw-item",index === activeHwIndex ? "item-active":""]' v-for="(item,index) in hwList" :key="index"
+						 @click="onHwClick(item,index)">
+							<p class="hw-item-name">{{ item.name }}</p>
+							<div class="hw-item-info">
+								<span class="hw-item-nums">
+									<Icon type="md-time" size="14" style="margin-right:5px" />{{ $tools.formatTime(item.startTime) }}</span>
+								<span class="hw-item-status" :style="{ background: (item.status === 100 ? '#0BADD4' : item.status === 200 ? '#0fb68b' : '#949594')}">{{ item.status === 100 ? '待发布' : item.status === 200 ? '进行中' : '已结束' }}</span>
+							</div>
+						</div>
+					</div>
 
-                </div>
-            </vuescroll>
-        </div>
+				</div>
+			</vuescroll>
+		</div>
 
-        <!-- 作业基础信息展示 -->
-        <div class="hw-col hw-info-box" v-show="currentHw.status !== 300">
-            <div class="hw-box-header">
-                <span>作业详情</span>
-                <div class="hw-box-header-tools">
-                    <span class="hw-box-header-tools-tool" v-show="currentHw.status !== 300 && hwList.length" ><Icon type="md-create" size="18" title="编辑" @click="onEditHw" /></span>
-                    <span class="hw-box-header-tools-tool" v-show="currentHw.status === 200 && hwList.length"><Icon type="md-undo" size="18" title="取消发布" @click="onCancelHw" style="margin-left:8px;" /></span>
-                </div>
-            </div>
-            <vuescroll ref="hwDetailsScroll">
-                <div class="hw-info-wrap">
-                    <div v-show="hwList.length === 0">
-                        <EmptyBox :top="50"></EmptyBox>
-                    </div>
-                    <BaseHwForm :editItem="currentHw" @onAddSuccess="onAddSuccess" ref="hwForm" v-show="hwList.length"></BaseHwForm>
-                </div>
-            </vuescroll>
-        </div>
+		<!-- 作业基础信息展示 -->
+		<div class="hw-col hw-info-box" v-show="currentHw.status !== 300">
+			<div class="hw-box-header">
+				<span>作业详情</span>
+				<div class="hw-box-header-tools">
+					<span class="hw-box-header-tools-tool" v-show="currentHw.status !== 300 && hwList.length">
+						<Icon type="md-create" size="18" title="编辑" @click="onEditHw" /></span>
+					<span class="hw-box-header-tools-tool" v-show="currentHw.status === 200 && hwList.length">
+						<Icon type="md-undo" size="18" title="取消发布" @click="onCancelHw" style="margin-left:8px;" /></span>
+				</div>
+			</div>
+			<vuescroll ref="hwDetailsScroll">
+				<div class="hw-info-wrap">
+					<div v-show="hwList.length === 0">
+						<EmptyBox :top="50"></EmptyBox>
+					</div>
+					<BaseHwForm :editItem="currentHw" @onAddSuccess="onAddSuccess" ref="hwForm" v-show="hwList.length"></BaseHwForm>
+				</div>
+			</vuescroll>
+		</div>
 
-        <!-- 作业提交数据 -->
-        <div class="hw-col hw-data-box" :style="{ width: currentHw.status !== 300 ? '55%' : '85%' }">
-            <div class="hw-box-header">
-                <span>作业数据</span>
-                <div class="hw-box-header-tools">
-                    <!--<span class="hw-box-header-tools-tool"><Icon type="md-podium" />数据分析</span>-->
-                </div>
-            </div>
-            <vuescroll>
-                <div class="hw-data-wrap">
-                    <div v-if="hwList.length === 0 || currentHw.status === 100">
-                        <EmptyBox :top="50"></EmptyBox>
-                    </div>
-                    <BaseHwTable :studentsList="studentsList" :hwId="currentHw.id" v-else></BaseHwTable>
-                </div>
-            </vuescroll>
-        </div>
+		<!-- 作业提交数据 -->
+		<div class="hw-col hw-data-box" :style="{ width: currentHw.status !== 300 ? '55%' : '85%' }">
+			<div class="hw-box-header">
+				<span>作业数据</span>
+				<div class="hw-box-header-tools">
+					<!--<span class="hw-box-header-tools-tool"><Icon type="md-podium" />数据分析</span>-->
+				</div>
+			</div>
+			<vuescroll>
+				<div class="hw-data-wrap">
+					<div v-if="hwList.length === 0 || currentHw.status === 100">
+						<EmptyBox :top="50"></EmptyBox>
+					</div>
+					<BaseHwTable :studentsList="studentsList" :hwId="currentHw.id" v-else></BaseHwTable>
+				</div>
+			</vuescroll>
+		</div>
 
-        <!-- 完善试卷信息 -->
-        <!--<Modal v-model="addHwModal"
+		<!-- 完善试卷信息 -->
+		<!--<Modal v-model="addHwModal"
                class-name="hw-modal"
                :title="isEdit ? '修改作业' : '新增作业'"
                footer-hide
@@ -83,151 +83,171 @@
                 </vuescroll>
             </div>
         </Modal>-->
-    </div>
+	</div>
 </template>
 <script>
-    import EmptyBox from '@/common/EmptyData'
-    import Loading from '@/common/Loading'
-    import BaseHwForm from '@/components/learnactivity/BaseHwForm'
-    import BaseHwTable from '@/components/learnactivity/BaseHwTable'
-    export default {
-        components: { BaseHwForm, BaseHwTable, EmptyBox, Loading },
-        data() {
-            return {
-                isLoading:false,
-                isLoadList:false,
-                isEdit: false,
-                editable:false,
-                hwList: [],
-                studentsList:[],
-                currentHw: {status:0},
-                editItem: {},
-                activeHwIndex:0,
-                addHwModal:false,
-            }
-        },
-        methods: {
+	import EmptyBox from '@/common/EmptyData'
+	import Loading from '@/common/Loading'
+	import BaseHwForm from '@/components/learnactivity/BaseHwForm'
+	import BaseHwTable from '@/components/learnactivity/BaseHwTable'
+	export default {
+		components: {
+			BaseHwForm,
+			BaseHwTable,
+			EmptyBox,
+			Loading
+		},
+		data() {
+			return {
+				isLoading: false,
+				isLoadList: false,
+				isEdit: false,
+				editable: false,
+				hwList: [],
+				studentsList: [],
+				currentHw: {
+					status: 0
+				},
+				editItem: {},
+				activeHwIndex: 0,
+				addHwModal: false,
+			}
+		},
+		methods: {
 
-            /** 新增作业 */
-            goToCreate() {
-                //this.$refs.editForm.handleReset('hwForm')
-                //this.$refs.editForm.$refs.uploadRef.clearUploadedList()
-                //this.$refs.editForm.isAdd = true
-                //this.$refs.editForm.defaultFileList = []
-                //this.$refs.hwForm.hwFormEdit = true
-                //this.isEdit = false
-                //this.editItem = null
-                //this.editable = true
-                //this.addHwModal = true
-                //this.backToTop('hwModalScroll')
+			/** 新增作业 */
+			goToCreate() {
+				//this.$refs.editForm.handleReset('hwForm')
+				//this.$refs.editForm.$refs.uploadRef.clearUploadedList()
+				//this.$refs.editForm.isAdd = true
+				//this.$refs.editForm.defaultFileList = []
+				//this.$refs.hwForm.hwFormEdit = true
+				//this.isEdit = false
+				//this.editItem = null
+				//this.editable = true
+				//this.addHwModal = true
+				//this.backToTop('hwModalScroll')
 
-                let defaultHw = {
-                    name: '预设作业名称',
-                    target: [],
-                    endTime: '',
-                    publishModel:'0',
-                    startTime:'',
-                    description: '',
-                    resource:[],
-                    isReset:[],
-                    other: []
-                }
+				let defaultHw = {
+					name: '预设作业名称',
+					target: [],
+					endTime: '',
+					publishModel: '0',
+					startTime: '',
+					description: '',
+					resource: [],
+					isReset: [],
+					other: []
+				}
+				this.studentsList = []
+				this.hwList.unshift(defaultHw);
+				this.currentHw = defaultHw;
+				this.editable = true
+				this.$refs.hwForm.hwFormEdit = true
 
-                this.hwList.unshift(defaultHw);
-                this.currentHw = defaultHw;
-                this.editable = true
-                this.$refs.hwForm.hwFormEdit = true
-
-            },
+			},
 
-            /** 删除当前作业 */
-            onDeleteHw() {
-                this.$Modal.confirm({
-                    title: '删除作业',
-                    content: '<p>确认删除该作业?</p>',
-                    okText: '确认',
-                    cancelText: '取消',
-                    onOk: () => {
-                        this.isLoading = true
+			/** 删除当前作业 */
+			onDeleteHw() {
+				this.$Modal.confirm({
+					title: '删除作业',
+					content: '<p>确认删除该作业?</p>',
+					okText: '确认',
+					cancelText: '取消',
+					onOk: () => {
+						this.isLoading = true
 
-                        if (this.currentHw.id) {
-                            this.$api.learnActivity.DeleteHomeWork({ id: this.currentHw.id, pk: this.$store.state.userInfo.TEAMModelId }).then(res => {
-                                if (res.result.data) {
-                                    this.$Message.success('操作成功')
-                                    this.getHomeWorkList()
-                                } else {
-                                    this.$Message.success('操作失败')
-                                }
+						if (this.currentHw.id) {
+							this.$api.learnActivity.DeleteHomeWork({
+								id: this.currentHw.id,
+								pk: this.$store.state.userInfo.TEAMModelId
+							}).then(res => {
+								if (res.result.data) {
+									this.$Message.success('操作成功')
+									this.getHomeWorkList()
+								} else {
+									this.$Message.success('操作失败')
+								}
 								this.isLoading = false
-                            })
-                        } else {
-                            this.hwList.splice(this.hwList.indexOf(this.currentHw), 1)
-                            this.isLoading = false
-                            this.$Message.success('操作成功')
-                            if (this.hwList.length) this.onHwClick(this.hwList[0],0)
-                        }
-                    }
-                })
-            },
+							})
+						} else {
+							this.hwList.splice(this.hwList.indexOf(this.currentHw), 1)
+							this.isLoading = false
+							this.$Message.success('操作成功')
+							if (this.hwList.length) this.onHwClick(this.hwList[0], 0)
+						}
+					}
+				})
+			},
 
-            /** 获取作业列表 */
-            getHomeWorkList() {
-                this.isLoadList = true
-                let params = { code:this.$store.state.userInfo.TEAMModelId }
-                this.$api.learnActivity.FindHomeWork(params).then(res => {
-                    if (!res.error && res.result.data) {
-                        this.hwList = res.result.data.sort((a, b) => { return b.createTime - a.createTime })
-                        if(res.result.data.length) this.onHwClick(res.result.data[0], 0)
-                        this.isLoadList = false
-                    } else {
-                        this.$Message.error('获取数据失败')
-                    }
-                })
-            },
+			/** 获取作业列表 */
+			getHomeWorkList() {
+				this.isLoadList = true
+				let params = {
+					code: this.$store.state.userInfo.TEAMModelId
+				}
+				this.$api.learnActivity.FindHomeWork(params).then(res => {
+					if (!res.error && res.result.data) {
+						this.hwList = res.result.data.sort((a, b) => {
+							return b.createTime - a.createTime
+						})
+						if (res.result.data.length) this.onHwClick(res.result.data[0], 0)
+						this.isLoadList = false
+					} else {
+						this.$Message.error('获取数据失败')
+					}
+				})
+			},
 
-            /**
-             * 作业点击事件
-             * @param item
-             * @param index
-             */
-            onHwClick(item, index) {
-                this.currentHw = item
-                this.activeHwIndex = index
-                if (item.id) this.getHwStudents(item.id , item.target)
-                this.$refs.hwForm.hwFormEdit = false
-                //this.backToTop('hwDetailsScroll')
-            },
+			/**
+			 * 作业点击事件
+			 * @param item
+			 * @param index
+			 */
+			onHwClick(item, index) {
+				this.currentHw = item
+				this.activeHwIndex = index
+				this.studentsList = []
+				if (item.id) this.getHwStudents(item.id, item.target)
+				this.$refs.hwForm.hwFormEdit = false
+				//this.backToTop('hwDetailsScroll')
+			},
 
 
-            /**
-             * 获取作业关联的学生清单
-             * @param hwId 作业ID
-             */
-            async getHwStudents(hwId,target) {
-				let records  = await this.getHwRecord(hwId)
+			/**
+			 * 获取作业关联的学生清单
+			 * @param hwId 作业ID
+			 */
+			async getHwStudents(hwId, target) {
+				let records = await this.getHwRecord(hwId)
 				this.isLoading = true
 				//  先查找 作业发布对象关联的学生清单 然后再去判断学生的作答情况
-				this.$api.courseMgmt.getClassroomStudent({ classroomCode: target.map(i => i.classroomCode) , schoolCode:'HBCN' }).then(res => {
-				    if (!res.error && res.result.data) {
-					    let list = res.result.data
+				this.$api.courseMgmt.getClassroomStudent({
+					classroomCode: target.map(i => i.classroomCode),
+					schoolCode: 'HBCN'
+				}).then(res => {
+					if (!res.error && res.result.data) {
+						let list = res.result.data
 						let infoList = res.result.extend.students
 						list.forEach(i => {
 							i.name = infoList.filter(j => j.studentId === i.code)[0].name
 							i.classroomName = target.filter(k => k.classroomCode === i.id)[0].classroomName
 						})
 						// 要根据作答情况 结合两张表 处理表格显示的数据 
-						if(records.length){
-							records.forEach(item => {
-								list.forEach(i => {
+						if (records.length) {
+							list.forEach(i => {
+								for (let a = 0; a < records.length; a++) {
 									// 如果学生已提交 则添加提交信息 如果未提交则跳过
-								    if(i.code === item.code && i.id === item.classroom.code){
+									let item = records[a]
+									if (i.code === item.code) {
 										i.submissionBool = true
 										i.submissionTime = item.submitTime
 										i.teacherComments = item.tchCmt
 										i.studentComments = item.stuCmt
 										i.score = item.score
 										i.content = item.content
-									}else{
+										return false
+									} else {
 										i.submissionBool = false
 										i.submissionTime = null
 										i.teacherComments = []
@@ -235,120 +255,121 @@
 										i.score = 0
 										i.content = []
 									}
-								})
+								}
 							})
 						}
-				        this.studentsList = list
+						this.studentsList = list
 						this.isLoading = false
-				    } else {
-				        this.$Message.error('获取数据失败')
-				    }
+					} else {
+						this.$Message.error('获取数据失败')
+					}
 				})
-            },
-			
+			},
+
 			/**
 			 * 老师评分请求接口
 			 * @param params
 			 */
 			getHwRecord(hwId) {
-			    return new Promise((r, j) => {
-			        this.$api.learnActivity.FindRecordByHwId({ id: hwId }).then(res => {
-			            if (!res.error && res.result.data) {
-			                r(res.result.data)
-			            } else {
-			                j(500)
-			            }
-			        })
-			    })
+				return new Promise((r, j) => {
+					this.$api.learnActivity.FindRecordByHwId({
+						id: hwId
+					}).then(res => {
+						if (!res.error && res.result.data) {
+							r(res.result.data)
+						} else {
+							j(500)
+						}
+					})
+				})
 			},
-			
-			
 
-            /** 作业编辑事件 */
-            onEditHw() {
-                this.editItem = this.currentHw
-                this.isEdit = true
-                this.editable = true
-                this.$refs.hwForm.hwFormEdit = !this.$refs.hwForm.hwFormEdit
-                //this.addHwModal = true
-                //this.backToTop('hwModalScroll')
-            },
+
+
+			/** 作业编辑事件 */
+			onEditHw() {
+				this.editItem = this.currentHw
+				this.isEdit = true
+				this.editable = true
+				this.$refs.hwForm.hwFormEdit = !this.$refs.hwForm.hwFormEdit
+				//this.addHwModal = true
+				//this.backToTop('hwModalScroll')
+			},
 
 			/* 取消发布作业 */
-            onCancelHw() {
-                this.$Modal.confirm({
-                    title: '取消发布',
-                    content: '<p>确认取消发布该作业?</p>',
-                    okText: '确认',
-                    cancelText: '取消',
-                    onOk: () => {
-                        this.isLoading = true
-                        this.$api.learnActivity.RevokeHomeWork(this.currentHw.id).then(res => {
-                            if (res.result.data) {
-                                this.isLoading = false
-                                this.$Message.success('操作成功')
-                                this.getHomeWorkList()
-                            } else {
-                                this.isLoading = false
-                                this.$Message.success('操作失败')
-                            }
-                        })
-                    }
-                })
-            },
+			onCancelHw() {
+				this.$Modal.confirm({
+					title: '取消发布',
+					content: '<p>确认取消发布该作业?</p>',
+					okText: '确认',
+					cancelText: '取消',
+					onOk: () => {
+						this.isLoading = true
+						this.$api.learnActivity.RevokeHomeWork(this.currentHw.id).then(res => {
+							if (res.result.data) {
+								this.isLoading = false
+								this.$Message.success('操作成功')
+								this.getHomeWorkList()
+							} else {
+								this.isLoading = false
+								this.$Message.success('操作失败')
+							}
+						})
+					}
+				})
+			},
 
 
-            /** 新增作业成功回调 */
-            onAddSuccess() {
-                this.getHomeWorkList()
-            },
+			/** 新增作业成功回调 */
+			onAddSuccess() {
+				this.getHomeWorkList()
+			},
 
 
-            /**
-             * 滚动条返回顶部
-             * @param refName
-             */
-            backToTop(refName) {
-                this.$refs[refName].scrollTo(
-                    {
-                        y: 0
-                    },
-                    100, 'easeInQuad'
-                )
-            }
-        },
-        mounted() {
-            this.getHomeWorkList()
-        }
-    }
+			/**
+			 * 滚动条返回顶部
+			 * @param refName
+			 */
+			backToTop(refName) {
+				this.$refs[refName].scrollTo({
+						y: 0
+					},
+					100, 'easeInQuad'
+				)
+			}
+		},
+		mounted() {
+			this.getHomeWorkList()
+		}
+	}
 </script>
 <style lang="less" scoped>
-    @import "./ManageHomeWork.less";
+	@import "./ManageHomeWork.less";
 </style>
 <style>
-    .hw-modal .ivu-modal-content {
-        background:#454545;
-        font-family: '微軟正黑體', 'Heiti TC' !important;
-    }
+	.hw-modal .ivu-modal-content {
+		background: #454545;
+		font-family: '微軟正黑體', 'Heiti TC' !important;
+	}
 
-    .hw-modal .ivu-modal-body {
-        padding:0;
-    }
+	.hw-modal .ivu-modal-body {
+		padding: 0;
+	}
 
-    .hw-modal .ivu-modal-header p,
-    .hw-modal .ivu-modal-header-inner {
-        color:#fff;
-        font-size:18px;
-        font-weight:bold;
-    }
+	.hw-modal .ivu-modal-header p,
+	.hw-modal .ivu-modal-header-inner {
+		color: #fff;
+		font-size: 18px;
+		font-weight: bold;
+	}
 
-    .hw-modal .ivu-modal-header {
-        border-bottom:none;
-    }
+	.hw-modal .ivu-modal-header {
+		border-bottom: none;
+	}
 
-    .hw-modal .hw-modal-box {
-        height:600px;
-        max-height:600px;
-        padding:15px;
-    }
-</style>
+	.hw-modal .hw-modal-box {
+		height: 600px;
+		max-height: 600px;
+		padding: 15px;
+	}
+</style>