Sfoglia il codice sorgente

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

zhouj1203@hotmail.com 4 anni fa
parent
commit
5c14527bc4

+ 6 - 1
TEAMModelOS/ClientApp/src/api/studentWeb.js

@@ -149,6 +149,11 @@ export default {
     //查询学生的评量数据
     FindStudentPaper: function (data) {
         return post('/school/exam/find-summary-by-student', data)
-    }
+    },
+    //保存学生评量数据
+    SaveStuExamPaper: function (data) {
+        return post('/school/exam/upsert-record', data)
+    },
+
 }
 

+ 78 - 70
TEAMModelOS/ClientApp/src/common/BaseSelectSchool.vue

@@ -1,25 +1,25 @@
 <template>
 	<div class="base-school-select">
-			<div v-if="!user.schools.length">暂未加入学校</div>
-			<Dropdown @on-click="onSchoolSelect" v-else>
-				<img class="school-logo" :src="curSchool.logo || defaultLogo" />
-				<a href="javascript:void(0)" :class="['base-user-post', user.schools.length === 1 ? 'single-school' : '']">
-					{{ curSchool.name }}
-					<Icon type="ios-arrow-down"></Icon>
-				</a>
-				<DropdownMenu slot="list">
-					<div v-for="(item,index) in user.schools" :key="index">
-						<DropdownItem :name="index">
-							<div class="school-item">
-								<img :src="item.logo || defaultLogo" alt="">
-								<span>{{ item.name }}</span>
-							</div>
-						</DropdownItem>
-					</div>
-
-				</DropdownMenu>
-			</Dropdown>
-		</div>
+		<div v-if="!user.schools.length">暂未加入学校</div>
+		<Dropdown @on-click="onSchoolSelect" v-else>
+			<img class="school-logo" :src="curSchool.logo || defaultLogo" />
+			<a href="javascript:void(0)" :class="['base-user-post', user.schools.length === 1 ? 'single-school' : '']">
+				{{ curSchool.name }}
+				<Icon type="ios-arrow-down"></Icon>
+			</a>
+			<DropdownMenu slot="list">
+				<div v-for="(item,index) in user.schools" :key="index">
+					<DropdownItem :name="index">
+						<div class="school-item">
+							<img :src="item.logo || defaultLogo" alt="">
+							<span>{{ item.name }}</span>
+						</div>
+					</DropdownItem>
+				</div>
+
+			</DropdownMenu>
+		</Dropdown>
+	</div>
 	</div>
 </template>
 
@@ -28,11 +28,11 @@
 		data() {
 			return {
 				curSchool: {
-					logo:''
+					logo: ''
 				},
-				defaultLogo:'',
-				user:{
-					schools:[]
+				defaultLogo: '',
+				user: {
+					schools: []
 				}
 			}
 		},
@@ -40,27 +40,34 @@
 			this.defaultLogo = require('@/assets/icon/default_school.png')
 			// 获取本地存储中的 用户信息
 			let user = JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8"));
-			console.log(user)
-			if(user.schools){
+			let school = JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8"));
+
+			let schools = user.schools.filter(i => i.status === 'join')
+			this.user.schools = schools
+			// 如果本地存储已经有保存学校信息 则刷新后会直接读取之前的学校信息
+			if (school) {
+				this.curSchool = schools.filter(i => i.schoolId === school.school_base.id)[0]
+				this.$store.commit('setSchoolCode', this.curSchool.schoolId)
+			} else if (user.schools) {
 				// 拿到用户管理的schools 必须是已加入的学校
-				let schools = user.schools.filter(i => i.status === 'join')
-				if(schools.length){
-					this.user.schools = schools
+				if (schools.length) {
 					this.curSchool = user.defaultschool ? schools.filter(i => i.schoolId === user.defaultschool)[0] : schools[0]
 					this.$store.commit('setSchoolCode', this.curSchool.schoolId)
 				}
-			}else{
+			} else {
 				this.$Message.warning('用户暂无学校列表数据')
 			}
 		},
 		methods: {
-			async onSchoolSelect(val){
-				this.$EventBus.$emit('onGlobalLoading',true)
+			async onSchoolSelect(val) {
+				this.$EventBus.$emit('onGlobalLoading', true)
 				this.curSchool = this.user.schools[val]
 				let schoolCode = this.user.schools[val].schoolId
 				let schoolInfo = await this.getTeacherSchoolInfo(schoolCode)
-				this.$store.commit('setSchoolCode',schoolCode)
-				this.$store.commit('schoolBaseInfo/setSchoolInfo',{ period:[] })
+				this.$store.commit('setSchoolCode', schoolCode)
+				this.$store.commit('schoolBaseInfo/setSchoolInfo', {
+					period: []
+				})
 				this.$store.commit('schoolBaseInfo/setClassroomList', undefined)
 				this.$store.dispatch('user/setSchoolCode', schoolCode)
 				this.$store.dispatch('user/setSchoolProfile', schoolInfo)
@@ -68,16 +75,16 @@
 				console.log(this.$store.state)
 				console.log(JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")))
 				setTimeout(() => {
-					this.$EventBus.$emit('onGlobalLoading',false)
-				},500)
+					this.$EventBus.$emit('onGlobalLoading', false)
+				}, 500)
 				this.$router.push({
-					name:'home'
+					name: 'home'
 				})
 			},
-			
+
 			/* 获取老师所在学校的信息 */
 			getTeacherSchoolInfo(code) {
-				return new Promise((r,j) => {
+				return new Promise((r, j) => {
 					this.$api.schoolSetting.getTeacherSchoolInfo({
 						id_token: localStorage.getItem('id_token'),
 						school_code: code
@@ -94,21 +101,22 @@
 				})
 			},
 		},
-		
+
 		mounted() {
-			this.$EventBus.$on('onChangeSchool',params => {
-				if(params.schoolCode !== this.curSchool.schoolId){
+			this.$EventBus.$on('onChangeSchool', params => {
+				if (params.schoolCode !== this.curSchool.schoolId) {
 					console.log('检测到切换学校')
 					console.log(params)
 					this.user = params.user
-					this.curSchool = params.user.defaultschool ? params.user.schools.filter(i => i.schoolId === params.user.defaultschool)[0] : params.user.schools[0]
+					this.curSchool = params.user.defaultschool ? params.user.schools.filter(i => i.schoolId === params.user.defaultschool)[
+						0] : params.user.schools[0]
 					this.onSchoolSelect(params.user.schools.map(i => i.schoolId).indexOf(params.schoolCode))
 				}
 			})
 		},
 
 		computed: {
-			
+
 		}
 	}
 </script>
@@ -116,57 +124,57 @@
 <style lang="less">
 	.base-school-select {
 		font-family: '微軟正黑體', 'Heiti TC' !important;
-		
-		.ivu-dropdown{
-			
-			.ivu-dropdown-item:hover{
+
+		.ivu-dropdown {
+
+			.ivu-dropdown-item:hover {
 				background: #83d7ff;
 			}
-			
-			a{
-				color:var(--primary-textColor) !important;
-				
-				&:hover{
-					color:var(--primary-textColor) !important;
+
+			a {
+				color: var(--primary-textColor) !important;
+
+				&:hover {
+					color: var(--primary-textColor) !important;
 				}
-				
-				.ivu-icon{
+
+				.ivu-icon {
 					display: none;
 				}
-				
-				&::after{
+
+				&::after {
 					content: '';
 					display: inline-block;
 					width: 0;
 					height: 0;
-					border-right:solid 8px transparent;
-					border-left:solid 8px transparent ;
-					border-top:solid 8px #d0d0d0;
+					border-right: solid 8px transparent;
+					border-left: solid 8px transparent;
+					border-top: solid 8px #d0d0d0;
 					margin-left: 8px;
 					margin-bottom: 3px;
 				}
 			}
 		}
-		
-		.single-school{
-			&::after{
+
+		.single-school {
+			&::after {
 				display: none !important;
 			}
 		}
-		
-		.school-logo{
+
+		.school-logo {
 			width: 30px;
 			border-radius: 50%;
 			margin-right: 10px;
 			margin-bottom: 5px;
 			vertical-align: middle;
 		}
-		
-		.school-item{
+
+		.school-item {
 			display: flex;
 			align-items: center;
-			
-			img{
+
+			img {
 				width: 30px;
 				margin-right: 15px;
 			}

+ 0 - 1
TEAMModelOS/ClientApp/src/common/BaseUserPoptip.vue

@@ -137,7 +137,6 @@
                 containerClient.getSize().then(
                     res => {
                         this.sizeInfo = res
-                        console.log(res)
                     },
                     err => {
                         this.$Message.error('空间计算异常')

+ 2 - 3
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwForm.vue

@@ -82,8 +82,7 @@
             <ChooseContent :showSyllabus="isFalse"
                            :showOther="isFalse"
                            :showQuestion="isFalse"
-                           @on-select-file="onSelectFile"
-                           @on-cancel-file="onSelectFile"></ChooseContent>
+                           @on-file-change="onSelectFile"></ChooseContent>
 
             <Button class="modal-btn" :loading="isLoading" @click="onConfirmRelate">确认</Button>
         </Modal>
@@ -92,7 +91,7 @@
 <script>
     import E from '@/utils/wangEditor.js'
     import UploadFile from '@/common/UploadFile.vue'
-    import ChooseContent from '@/components/learnactivity/ChooseContent'
+    import ChooseContent from '@/components/learnactivity/NewChooseContent'
     export default {
         props: {
             editItem: {

+ 69 - 57
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/LessonTestPop.vue

@@ -90,13 +90,6 @@
             myTestProgresstitleEn:
               this.$store.getters.getCurrentLaguage == 'en',
           }">{{ $t("studentWeb.exam.testpop.completion") }}</span>
-                <!--<span
-                  class="myTestProgressNum"
-                  :class="{
-                    myTestProgressNumEn: this.$store.getters.getCurrentLaguage == 'en',
-                  }"
-                  >{{ (10 - undo) * 10 + " % " }}</span
-                >-->
                 <div class="myTestProgressContent"
                      :style="{ width: (10 - undo) * 10 + '%' }"></div>
                 <div class="myTestProgress"></div>
@@ -172,7 +165,7 @@
                         </ul>
                     </div>
                     <div class="questionType">
-                        {{ getQuestionData(currentQuestionNo).type + "題" }}
+                        {{ getTestType(getQuestionData(currentQuestionNo).type)}}
                     </div>
                     <!--//题目渲染-->
                     <div class="questioDes">
@@ -180,8 +173,6 @@
                             <span>{{ currentQuestionNo +1 }}.</span>
                            <div v-html="getQuestionData(currentQuestionNo).question"></div>
                         </div>
-
-
                         <!--填充題輸入匡-->
                         <input v-if="getQuestionData(currentQuestionNo).qType == '填充'"
                                type="text"
@@ -548,7 +539,33 @@
                 currentFilterQuestion: "all",
                 showtheAnsTable: false,
                 paperInfo: {},
-                paperData: {}
+                paperData: {},
+                testType: [
+                    {
+                        label: "单选题",
+                        value:"single"
+                    },
+                    {
+                        label: "多选题",
+                        value:"multiple"
+                    },
+                    {
+                        label: "判断题",
+                        value:"judge"
+                    },
+                    {
+                        label: "填空题",
+                        value:"complete"
+                    },
+                    {
+                        label: "问答题",
+                        value:"subjective"
+                    },
+                    {
+                        label: "综合题",
+                        value:"compose"
+                    },
+                ]
             };
         },
         methods: {
@@ -570,14 +587,22 @@
                 }
             },
             getAns(data, index) {
-                console.log(data, index)
-                console.log(this.paperInfo)
-                console.log(this.paperData)
+                console.log(this.paperData.stuAns[data])
+                if (this.paperInfo.item[data].type != "multiple") {
+                    this.paperData.stuAns[data] = []
+                } 
                 if (index) {
                     this.paperData.stuAns[data].push(this.paperInfo.item[data].option[index].code)
                 }
                 console.log(this.paperData.stuAns)
             },
+            getTestType(data) {
+                for (let item of this.testType) {
+                    if (item.value == data) {
+                        return item.label
+                    }
+                }
+            },
             transQtypetoEn(Qtype) {
                 if (localStorage.getItem("lang") == "en") {
                     if (Qtype == "單選") {
@@ -688,53 +713,40 @@
             closetest: function () {
                 this.WarmMessageisOpen = false;
                 this.showtheAnsTable = false;
-
-                if (this.showMessageNum == 2) {
-                    let multiSubject = ["國文", "英文", "數學"];
-                    console.log(
-                        "完成測驗",
-                        this.$store.getters.getCurrentSubject,
-                        multiSubject.includes(this.$store.getters.getCurrentSubject)
-                    );
-
-                    if (
-                        multiSubject.includes(this.$store.getters.getCurrentSubject) == false
-                    ) {
-                        this.$store.commit(
-                            "SavefinishedItemID",
-                            this.$store.getters.getItemTitle.eventID
-                        );
-                        this.$emit("isHintNextItem", true); //傳回父組件,通知已經完成本次測驗,可以提示下一個活動為何
-                    }
-                    if (
-                        multiSubject.includes(this.$store.getters.getCurrentSubject) == true
-                    ) {
-                        this.$store.commit(
-                            "SavefinishedSubject",
-                            this.$store.getters.getCurrentSubject
-                        );
-                        if (
-                            this.$store.getters.getCurrentfinishedSubject.length ==
-                            multiSubject.length
-                        ) {
-                            this.$store.commit(
-                                "SavefinishedItemID",
-                                this.$store.getters.getItemTitle.eventID
-                            );
-                            this.$emit("isHintNextItem", true); //傳回父組件,通知已經完成本次測驗,可以提示下一個活動為何
+                if (this.paperData.stuAns.length) {
+                    let len = 0
+                    for (let item of this.paperData.stuAns) {
+                        if (item.length !== 0) {
+                            len++
                         }
                     }
-                }
-                this.doAjax();
+                    if (len = this.paperInfo.item.length) {
+                        this.summit();
+                    } else{
+                        this.$Message.warning('请完成作答再提交!')
+                    }
+                } 
             },
-            doAjax() {
+            summit() {
                 this.isLoading = true;
-
-                // simulate AJAX
-                setTimeout(() => {
-                    this.$store.commit("ToggleLessonTestPopWithSubject", "");
-                    this.isLoading = false;
-                }, 2000);
+                let req = {
+                    id: this.paperInfo.id,
+                    answer: this.paperData.stuAns,
+                    studentId:this.$store.state.userInfo.sub,
+                    classId: this.$store.state.user.studentProfile.classinfo.id,
+                    subjectId: this.paperInfo.subjectId,
+                    multipleRule: this.paperData.multipleRule,
+                    paperId: this.paperData.paperId,
+                    school: this.paperInfo.code
+                }
+                this.$api.studentWeb.SaveStuExamPaper(req).then(res => {
+                    if (res) {
+                        setTimeout(() => {
+                            this.$store.commit("ToggleLessonTestPopWithSubject", "");
+                            this.isLoading = false;
+                        }, 2000);
+                    }
+                })
             },
         },
     };

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/bank/ExerciseList.vue

@@ -68,7 +68,7 @@
 					<Radio label="createTime">新增时间
 						<Icon type="md-arrow-round-down" />
 					</Radio>
-					<Radio label="usageCount">使用次数
+					<Radio label="useCount">使用次数
 						<Icon type="md-arrow-round-down" />
 					</Radio>
 				</RadioGroup>

+ 1 - 2
TEAMModelOS/ClientApp/src/view/evaluation/bank/TestPaperList.vue

@@ -98,9 +98,8 @@
             },
 
             onFilterChange(filterParams, findCountParams) {
-
                 this.filterParams = {
-                    // '@DESC': this.filterSort,
+                    '@DESC': filterParams.filterSort,
                     'code': filterParams.code,
 					'scope': filterParams.code === this.$store.state.userInfo.schoolCode ? 'school' : 'private',
                     'periodId': filterParams.periodId[0],

+ 0 - 1
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseChild.vue

@@ -86,7 +86,6 @@
 		watch: {
 			children:{
 				handler(n){
-					console.log(n)
 					this.$nextTick(()=>{
 						window.MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
 					})

+ 5 - 3
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseCreateChild.vue

@@ -83,8 +83,10 @@
 		<!-- 关联内容弹窗 -->
 		<Modal v-model="isRelatedContent" width="880" footer-hide class="relate-modal related-modal">
 			<div class="modal-header" slot="header">内容关联</div>
-			<ChooseContent :showSyllabus="isFalse" :showOther="isFalse" :showQuestion="isFalse" v-if="isRelatedContent"
-			 @on-select-file="onSelectFile" @on-cancel-file="onSelectFile"></ChooseContent>
+			<ChooseContent :showSyllabus="isFalse"
+			               :showOther="isFalse"
+			               :showQuestion="isFalse"
+			               @on-file-change="onSelectFile"></ChooseContent>
 
 			<Button class="modal-btn" :loading="isLoading" @click="onConfirmRelate">确认</Button>
 		</Modal>
@@ -113,7 +115,7 @@
 	import BaseSubjective from '@/view/evaluation/types/BaseSubjective.vue'
 	import BasePoints from '@/view/evaluation/components/BasePoints'
 	import BaseRepair from '@/view/evaluation/components/BaseRepair'
-	import ChooseContent from '@/components/learnactivity/ChooseContent'
+	import ChooseContent from '@/components/learnactivity/NewChooseContent'
 	import E from '@/utils/wangEditor.js'
 	// 默认创建题目模板
 	const defaultExercise = {

+ 1 - 3
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseEditExercise.vue

@@ -156,7 +156,6 @@
 	import BaseRepair from '@/view/evaluation/components/BaseRepair'
 	import BaseCreateChild from '@/view/evaluation/components/BaseCreateChild'
 	import BaseChildList from '@/view/evaluation/components/BaseChildList'
-	import ChooseContent from '@/components/learnactivity/ChooseContent'
 	import E from '@/utils/wangEditor.js'
 
 	export default {
@@ -172,8 +171,7 @@
 			BasePoints,
 			BaseCreateChild,
 			BaseChildList,
-			BaseRepair,
-			ChooseContent
+			BaseRepair
 		},
 		data() {
 			return {

+ 2 - 1
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseFilter.vue

@@ -32,7 +32,7 @@
             <span class="filter-title">排序:</span>
             <RadioGroup v-model="filterSort" type="button" @on-change="filterSortChange">
                 <Radio label="createDate">新增时间<Icon type="md-arrow-round-down" /></Radio>
-                <Radio label="usageCount">使用次数<Icon type="md-arrow-round-down" /></Radio>
+                <Radio label="useCount">使用次数<Icon type="md-arrow-round-down" /></Radio>
             </RadioGroup>
         </div>
     </div>
@@ -121,6 +121,7 @@
             doFilter() {
                 /** 定义查询接口的参数规格 */
                 this.filterParams = {
+					'filterSort': this.filterSort,
                     'code': this.filterOrigin,
                     'periodId': [this.periodList[this.filterPeriod].id],
                     'gradeIds': this.deleteFalse(this.filterGrade),

+ 10 - 7
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseRepair.vue

@@ -42,16 +42,15 @@
 		    <ChooseContent :showSyllabus="isFalse"
 		                   :showOther="isFalse"
 		                   :showQuestion="isFalse"
-						   v-if="isRelatedContent"
-		                   @on-select-file="onSelectFile"
-		                   @on-cancel-file="onSelectFile"></ChooseContent>
+						   ref="chooseContentRef"
+		                   @on-file-change="onSelectFile"></ChooseContent>
 		
 		    <Button class="modal-btn" :loading="isLoading" @click="onConfirmRelate">确认</Button>
 		</Modal>
 	</div>
 </template>
 <script>
-	import ChooseContent from '@/components/learnactivity/ChooseContent'
+	import ChooseContent from '@/components/learnactivity/NewChooseContent'
 	export default {
 		components: { ChooseContent },
 		props: {
@@ -70,7 +69,9 @@
 				relateFileList:[]
 			}
 		},
-		created() {},
+		created() {
+			
+		},
 		methods: {
 			onAddLink(type){
 				let addObj = {
@@ -97,7 +98,7 @@
 			onConfirmRelate() {
 				this.relateFileList.forEach(i => {
 					this.datas.push({
-						blobUrl:i.blobUrl,
+						blobUrl:i.url,
 						type:'file'
 					})
 				})
@@ -127,7 +128,9 @@
 		},
 
 		mounted() {
-
+			if(this.$refs.chooseContentRef){
+				this.$refs.chooseContentRef.clickTab('content')
+			}
 		},
 
 		watch: {

+ 0 - 11
TEAMModelOS/ClientApp/src/view/evaluation/index/CreateExercises.vue

@@ -127,15 +127,6 @@
 			</div>
 		</Modal>
 
-		<!-- 关联内容弹窗 -->
-		<Modal v-model="isRelatedContent" width="880" footer-hide class="relate-modal related-modal">
-			<div class="modal-header" slot="header">内容关联</div>
-			<!-- <ChooseContent :showSyllabus="isFalse" :showOther="isFalse" :showQuestion="isFalse" v-if="isRelatedContent"
-			 @on-select-file="onSelectFile" @on-cancel-file="onSelectFile"></ChooseContent> -->
-
-			<Button class="modal-btn" :loading="isLoading" @click="onConfirmRelate">确认</Button>
-		</Modal>
-
 		<!-- 添加小题弹窗 -->
 		<Modal v-model="addComposeChildModal" width="1080" footer-hide class="">
 			<div class="modal-header" slot="header">添加小题</div>
@@ -168,7 +159,6 @@
 	import BasePoints from '@/view/evaluation/components/BasePoints'
 	import BaseRepair from '@/view/evaluation/components/BaseRepair'
 	import BaseCreateChild from '@/view/evaluation/components/BaseCreateChild'
-	import ChooseContent from '@/components/learnactivity/ChooseContent'
 	import E from '@/utils/wangEditor.js'
 	// 默认创建题目模板
 	const defaultExercise = {
@@ -190,7 +180,6 @@
 			BaseCompose,
 			BasePoints,
 			BaseRepair,
-			ChooseContent,
 			BaseCreateChild
 		},
 		data() {

+ 2 - 2
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -79,10 +79,10 @@
 								</DropdownMenu>
 							</Dropdown>
 						</div>
-						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" @click="onShowAllAnalysis" v-show="currentQn.progress === 'finish' || currentQn.progress === 0">
+<!-- 						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" @click="onShowAllAnalysis" v-show="currentQn.progress === 'finish' || currentQn.progress === 0">
 							<Icon type="md-podium" color="#dcdcdc" />
 							<span>查看统计数据</span>
-						</div>
+						</div> -->
 						<div class="qn-box-header-tools-tool" @click="onEditQn" v-show="currentQn.progress === 'pending' && qnList.length && !editable">
 							<Icon type="md-create" color="#209460" />
 							<span>编辑问卷</span>