Explorar el Código

add:活动记录跳转后的呈现

OnePsycho hace 3 años
padre
commit
5288cc6f8d

+ 26 - 6
TEAMModelOS/ClientApp/src/view/homework/ManageHomeWork.vue

@@ -224,6 +224,7 @@
 		},
 		data() {
 			return {
+				routerAc:null,
 				previewStatus:false,
 				previewFile:null,
 				editTime:null,
@@ -266,7 +267,6 @@
 		},
 		created(){
 			this.targetId = this.$route.params.id || null
-			console.log(this.$route.query)
 		},
 		methods: {
 			/* 编辑活动结束时间或者名字 */
@@ -461,6 +461,25 @@
 					this.$refs.baseQnRef && this.$refs.baseQnRef.scrollIntoView()
 				})
 			},
+			async handleTabClick(){
+				if(this.$route.params.ac){
+					let item = this.$route.params.ac
+					let fullItem = item.id ? await this.getVoteDetails(item) : item
+					if(!fullItem.id) return
+					this.currentVote = fullItem
+					this.activeVoteIndex = 0
+					this.voteList = [fullItem]
+					this.isAddActivity = false
+					/* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
+					if (item.id && item.progress !== 'pending') {
+						this.getVoteStudents(fullItem, fullItem.classes)
+					}
+					this.hasNewAdd = false
+					this.isOptionView = true
+				}else{
+					this.getVoteList()
+				}
+			},
 			/** 获取作业列表 */
 			getVoteList(type) {
 				this.isLoadList = true
@@ -472,7 +491,7 @@
 						if (res.homeworks.length) {
 							let list = res.homeworks.reverse()
 							this.voteList = list
-							let queryId = this.$route.query.acId || this.targetId
+							let queryId = this.routerAc ? this.routerAc.id : this.targetId
 							if (queryId && list.filter(i => i.id === queryId).length === 0) {
 								this.$Modal.confirm({
 									title: this.$t('survey.questionaire.confirmTitle'),
@@ -486,7 +505,7 @@
 							}
 							let queryVote = queryId && list.find(i => i.id === queryId) ? list.find(i => i.id === queryId) : list[0]
 							let queryIndex = queryId ? list.indexOf(queryVote) : 0
-							this.isFromRecord = Boolean(this.$route.query.acId)
+							this.isFromRecord = Boolean(this.routerAc)
 							this.onVoteClick(queryVote, queryIndex, false)
 						} else {
 							this.voteList = []
@@ -515,7 +534,7 @@
 			/* 作业点击事件 */
 			async onVoteClick(item, index, needJudge = true) {
 				console.log('点击的活动',item);
-				if(!this.$route.query.acId){
+				if(!this.routerAc){
 					this.isFromRecord = false
 					this.split1 = 0.2
 					this.split2 = 0
@@ -808,11 +827,12 @@
 			}
 		},
 		mounted() {
-			if (this.$route.query.acId) {
+			if (this.$route.params.ac) {
 				this.isFromRecord = true
 				this.split1 = 0
 				this.split2 = 0.3
 				this.$refs.leftSplit.$el.getElementsByClassName('ivu-split-trigger-con')[0].style.display = 'none'
+				this.routerAc = this.$route.params.ac
 			}
 			// this.getMyCourse()
 		},
@@ -846,7 +866,7 @@
 		watch: {
 			$route: {
 				handler: function(to, from) {
-					this.getVoteList()
+					this.handleTabClick()
 				},
 				immediate: true
 			}

+ 9 - 9
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -1834,25 +1834,25 @@ export default {
                     break
                 case 'vote':
                     this.$router.push({
-                        path: owner == 'school' ? '/home/manageVote' : '/home/personalVote',
-                        query: {
-                            acId: acId
+                        name: owner == 'school' ? 'manageVote' : 'personalVote',
+                        params: {
+                            ac:this.acList[index]
                         }
                     })
                     break
                 case 'qu':
                     this.$router.push({
-                        path: owner == 'school' ? '/home/manageQuestionnaire' : '/home/personalSurvey',
-                        query: {
-                            acId: acId
+                        name: owner == 'school' ? 'manageQuestionnaire' : 'personalSurvey',
+                        params: {
+                            ac:this.acList[index]
                         }
                     })
                     break
                 case 'hw':
                     this.$router.push({
-                        path: '/home/manageHomeWork',
-                        query: {
-                            acId: acId
+                        name: 'manageHomeWork',
+                        params: {
+                            ac:this.acList[index]
                         }
                     })
                     break

+ 29 - 18
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -1,12 +1,6 @@
 <template>
 	<div class="qn-container">
 		<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
-		<div class="qn-header" style="display: none">
-			<div>
-				<span :class="tabIndex == 0 ? 'tab-active' : ''" @click="handleTabClick(0)">校本问卷</span>
-				<span :class="tabIndex == 1 ? 'tab-active' : ''" @click="handleTabClick(1)">个人问卷</span>
-			</div>
-		</div>
 		<div class="qn-box dark-iview-split">
 			<Split v-model="split1" ref="leftSplit">
 				<div slot="left" class="demo-split-pane">
@@ -229,6 +223,7 @@
 		},
 		data() {
 			return {
+				routerAc:null,
 				editTime:null,
 				editTimeStatus:false,
 				editNameStatus:false,
@@ -367,8 +362,30 @@
 			// 校本课纲与个人课纲切换
 			handleTabClick(index) {
 				this.tabIndex = index;
-				setTimeout(() => {
-					this.getQnList(index === 0 ? "school" : "private");
+				setTimeout(async () => {
+					if(this.$route.params.ac){
+						let item = this.routerAc
+						this.currentQn = await this.getQnDetails(item);
+						this.currentQn.progress = item.progress;
+						this.qnList = [this.currentQn]
+						if (this.currentQn.targetType === 'research') {
+							this.getSurveyTchList(this.currentQn)
+						} else {
+							this.getSurveyStusByClassId(this.currentQn)
+						}
+						if (item.progress === 'pending') {
+							this.onChangeResultTab('result')
+						} else {
+							this.onChangeResultTab('progress')
+						}
+						this.activeQnIndex = 0;
+						this.$refs.qnForm.qnFormEdit = false;
+						this.editable = false;
+						this.hasModify = false
+						this.isEmptyData = false;
+					}else{
+						this.getQnList(index === 0 ? "school" : "private");
+					}
 				}, 500)
 			},
 
@@ -466,7 +483,7 @@
 						let list = res.surveys.reverse();
 						this.qnList = list;
 						if (list.length) {
-							let queryId = this.$route.query.acId
+							let queryId = this.routerAc ? this.routerAc.id : null
 							// 如果从活动记录跳转过来找不到对应活动
 							if (queryId && list.filter(i => i.id === queryId).length === 0) {
 								this.$Modal.confirm({
@@ -565,7 +582,7 @@
 			 * @param index
 			 */
 			async onQnClick(item, index) {
-				if (!this.$route.query.acId) {
+				if (!this.routerAc) {
 					this.isFromRecord = false
 					this.split1 = 0.2
 					this.split2 = 0.35
@@ -590,12 +607,6 @@
 					this.areaSchIndex = 0
 					this.areaSchList = this.areaRecord.map(i => i.name)
 					this.areaRecord.length && this.getAreaRecord(0)
-					// let schoolTeachers = await this.getAreaSurveyTeachers(item.id)
-					// schoolTeachers.forEach(i => {
-					// 	this.areaSurveyTeachers.push(...i.teachers)
-					// })
-					// console.log('xxxxxxx', this.areaSurveyTeachers)
-					// this.currentQn.teachers = this.areaSurveyTeachers
 				} else {
 					if (item.id) {
 						if (this.currentQn.targetType === 'research') {
@@ -606,7 +617,6 @@
 					}
 				}
 
-
 				if (item.progress === 'pending') {
 					this.onChangeResultTab('result')
 				} else {
@@ -1319,11 +1329,12 @@
 			}
 		},
 		mounted() {
-			if (this.$route.query.acId) {
+			if (this.$route.params.ac) {
 				this.isFromRecord = true
 				this.split1 = 0
 				this.split2 = 0.3
 				this.$refs.leftSplit.$el.getElementsByClassName('ivu-split-trigger-con')[0].style.display = 'none'
+				this.routerAc = this.$route.params.ac
 			}
 		},
 		computed: {

+ 1 - 0
TEAMModelOS/ClientApp/src/view/vote/ManageVote.less

@@ -89,6 +89,7 @@
 
                 &-tool {
                     cursor: pointer;
+					margin-left: 5px;
                 }
 				
 				.btn-save{

+ 71 - 6
TEAMModelOS/ClientApp/src/view/vote/ManageVote.vue

@@ -101,6 +101,10 @@
 												<Icon type="md-podium" />
 												{{ isOptionView ? $t('vote.stuListView') : $t('vote.optionView') }}
 											</span>
+											<span class="hw-box-header-tools-tool" @click="isShowDetail = true" v-if="isFromRecord">
+												<Icon type="md-information-circle" size="18" />
+												{{ $t('vote.voteDetails') }}
+											</span>
 										</div>
 									</div>
 								</div>
@@ -130,6 +134,31 @@
 				</div>
 			</Split>
 		</div>
+		<Drawer :title="$t('vote.voteDetails')" v-model="isShowDetail" width="400" :inner="true" :transfer="false">
+			<!-- <BaseHwForm :editItem="currentVote" @onAddSuccess="onAddSuccess" ref="voteForm" @onCancelVote="onCancelVote"></BaseHwForm> -->
+			<div class="activity-info-item">
+				<p class="activity-info-item-title">{{ $t('vote.form.name') }}</p>
+				<p class="activity-info-item-content">{{ currentVote.name }}</p>
+			</div>
+			<div class="activity-info-item">
+				<p class="activity-info-item-title">{{ $t('learnActivity.createEv.startTime') }}</p>
+				<p class="activity-info-item-content">{{ $tools.formatTime(currentVote.startTime,'yyyy-MM-dd hh:mm') }}
+				</p>
+			</div>
+			<div class="activity-info-item">
+				<p class="activity-info-item-title">{{ $t('learnActivity.createEv.endTime') }}</p>
+				<p class="activity-info-item-content">{{ $tools.formatTime(currentVote.endTime,'yyyy-MM-dd hh:mm') }}
+				</p>
+			</div>
+			<div class="activity-info-item">
+				<p class="activity-info-item-title">{{ $t('vote.form.description') }}</p>
+				<p class="activity-info-item-content" v-html="currentVote.description"></p>
+			</div>
+			<div class="activity-info-item">
+				<p class="activity-info-item-title">{{ $t('homework.form.other') }}</p>
+				<Tag color="geekblue" v-if="currentVote.secret">{{ $t('vote.secret') }}</Tag>
+			</div>
+		</Drawer>
 		<!-- 修改活动结束时间 -->
 		<Modal v-model="editTimeStatus" footer-hide className="ed-name-modal">
 		    <div slot="header" class="modal-header">
@@ -174,6 +203,8 @@
 		},
 		data() {
 			return {
+				isShowDetail:false,
+				routerAc:null,
 				isAddActivity:false,
 				editTime:null,
 				editTimeStatus:false,
@@ -307,8 +338,42 @@
 			// 校本课纲与个人课纲切换
 			handleTabClick(index) {
 				this.tabIndex = index
-				setTimeout(() => {
-					this.getVoteList(index === 0 ? 'school' : 'private')
+				setTimeout(async () => {
+					if(this.$route.params.ac){
+						let item = this.$route.params.ac
+						let fullItem = item.id ? await this.getVoteDetails(item) : item
+						this.currentVote = fullItem
+						this.activeVoteIndex = 0
+						this.voteList = [fullItem]
+						/* 如果是区级的活动 则需要根据recordUrl去换取区级活动的作答数据 */
+						if (this.isAreaVote && item.id) {
+							this.areaVoteTeachers = []
+							this.areaSchIndex = 0
+							this.areaSchList = this.areaRecord.map(i => i.name)
+							this.areaRecord.length && this.getAreaRecord(0)
+						}else{
+							/* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
+							if (item.id && item.progress !== 'pending'){
+								if(fullItem.targetType === 'research'){
+									this.getVoteTeachers(fullItem, fullItem.tchLists)
+								}else{
+									this.getVoteStudents(fullItem, fullItem.classes)
+								}
+							} 
+						}
+						this.$refs.voteForm && (this.$refs.voteForm.voteFormEdit = false)
+						this.$refs.voteFormScroll.scrollTo({
+								y: 0,
+							},
+							200,
+							"easeInQuad"
+						);
+						this.hasNewAdd = false
+						this.isOptionView = true
+						this.isAddActivity = false
+					}else{
+						this.getVoteList(index === 0 ? 'school' : 'private')
+					}
 				}, 500)
 			},
 
@@ -411,7 +476,7 @@
 						if (res.votes.length) {
 							let list = res.votes.reverse()
 							this.voteList = list
-							let queryId = this.$route.query.acId
+							let queryId = this.routerAc ? this.routerAc.id : null
 							if(queryId && list.filter(i => i.id === queryId).length === 0){
 								this.$Modal.confirm({
 									title: this.$t('survey.questionaire.confirmTitle'),
@@ -471,7 +536,7 @@
 			 * @param index
 			 */
 			async onVoteClick(item, index, needJudge = true) {
-				if(!this.$route.query.acId){
+				if(!this.routerAc){
 					this.isFromRecord = false
 					this.split1 = 0.2
 					this.split2 = 0
@@ -979,13 +1044,13 @@
 			}
 		},
 		mounted() {
-			if (this.$route.query.acId) {
+			if (this.$route.params.ac) {
 				this.isFromRecord = true
 				this.split1 = 0
 				this.split2 = 0.3
 				this.$refs.leftSplit.$el.getElementsByClassName('ivu-split-trigger-con')[0].style.display = 'none'
+				this.routerAc = this.$route.params.ac
 			}
-			// this.isPrivate && this.getMyCourse()
 		},
 		computed: {
 			getCurCode() {