|
@@ -1,483 +1,499 @@
|
|
|
<template>
|
|
|
- <div class="create-evaluation-container">
|
|
|
- <div class="create-header">
|
|
|
- <p class="create-header-title">创建评测活动</p>
|
|
|
- <p class="btn-save" @click="saveEvaluation"><Icon type="ios-albums-outline" color="#6BE9C3" style="margin-right:10px;" />保存评测</p>
|
|
|
- </div>
|
|
|
- <div class="create-body">
|
|
|
- <div class="evaluation-attr-wrap">
|
|
|
- <p class="wrap-label">基础信息</p>
|
|
|
- <div style="width:100%; height:calc(100% - 45px);padding-top:30px;">
|
|
|
- <!--<vuescroll>-->
|
|
|
- <Form ref="evaluationInfo" :model="evaluationInfo" label-position="top" class="evaluation-attr-form" label-colon :rules="ruleValidate">
|
|
|
- <FormItem label="评测名称" prop="name">
|
|
|
- <Input v-model="evaluationInfo.name"></Input>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="测试类型" prop="type">
|
|
|
- <Select v-model="evaluationInfo.type">
|
|
|
- <Option v-for="(item,index) in typeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="发布方式" prop="publish">
|
|
|
- <Select v-model="evaluationInfo.publish">
|
|
|
- <Option v-for="(item,index) in publishList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="施测对象">
|
|
|
- <Select v-model="evaluationInfo.target" multiple>
|
|
|
- <Option v-for="(item,index) in classroomList" :value="item" :key="index">{{ item }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="施测时间">
|
|
|
- <DatePicker type="daterange" split-panels placeholder="请选择发布时间" style="width:100%" @on-change="getDate"></DatePicker>
|
|
|
- </FormItem>
|
|
|
- </Form>
|
|
|
- <!--</vuescroll>-->
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="evaluation-question-wrap">
|
|
|
- <div class="wrap-label">
|
|
|
- <p>测试科目:</p>
|
|
|
- <span v-for="(item,index) in evaluationInfo.testPaper" :class="index == currentSubjectIndex ? 'subject-item subject-item-active':'subject-item'" @click="selectSubject(index)">
|
|
|
- {{jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodCode).periodName}}
|
|
|
- <span style="margin:0px 5px;">·</span>
|
|
|
- {{jsFn.getSubjectName(jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodCode), item.subjectCode)}}
|
|
|
- <Icon type="ios-close" size="18" class="delete-subject-btn" @click="deleteSubject(index)" />
|
|
|
- </span>
|
|
|
- <Icon @click="addSubject" type="md-add-circle" title="添加科目" color="white" class="add-subject-icon" size="20" />
|
|
|
+ <div class="create-evaluation-container">
|
|
|
+ <div class="create-header">
|
|
|
+ <p class="create-header-title">创建评测活动</p>
|
|
|
+ <p class="btn-save" @click="saveEvaluation"><Icon type="ios-albums-outline" color="#6BE9C3" style="margin-right:10px;" />保存评测</p>
|
|
|
</div>
|
|
|
- <div class="evaluation-question-main">
|
|
|
- <NoData style="margin-top:120px;" v-if="evaluationInfo.testPaper.length == 0" textContent="暂无科目,请添加科目"></NoData>
|
|
|
- <div class="create-type-wrap" v-if="evaluationInfo.testPaper.length > 0">
|
|
|
- <span>创建方式:</span>
|
|
|
- <RadioGroup v-model="evaluationInfo.testPaper[currentSubjectIndex].createType" style="margin-left:25px;" @on-change="setActiveTab">
|
|
|
- <Radio label="auto">自动组题</Radio>
|
|
|
- <Radio label="manual">手动挑题/卷</Radio>
|
|
|
- <Radio label="import">试卷导入</Radio>
|
|
|
- </RadioGroup>
|
|
|
- </div>
|
|
|
- <Tabs v-model="activeTab" type="card" class="question-main-tabs" v-if="evaluationInfo.testPaper.length > 0" name="createTest">
|
|
|
- <TabPane label="组题条件" name="auto" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'auto'" :index="1" tab="createTest">
|
|
|
- <AutoCreate :subjectCode="evaluationInfo.testPaper[currentSubjectIndex].subjectCode" :periodCode="evaluationInfo.testPaper[currentSubjectIndex].periodCode" @goToPreview="goToPreview" @autoQuestions="getImportQuestions"></AutoCreate>
|
|
|
- </TabPane>
|
|
|
- <TabPane label="备选题目" name="manual" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'manual'" :index="2" tab="createTest">
|
|
|
- <ManualCreate :questionList="questionList" @goToPreview="goToPreview" @selectedQuestion="getSelectedQuestion"></ManualCreate>
|
|
|
- </TabPane>
|
|
|
- <TabPane label="导入说明" name="import" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'import'" :index="3" tab="createTest">
|
|
|
- <ImportCreate @importedQuestions="getImportQuestions" @goToPreview="goToPreview"></ImportCreate>
|
|
|
- </TabPane>
|
|
|
- <TabPane label="试题预览" name="preview" :index="4" tab="createTest">
|
|
|
- <TeacherPreview :testPaper="evaluationInfo.testPaper[currentSubjectIndex]" :paperName="evaluationInfo.name"></TeacherPreview>
|
|
|
- </TabPane>
|
|
|
- <TabPane label="学生作答预览" name="student" :index="5" tab="createTest">
|
|
|
- <StudentPreview></StudentPreview>
|
|
|
- </TabPane>
|
|
|
- </Tabs>
|
|
|
+ <div class="create-body">
|
|
|
+ <div class="evaluation-attr-wrap">
|
|
|
+ <p class="wrap-label">基础信息</p>
|
|
|
+ <div style="width:100%; height:calc(100% - 45px);padding-top:30px;">
|
|
|
+ <!--<vuescroll>-->
|
|
|
+ <Form ref="evaluationInfo" :model="evaluationInfo" label-position="top" class="evaluation-attr-form" label-colon :rules="ruleValidate">
|
|
|
+ <FormItem label="评测名称" prop="name">
|
|
|
+ <Input v-model="evaluationInfo.name"></Input>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="测试类型" prop="type">
|
|
|
+ <Select v-model="evaluationInfo.type">
|
|
|
+ <Option v-for="(item,index) in typeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="发布方式" prop="publish">
|
|
|
+ <Select v-model="evaluationInfo.publish">
|
|
|
+ <Option v-for="(item,index) in publishList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="施测对象">
|
|
|
+ <Select v-model="evaluationInfo.target" multiple>
|
|
|
+ <Option v-for="(item,index) in classroomList" :value="item" :key="index">{{ item }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="施测时间">
|
|
|
+ <DatePicker type="daterange" format="yyyy/MM/dd" split-panels placeholder="请选择发布时间" style="width:100%" @on-change="getDate"></DatePicker>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ <!--</vuescroll>-->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="evaluation-question-wrap">
|
|
|
+ <div class="wrap-label">
|
|
|
+ <p>测试科目:</p>
|
|
|
+ <span v-for="(item,index) in evaluationInfo.testPaper" :class="index == currentSubjectIndex ? 'subject-item subject-item-active':'subject-item'" @click="selectSubject(index)">
|
|
|
+ {{jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodCode).periodName}}
|
|
|
+ <span style="margin:0px 5px;">·</span>
|
|
|
+ {{jsFn.getSubjectName(jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodCode), item.subjectCode)}}
|
|
|
+ <Icon type="ios-close" size="18" class="delete-subject-btn" @click="deleteSubject(index)" />
|
|
|
+ </span>
|
|
|
+ <Icon @click="addSubject" type="md-add-circle" title="添加科目" color="white" class="add-subject-icon" size="20" />
|
|
|
+ </div>
|
|
|
+ <div class="evaluation-question-main">
|
|
|
+ <NoData style="margin-top:120px;" v-if="evaluationInfo.testPaper.length == 0" textContent="暂无科目,请添加科目"></NoData>
|
|
|
+ <div class="create-type-wrap" v-if="evaluationInfo.testPaper.length > 0">
|
|
|
+ <span>创建方式:</span>
|
|
|
+ <RadioGroup v-model="evaluationInfo.testPaper[currentSubjectIndex].createType" style="margin-left:25px;" @on-change="setActiveTab">
|
|
|
+ <Radio label="auto">自动组题</Radio>
|
|
|
+ <Radio label="manual">手动挑题/卷</Radio>
|
|
|
+ <Radio label="import">试卷导入</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <Tabs v-model="activeTab" type="card" class="question-main-tabs" v-if="evaluationInfo.testPaper.length > 0" name="createTest">
|
|
|
+ <TabPane label="组题条件" name="auto" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'auto'" :index="1" tab="createTest">
|
|
|
+ <AutoCreate :subjectCode="evaluationInfo.testPaper[currentSubjectIndex].subjectCode" :periodCode="evaluationInfo.testPaper[currentSubjectIndex].periodCode" @goToPreview="goToPreview" @autoQuestions="getAutoQuestions"></AutoCreate>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane label="备选题目" name="manual" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'manual'" :index="2" tab="createTest">
|
|
|
+ <ManualCreate :questionList="questionList" @goToPreview="goToPreview" @selectedQuestion="getSelectedQuestion"></ManualCreate>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane label="导入说明" name="import" v-if="evaluationInfo.testPaper[currentSubjectIndex].createType == 'import'" :index="3" tab="createTest">
|
|
|
+ <ImportCreate @importedQuestions="getImportQuestions" @goToPreview="goToPreview"></ImportCreate>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane label="试题预览" name="preview" :index="4" tab="createTest">
|
|
|
+ <TeacherPreview :testPaper="evaluationInfo.testPaper[currentSubjectIndex]" :paperName="evaluationInfo.name"></TeacherPreview>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane label="学生作答预览" name="student" :index="5" tab="createTest">
|
|
|
+ <StudentPreview></StudentPreview>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ <Modal v-model="addSubjectStatus"
|
|
|
+ title="添加测试学科"
|
|
|
+ class-name="dark-iview-modal"
|
|
|
+ @on-ok="confirmAddSubject"
|
|
|
+ @on-cancel="cancelAddSubject">
|
|
|
+ <div v-for="(item,index) in $store.state.schoolBaseInfo.schoolBaseInfo.period" style="margin-top:10px;margin-bottom:30px;">
|
|
|
+ <div style="padding-bottom:6px;margin-bottom:6px;">
|
|
|
+ <span>{{item.periodName}}</span>
|
|
|
+ </div>
|
|
|
+ <CheckboxGroup v-model="testSubjects[index]">
|
|
|
+ <Checkbox v-for="(subjectItem,i) in item.subjects" :label="subjectItem.subjectCode" :disabled="checkIsDisabled(index,subjectItem.subjectCode)" @input="newAddSubject(index,i,subjectItem.subjectCode)">
|
|
|
+ <span>{{subjectItem.subjectName}}</span>
|
|
|
+ </Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ <Modal v-model="goToManageStatus"
|
|
|
+ title="管理评测"
|
|
|
+ ok-text="是"
|
|
|
+ cancel-text="否"
|
|
|
+ @on-ok="confirmToManage">
|
|
|
+ <p>评测保存成功,是否跳转到管理评测页面查看?</p>
|
|
|
+ </Modal>
|
|
|
+ <Modal v-model="comfirmPreviewStatus"
|
|
|
+ ok-text="是"
|
|
|
+ cancel-text="否"
|
|
|
+ :mask-closable="false"
|
|
|
+ @on-ok="goToPreview"
|
|
|
+ @on-cancel="cancel">
|
|
|
+
|
|
|
+ <p style="font-size:18px;padding-top:15px;">自动组题成功,是否跳转到试题预览界面预览题目?</p>
|
|
|
+ </Modal>
|
|
|
</div>
|
|
|
- <Modal v-model="addSubjectStatus"
|
|
|
- title="添加测试学科"
|
|
|
- class-name="dark-iview-modal"
|
|
|
- @on-ok="confirmAddSubject"
|
|
|
- @on-cancel="cancelAddSubject">
|
|
|
- <div v-for="(item,index) in $store.state.schoolBaseInfo.schoolBaseInfo.period" style="margin-top:10px;margin-bottom:30px;">
|
|
|
- <div style="padding-bottom:6px;margin-bottom:6px;">
|
|
|
- <span>{{item.periodName}}</span>
|
|
|
- </div>
|
|
|
- <CheckboxGroup v-model="testSubjects[index]">
|
|
|
- <Checkbox v-for="(subjectItem,i) in item.subjects" :label="subjectItem.subjectCode" :disabled="checkIsDisabled(index,subjectItem.subjectCode)" @input="newAddSubject(index,i,subjectItem.subjectCode)">
|
|
|
- <span>{{subjectItem.subjectName}}</span>
|
|
|
- </Checkbox>
|
|
|
- </CheckboxGroup>
|
|
|
- </div>
|
|
|
- </Modal>
|
|
|
- <Modal v-model="goToManageStatus"
|
|
|
- title="管理评测"
|
|
|
- ok-text="是"
|
|
|
- cancel-text="否"
|
|
|
- @on-ok="confirmToManage">
|
|
|
- <p>评测保存成功,是否跳转到管理评测页面查看?</p>
|
|
|
- </Modal>
|
|
|
-
|
|
|
- </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import questions from '../evaluation/index/list.json'
|
|
|
- import AutoCreate from './AutoCreate.vue'
|
|
|
- import ManualCreate from './ManualCreate.vue'
|
|
|
- import ImportCreate from './ImportCreate.vue'
|
|
|
- import TeacherPreview from './TeacherPreview.vue'
|
|
|
- import StudentPreview from './StudentPreview.vue'
|
|
|
- import NoData from '@/common/NoData.vue'
|
|
|
- import jsFn from '@/utils/js-fn.js'
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- NoData,
|
|
|
- AutoCreate,
|
|
|
- ManualCreate,
|
|
|
- TeacherPreview,
|
|
|
- StudentPreview,
|
|
|
- ImportCreate
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- jsFn,
|
|
|
- goToManageStatus: false,
|
|
|
- examInfo: {},
|
|
|
- ruleValidate: {
|
|
|
- name: [
|
|
|
- { required: true, message: '评测名称不能为空!', trigger: 'change' }
|
|
|
- ],
|
|
|
- type: [
|
|
|
- { required: true, message: '测试类型不能为空!', trigger: 'change' }
|
|
|
- ],
|
|
|
- publish: [
|
|
|
- { required: true, message: '发布方式不能为空!', trigger: 'change' }
|
|
|
- ]
|
|
|
+ import questions from '../evaluation/index/list.json'
|
|
|
+ import AutoCreate from './AutoCreate.vue'
|
|
|
+ import ManualCreate from './ManualCreate.vue'
|
|
|
+ import ImportCreate from './ImportCreate.vue'
|
|
|
+ import TeacherPreview from './TeacherPreview.vue'
|
|
|
+ import StudentPreview from './StudentPreview.vue'
|
|
|
+ import NoData from '@/common/NoData.vue'
|
|
|
+ import jsFn from '@/utils/js-fn.js'
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ NoData,
|
|
|
+ AutoCreate,
|
|
|
+ ManualCreate,
|
|
|
+ TeacherPreview,
|
|
|
+ StudentPreview,
|
|
|
+ ImportCreate
|
|
|
},
|
|
|
- demoLoginInfo: {
|
|
|
- user: 'admin',
|
|
|
- TEAMModelId: 'habook#0001',
|
|
|
- school: '醍摩豆书院',
|
|
|
- schoolCode: 'HBCN'
|
|
|
- },
|
|
|
- deleteIndex:-1,
|
|
|
- testSubjects:[],
|
|
|
- activeTab:'auto',
|
|
|
- addSubjectStatus: false,
|
|
|
- addSubjectBefore: [],
|
|
|
- newAddSubjects:[],
|
|
|
- questionList:[],
|
|
|
- currentSubjectIndex: 0,
|
|
|
- evaluationInfo: {
|
|
|
- name: '',
|
|
|
- target: [],
|
|
|
- type: '',
|
|
|
- publish: '',
|
|
|
- publishTime: '',
|
|
|
- testPaper: [
|
|
|
- //{
|
|
|
- // periodName:'小学',
|
|
|
- // subjectName: '语文',
|
|
|
- // createType: 'auto',//不需要保存
|
|
|
- // filter: {},//前端用于区分创建评测的方式,以及创建的一些过滤条件,不需要保存
|
|
|
- // questions:[]
|
|
|
- //}
|
|
|
- ]
|
|
|
- },
|
|
|
- classroomList: [
|
|
|
- '一年级一班',
|
|
|
- '一年级二班',
|
|
|
- '一年级三班'
|
|
|
- ],
|
|
|
-
|
|
|
- typeList: [
|
|
|
- {
|
|
|
- value: '1',
|
|
|
- label:'联考'
|
|
|
- },
|
|
|
- {
|
|
|
- value: '2',
|
|
|
- label:'段考'
|
|
|
- },
|
|
|
- {
|
|
|
- value: '3',
|
|
|
- label:'平常考'
|
|
|
- },
|
|
|
- {
|
|
|
- value: '4',
|
|
|
- label:'其他'
|
|
|
- }
|
|
|
- ],
|
|
|
- publishList: [
|
|
|
- {
|
|
|
- value: '1',
|
|
|
- label:'自动发布'
|
|
|
- },
|
|
|
- {
|
|
|
- value: '2',
|
|
|
- label:'手动发布'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- confirmToManage() {
|
|
|
- this.$router.push({
|
|
|
- name:'manageEvaluation'
|
|
|
- })
|
|
|
- },
|
|
|
- getDate(value, date) {
|
|
|
- console.log(value)
|
|
|
- console.log(date)
|
|
|
- },
|
|
|
- getImportQuestions(questions) {
|
|
|
- if (this.evaluationInfo.testPaper[this.currentSubjectIndex].item != undefined) {
|
|
|
- this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions, ...this.evaluationInfo.testPaper[this.currentSubjectIndex].item]
|
|
|
- } else {
|
|
|
- this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions]
|
|
|
- }
|
|
|
- },
|
|
|
- getSelectedQuestion(data) {
|
|
|
- if (this.evaluationInfo.testPaper[this.currentSubjectIndex].item == undefined) {
|
|
|
- this.evaluationInfo.testPaper[this.currentSubjectIndex].item = []
|
|
|
- this.evaluationInfo.testPaper[this.currentSubjectIndex].item.push(data.item)
|
|
|
- } else {
|
|
|
- this.evaluationInfo.testPaper[this.currentSubjectIndex].item.push(data.item)
|
|
|
- }
|
|
|
- console.log("index")
|
|
|
- console.log(this.evaluationInfo.testPaper[this.currentSubjectIndex])
|
|
|
- },
|
|
|
- goToPreview() {
|
|
|
- this.activeTab = 'preview'
|
|
|
- },
|
|
|
- deleteSubject(index) {
|
|
|
- this.deleteIndex = index
|
|
|
- this.$Modal.confirm({
|
|
|
- title: '删除科目',
|
|
|
- content: '确认删除' + this.evaluationInfo.testPaper[index].periodName + '·' + this.evaluationInfo.testPaper[index].subjectName + '吗?',
|
|
|
- onOk: () => {
|
|
|
- let periodIndex = -1
|
|
|
- for (let i in this.$store.state.schoolBaseInfo.schoolBaseInfo.period) {
|
|
|
- if (this.$store.state.schoolBaseInfo.schoolBaseInfo.period[i].periodCode == this.evaluationInfo.testPaper[index].periodCode) {
|
|
|
- periodIndex = i
|
|
|
- }
|
|
|
- }
|
|
|
- for (let i = 0; i < this.testSubjects[periodIndex].length; i++) {
|
|
|
- if (this.evaluationInfo.testPaper[index].subjectCode == this.testSubjects[periodIndex][i]) {
|
|
|
- this.testSubjects[periodIndex].splice(i,1)
|
|
|
- }
|
|
|
- }
|
|
|
- this.evaluationInfo.testPaper.splice(this.deleteIndex, 1)
|
|
|
- this.currentSubjectIndex = 0
|
|
|
- this.deleteIndex = -1
|
|
|
- this.$Message.success('删除成功!')
|
|
|
- },
|
|
|
- onCancel: () => {
|
|
|
- this.deleteIndex = -1
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- newAddSubject(index, i,code) {
|
|
|
- if (!this.checkIsDisabled(index, code)) {
|
|
|
- let flag = true
|
|
|
- for (let j = 0; j < this.newAddSubjects.length; j++) {
|
|
|
- if (this.newAddSubjects[j].index == index && this.newAddSubjects[j].i == i) {
|
|
|
- flag = false
|
|
|
- this.newAddSubjects.splice(j, 1)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if (flag) {
|
|
|
- this.newAddSubjects.push({
|
|
|
- index,i
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- alert('disabled')
|
|
|
- }
|
|
|
- },
|
|
|
- checkIsDisabled(index,code) {
|
|
|
- if (this.addSubjectBefore[index] !== undefined) {
|
|
|
- return this.addSubjectBefore[index].indexOf(code) !== -1
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
- },
|
|
|
- inDevelopment() {
|
|
|
- this.$Message.info('功能正在开发中,敬请期待!')
|
|
|
- },
|
|
|
- setActiveTab(data) {
|
|
|
- this.activeTab = data
|
|
|
- },
|
|
|
- confirmAddSubject() {
|
|
|
- for (let item of this.newAddSubjects) {
|
|
|
- this.evaluationInfo.testPaper.push({
|
|
|
- periodName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodName,
|
|
|
- periodCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodCode,
|
|
|
- subjectName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectName,
|
|
|
- subjectCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectCode,
|
|
|
- createType: 'auto',
|
|
|
- score:100,
|
|
|
- item: [],
|
|
|
- filter: {}
|
|
|
- })
|
|
|
- }
|
|
|
- this.newAddSubjects.length = 0
|
|
|
- this.addSubjectBefore.length = 0
|
|
|
- },
|
|
|
- cancelAddSubject() {
|
|
|
- [...this.testSubjects] = this.addSubjectBefore
|
|
|
- this.addSubjectBefore.length = 0
|
|
|
- },
|
|
|
- getSchoolBaseInfo() {
|
|
|
- this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(
|
|
|
- (res) => {
|
|
|
- if (res.code == 2) {
|
|
|
- alert('数据为空!')
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- alert('API error!')
|
|
|
- }
|
|
|
- )
|
|
|
- },
|
|
|
- selectSubject(index) {
|
|
|
- this.currentSubjectIndex = index
|
|
|
- this.activeTab = this.evaluationInfo.testPaper[index].createType
|
|
|
- },
|
|
|
- checkData() {
|
|
|
- let flag = true
|
|
|
- this.$refs.evaluationInfo.validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- flag = false
|
|
|
- }
|
|
|
- })
|
|
|
- return flag
|
|
|
- },
|
|
|
- handleData() {
|
|
|
- this.evaluationInfo.schoolCode = this.demoLoginInfo.schoolCode
|
|
|
- let requestData = {
|
|
|
- name: this.evaluationInfo.name,
|
|
|
- scopeCode: this.demoLoginInfo.TEAMModelId,
|
|
|
- createTime: Date.parse(new Date())/1000,
|
|
|
- target: this.evaluationInfo.target,
|
|
|
- startTime: 0,
|
|
|
- endTime: 0,
|
|
|
- publish: this.evaluationInfo.publish,
|
|
|
- type:this.evaluationInfo.type,
|
|
|
- }
|
|
|
- if (this.examInfo.id != undefined) {
|
|
|
- requestData.id = this.examInfo.id
|
|
|
- } else if (this.evaluationInfo.id != undefined) {
|
|
|
- requestData.id = this.evaluationInfo.id
|
|
|
- }
|
|
|
- this.$api.learnActivity.SaveExamInfo(requestData).then(
|
|
|
- res => {
|
|
|
- if (res.error == null) {
|
|
|
- this.examInfo = res.result.data
|
|
|
- for (let index in this.evaluationInfo.testPaper) {
|
|
|
- this.saveTestPaper(this.evaluationInfo.testPaper[index], index)
|
|
|
- }
|
|
|
- //this.$Message.success('保存成功!')
|
|
|
- this.goToManageStatus = true
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ jsFn,
|
|
|
+ comfirmPreviewStatus: false,
|
|
|
+ goToManageStatus: false,
|
|
|
+ examInfo: {},
|
|
|
+ ruleValidate: {
|
|
|
+ name: [
|
|
|
+ { required: true, message: '评测名称不能为空!', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ { required: true, message: '测试类型不能为空!', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ publish: [
|
|
|
+ { required: true, message: '发布方式不能为空!', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ demoLoginInfo: {
|
|
|
+ user: 'admin',
|
|
|
+ TEAMModelId: 'habook#0001',
|
|
|
+ school: '醍摩豆书院',
|
|
|
+ schoolCode: 'HBCN'
|
|
|
+ },
|
|
|
+ deleteIndex: -1,
|
|
|
+ testSubjects: [],
|
|
|
+ activeTab: 'auto',
|
|
|
+ addSubjectStatus: false,
|
|
|
+ addSubjectBefore: [],
|
|
|
+ newAddSubjects: [],
|
|
|
+ questionList: [],
|
|
|
+ currentSubjectIndex: 0,
|
|
|
+ evaluationInfo: {
|
|
|
+ name: '',
|
|
|
+ target: [],
|
|
|
+ type: '',
|
|
|
+ publish: '',
|
|
|
+ startTime: 0,
|
|
|
+ endTime: 0,
|
|
|
+ testPaper: [
|
|
|
+ //{
|
|
|
+ // periodName:'小学',
|
|
|
+ // subjectName: '语文',
|
|
|
+ // createType: 'auto',//不需要保存
|
|
|
+ // filter: {},//前端用于区分创建评测的方式,以及创建的一些过滤条件,不需要保存
|
|
|
+ // questions:[]
|
|
|
+ //}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ classroomList: [
|
|
|
+ '一年级一班',
|
|
|
+ '一年级二班',
|
|
|
+ '一年级三班'
|
|
|
+ ],
|
|
|
|
|
|
- } else {
|
|
|
- this.$Message.error('API ERROR!')
|
|
|
+ typeList: [
|
|
|
+ {
|
|
|
+ value: '1',
|
|
|
+ label: '联考'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '2',
|
|
|
+ label: '段考'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '3',
|
|
|
+ label: '平常考'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '4',
|
|
|
+ label: '其他'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ publishList: [
|
|
|
+ {
|
|
|
+ value: '1',
|
|
|
+ label: '自动发布'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '2',
|
|
|
+ label: '手动发布'
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
- },
|
|
|
- err => {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ confirmToManage() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'manageEvaluation'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDate(value, date) {
|
|
|
+ this.evaluationInfo.startTime = new Date(value[0]).getTime()
|
|
|
+ this.evaluationInfo.endTime = new Date(value[1]).getTime()
|
|
|
+ },
|
|
|
+ getAutoQuestions(questions) {
|
|
|
+ if (this.evaluationInfo.testPaper[this.currentSubjectIndex].item != undefined) {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions, ...this.evaluationInfo.testPaper[this.currentSubjectIndex].item]
|
|
|
+ } else {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions]
|
|
|
+ }
|
|
|
+ this.comfirmPreviewStatus = true
|
|
|
+ },
|
|
|
+ getImportQuestions(questions) {
|
|
|
+ if (this.evaluationInfo.testPaper[this.currentSubjectIndex].item != undefined) {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions, ...this.evaluationInfo.testPaper[this.currentSubjectIndex].item]
|
|
|
+ } else {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item = [...questions]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSelectedQuestion(data) {
|
|
|
+ if (this.evaluationInfo.testPaper[this.currentSubjectIndex].item == undefined) {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item = []
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item.push(data.item)
|
|
|
+ } else {
|
|
|
+ this.evaluationInfo.testPaper[this.currentSubjectIndex].item.push(data.item)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ goToPreview() {
|
|
|
+ this.activeTab = 'preview'
|
|
|
+ },
|
|
|
+ deleteSubject(index) {
|
|
|
+ this.deleteIndex = index
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: '删除科目',
|
|
|
+ content: '确认删除' + this.evaluationInfo.testPaper[index].periodName + '·' + this.evaluationInfo.testPaper[index].subjectName + '吗?',
|
|
|
+ onOk: () => {
|
|
|
+ let periodIndex = -1
|
|
|
+ for (let i in this.$store.state.schoolBaseInfo.schoolBaseInfo.period) {
|
|
|
+ if (this.$store.state.schoolBaseInfo.schoolBaseInfo.period[i].periodCode == this.evaluationInfo.testPaper[index].periodCode) {
|
|
|
+ periodIndex = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.testSubjects[periodIndex].length; i++) {
|
|
|
+ if (this.evaluationInfo.testPaper[index].subjectCode == this.testSubjects[periodIndex][i]) {
|
|
|
+ this.testSubjects[periodIndex].splice(i, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.evaluationInfo.testPaper.splice(this.deleteIndex, 1)
|
|
|
+ this.currentSubjectIndex = 0
|
|
|
+ this.deleteIndex = -1
|
|
|
+ this.$Message.success('删除成功!')
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ this.deleteIndex = -1
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ newAddSubject(index, i, code) {
|
|
|
+ if (!this.checkIsDisabled(index, code)) {
|
|
|
+ let flag = true
|
|
|
+ for (let j = 0; j < this.newAddSubjects.length; j++) {
|
|
|
+ if (this.newAddSubjects[j].index == index && this.newAddSubjects[j].i == i) {
|
|
|
+ flag = false
|
|
|
+ this.newAddSubjects.splice(j, 1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ this.newAddSubjects.push({
|
|
|
+ index, i
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ alert('disabled')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkIsDisabled(index, code) {
|
|
|
+ if (this.addSubjectBefore[index] !== undefined) {
|
|
|
+ return this.addSubjectBefore[index].indexOf(code) !== -1
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ inDevelopment() {
|
|
|
+ this.$Message.info('功能正在开发中,敬请期待!')
|
|
|
+ },
|
|
|
+ setActiveTab(data) {
|
|
|
+ this.activeTab = data
|
|
|
+ },
|
|
|
+ confirmAddSubject() {
|
|
|
+ for (let item of this.newAddSubjects) {
|
|
|
+ this.evaluationInfo.testPaper.push({
|
|
|
+ periodName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodName,
|
|
|
+ periodCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodCode,
|
|
|
+ subjectName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectName,
|
|
|
+ subjectCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectCode,
|
|
|
+ createType: 'auto',
|
|
|
+ score: 100,
|
|
|
+ item: [],
|
|
|
+ filter: {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.newAddSubjects.length = 0
|
|
|
+ this.addSubjectBefore.length = 0
|
|
|
+ },
|
|
|
+ cancelAddSubject() {
|
|
|
+ [...this.testSubjects] = this.addSubjectBefore
|
|
|
+ this.addSubjectBefore.length = 0
|
|
|
+ },
|
|
|
+ getSchoolBaseInfo() {
|
|
|
+ this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(
|
|
|
+ (res) => {
|
|
|
+ if (res.code == 2) {
|
|
|
+ alert('数据为空!')
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ alert('API error!')
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ selectSubject(index) {
|
|
|
+ this.currentSubjectIndex = index
|
|
|
+ this.activeTab = this.evaluationInfo.testPaper[index].createType
|
|
|
+ },
|
|
|
+ checkData() {
|
|
|
+ let flag = true
|
|
|
+ this.$refs.evaluationInfo.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return flag
|
|
|
+ },
|
|
|
+ handleData() {
|
|
|
+ this.evaluationInfo.schoolCode = this.demoLoginInfo.schoolCode
|
|
|
+ let requestData = {
|
|
|
+ name: this.evaluationInfo.name,
|
|
|
+ scopeCode: this.demoLoginInfo.TEAMModelId,
|
|
|
+ createTime: Date.parse(new Date()),
|
|
|
+ target: this.evaluationInfo.target,
|
|
|
+ startTime: this.evaluationInfo.startTime,
|
|
|
+ endTime: this.evaluationInfo.endTime,
|
|
|
+ publish: this.evaluationInfo.publish,
|
|
|
+ type: this.evaluationInfo.type,
|
|
|
+ }
|
|
|
+ if (this.examInfo.id != undefined) {
|
|
|
+ requestData.id = this.examInfo.id
|
|
|
+ } else if (this.evaluationInfo.id != undefined) {
|
|
|
+ requestData.id = this.evaluationInfo.id
|
|
|
+ }
|
|
|
+ this.$api.learnActivity.SaveExamInfo(requestData).then(
|
|
|
+ res => {
|
|
|
+ if (res.error == null) {
|
|
|
+ this.examInfo = res.result.data
|
|
|
+ for (let index in this.evaluationInfo.testPaper) {
|
|
|
+ this.saveTestPaper(this.evaluationInfo.testPaper[index], index)
|
|
|
+ }
|
|
|
+ //this.$Message.success('保存成功!')
|
|
|
+ this.goToManageStatus = true
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
|
|
|
- }
|
|
|
- )
|
|
|
- },
|
|
|
- saveTestPaper(testPaper, index) {
|
|
|
- if (this.examInfo.id == undefined) {
|
|
|
- this.saveEvaluation()
|
|
|
- } else {
|
|
|
- let requestData = {
|
|
|
- id: testPaper.id == undefined ? null : testPaper.id,
|
|
|
- scopeCode: this.examInfo.id,
|
|
|
- schoolCode: this.demoLoginInfo.schoolCode,
|
|
|
- subjectCode: testPaper.subjectCode,
|
|
|
- periodCode: testPaper.periodCode,
|
|
|
- item: testPaper.item,
|
|
|
- score: testPaper.score
|
|
|
- }
|
|
|
- this.$api.learnActivity.SaveExamPaper(requestData).then(
|
|
|
- res => {
|
|
|
- if (res.error == null) {
|
|
|
- this.evaluationInfo.testPaper[index].id = res.result.data.id
|
|
|
- } else {
|
|
|
- this.$Message.error('API ERROR!')
|
|
|
- }
|
|
|
+ }
|
|
|
+ )
|
|
|
},
|
|
|
- err => {
|
|
|
- this.$Message.error('API ERROR!')
|
|
|
+ saveTestPaper(testPaper, index) {
|
|
|
+ if (this.examInfo.id == undefined) {
|
|
|
+ this.saveEvaluation()
|
|
|
+ } else {
|
|
|
+ let requestData = {
|
|
|
+ id: testPaper.id == undefined ? null : testPaper.id,
|
|
|
+ scopeCode: this.examInfo.id,
|
|
|
+ schoolCode: this.demoLoginInfo.schoolCode,
|
|
|
+ subjectCode: testPaper.subjectCode,
|
|
|
+ periodCode: testPaper.periodCode,
|
|
|
+ item: testPaper.item,
|
|
|
+ score: testPaper.score
|
|
|
+ }
|
|
|
+ this.$api.learnActivity.SaveExamPaper(requestData).then(
|
|
|
+ res => {
|
|
|
+ if (res.error == null) {
|
|
|
+ this.evaluationInfo.testPaper[index].id = res.result.data.id
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ saveEvaluation() {
|
|
|
+ if (this.checkData()) {
|
|
|
+ this.handleData()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$Message.error('请完善基础信息,再保存!')
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ addSubject() {
|
|
|
+ [...this.addSubjectBefore] = this.testSubjects
|
|
|
+ this.addSubjectStatus = true
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+
|
|
|
}
|
|
|
- )
|
|
|
- }
|
|
|
- },
|
|
|
- saveEvaluation() {
|
|
|
- if (this.checkData()) {
|
|
|
- this.handleData()
|
|
|
-
|
|
|
- } else {
|
|
|
- this.$Message.error('请完善基础信息,再保存!')
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- addSubject() {
|
|
|
- [...this.addSubjectBefore] = this.testSubjects
|
|
|
- this.addSubjectStatus = true
|
|
|
- },
|
|
|
- cancel() {
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ let routerData = this.$route.params.evaluationInfo
|
|
|
+ if (routerData !== undefined) {
|
|
|
+ for (let i = 0; i < routerData.testPaper.length; i++) {
|
|
|
+ routerData.testPaper[i].createType = 'auto'
|
|
|
+ }
|
|
|
+ this.evaluationInfo = routerData
|
|
|
+ this.activeTab = 'preview'
|
|
|
+ }
|
|
|
+ this.getSchoolBaseInfo()
|
|
|
+ this.questionList = questions.result.data
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- let routerData = this.$route.params.evaluationInfo
|
|
|
- if (routerData !== undefined) {
|
|
|
- for (let i = 0; i < routerData.testPaper.length; i++) {
|
|
|
- routerData.testPaper[i].createType = 'auto'
|
|
|
}
|
|
|
- this.evaluationInfo = routerData
|
|
|
- this.activeTab = 'preview'
|
|
|
- }
|
|
|
- //this.evaluationInfo = routerData == undefined ? this.evaluationInfo : routerData
|
|
|
- console.log(this.evaluationInfo)
|
|
|
- this.getSchoolBaseInfo()
|
|
|
- this.questionList = questions.result.data
|
|
|
- },
|
|
|
- mounted() {
|
|
|
-
|
|
|
}
|
|
|
- }
|
|
|
</script>
|
|
|
<style scoped lang="less">
|
|
|
- @import "./CreateEvaluation.less";
|
|
|
+ @import "./CreateEvaluation.less";
|
|
|
</style>
|
|
|
<style>
|
|
|
- .evaluation-attr-form .ivu-input, .evaluation-attr-form .ivu-select-selection {
|
|
|
- background: none;
|
|
|
- color: white;
|
|
|
- border-color: #999999;
|
|
|
- font-size:16px;
|
|
|
- }
|
|
|
+ .evaluation-attr-form .ivu-input, .evaluation-attr-form .ivu-select-selection {
|
|
|
+ background: none;
|
|
|
+ color: white;
|
|
|
+ border-color: #999999;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
|
|
|
- .evaluation-attr-form .ivu-input {
|
|
|
- /*border:none;
|
|
|
+ .evaluation-attr-form .ivu-input {
|
|
|
+ /*border:none;
|
|
|
border-bottom:1px solid #424242;
|
|
|
border-radius:0px;*/
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ .evaluation-attr-wrap .ivu-form .ivu-form-item-label {
|
|
|
+ color: #a5a5a5;
|
|
|
+ }
|
|
|
|
|
|
- .evaluation-attr-wrap .ivu-form .ivu-form-item-label {
|
|
|
- color: #a5a5a5;
|
|
|
- }
|
|
|
+ .evaluation-question-main .ivu-tabs-bar {
|
|
|
+ border-color: #404040;
|
|
|
+ }
|
|
|
|
|
|
- .evaluation-question-main .ivu-tabs-bar {
|
|
|
- border-color: #404040;
|
|
|
- }
|
|
|
+ .evaluation-question-main .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab {
|
|
|
+ border: none;
|
|
|
+ background-color: #303030;
|
|
|
+ color: white;
|
|
|
+ margin-right: 2px;
|
|
|
+ }
|
|
|
|
|
|
- .evaluation-question-main .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab {
|
|
|
- border: none;
|
|
|
- background-color: #303030;
|
|
|
- color: white;
|
|
|
- margin-right: 2px;
|
|
|
- }
|
|
|
+ .evaluation-question-main .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab-active {
|
|
|
+ background-color: #404040;
|
|
|
+ color: white;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
|
|
|
- .evaluation-question-main .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab-active {
|
|
|
- background-color: #404040;
|
|
|
- color: white;
|
|
|
- font-weight:600;
|
|
|
- }
|
|
|
- .evaluation-question-main .ivu-tabs .ivu-tabs-content-animated {
|
|
|
- height:100%;
|
|
|
- }
|
|
|
- .evaluation-question-main .ivu-tabs-bar {
|
|
|
- margin-bottom:0px;
|
|
|
- }
|
|
|
+ .evaluation-question-main .ivu-tabs .ivu-tabs-content-animated {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .evaluation-question-main .ivu-tabs-bar {
|
|
|
+ margin-bottom: 0px;
|
|
|
+ }
|
|
|
</style>
|