Przeglądaj źródła

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

liqk 4 lat temu
rodzic
commit
781884f1af

+ 60 - 54
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/LessonTestReport.vue

@@ -209,24 +209,25 @@
                         <div class="rightAnalys">
                             <div class="TitleRec2"><span style="margin-left:5px">{{$t("studentWeb.exam.report.testAns")}}:</span></div>
                             <br />
-                            <div style="display:flex">
+                            <div style="display: flex">
                                 <div v-for="(item,index) in question.answer" :key="index" v-html="item" style="margin-left:10px;"></div>
                             </div>
-                            <div class="TitleRec2"><span style="margin-left:5px">{{$t("studentWeb.exam.report.testAnalyse")}}:</span></div>
+                            <div class="TitleRec2"><span style="margin-left: 5px">{{$t("studentWeb.exam.report.testAnalyse")}}:</span></div>
                             <br />
-                            <div style="margin-left:10px;" v-html="question.explain != '' ?  question.explain : $t('studentWeb.exam.report.noAnalyse') "></div>
+                            <div style="margin-left: 10px;" v-html="question.explain != '' ?  question.explain : $t('studentWeb.exam.report.noAnalyse') "></div>
                             <div v-show="examInfo.stuScore[index] != -1 && examInfo.stuScore[index] != question.score" class="TitleRec2"><span style="margin-left:5px">{{$t("studentWeb.exam.report.repairSource")}}:</span></div>
                             <br />
-                            <div style="margin-left:10px;display:flex" v-show="examInfo.stuScore[index] != -1 && examInfo.stuScore[index] != question.score ">
+                            <div style="margin-left: 10px; display: flex" v-show="examInfo.stuScore[index] != -1 && examInfo.stuScore[index] != question.score">
                                 <span v-if="question.repair.length == 0">{{$t("studentWeb.exam.report.noSource")}}</span>
                                 <div v-if="question.repair && question.repair.length > 0" class="repair-box">
                                     <Collapse style="width:85%" accordion @on-change="getSource(question.repair,question)">
+                                        <!-- 网络资源 -->
                                         <Panel name="1">
                                             {{$t("studentWeb.exam.report.linkSource")}}
                                             <p slot="content">
                                                 <List border size="small">
                                                     <ListItem v-for="(item,normalIndex) in repairSource.normal" :key="normalIndex">
-                                                        <span style="margin-right:10px;" v-show="item.blobUrl">
+                                                        <span style="margin-right: 10px;" v-show="item.blobUrl">
                                                             <Icon color="#0066FF" custom="iconfont icon-share_link" size="20" />
                                                         </span><a :href="item.blobUrl" target="_blank">{{item.blobUrl}}</a>
                                                     </ListItem>
@@ -236,6 +237,7 @@
                                                 </List>
                                             </p>
                                         </Panel>
+                                        <!-- 文件资源 -->
                                         <Panel name="2">
                                             {{$t("studentWeb.exam.report.fileSource")}}
                                             <p slot="content">
@@ -315,7 +317,7 @@
     import LessonTestReportCharts from "./LessonTestReportCharts/LessonTestReportCharts";
     import Loading from "vue-loading-overlay";
     import "vue-loading-overlay/dist/vue-loading.css";
-import { mapGetters } from 'vuex';
+    import { mapGetters } from 'vuex';
     export default {
         name: "LessonTestReport",
         components: {
@@ -345,17 +347,17 @@ import { mapGetters } from 'vuex';
                 //loading畫面
                 closeAnsDetail: false,
                 checkedAns: ["right", "wrong", "noAns"],
-                testState: 0, //表示有没有作答
+                testState: 0, //1:未作答  2:未评分  3:已评分
                 paperData: [], //所有题目信息
                 ansData: [], //题目的作答答案
                 repairSource: {
-                    normal: [],
-                    file: []
+                    normal: [], //网络资源
+                    file: [] //文件资源
                 },
                 repairData: [],
                 previewStatus: false, //展示补救资源
                 previewFile: {},
-                numPages: null
+                numPages: null //pdf的页数
             };
         },
         mounted() {
@@ -363,10 +365,12 @@ import { mapGetters } from 'vuex';
             this.testJudge()
         },
         methods: {
+            // 关闭Modal
             closePreview() {
                 this.previewStatus = !this.previewStatus
                 this.previewFile = {}
             },
+            // 点击文件资源
             async getItemData(data) {
                this.previewStatus = false
                 if (data.file) {
@@ -448,6 +452,14 @@ import { mapGetters } from 'vuex';
                     this.$store.commit("ToggleLessonTestPopWithSubject", this.examInfo)
                 }
             },
+            // 判断题型
+            getTestType(data) {
+                for (let item of this.$t('global.testType')) {
+                    if (item.value == data) {
+                        return item.label
+                    }
+                }
+            },
             //判断作答情况
             testJudge() {
                 if (this.examInfo.subject !== undefined) {
@@ -471,44 +483,6 @@ import { mapGetters } from 'vuex';
                     }
                 }
             },
-            getTestType(data) {
-                for (let item of this.$t('global.testType')) {
-                    if (item.value == data) {
-                        return item.label
-                    }
-                }
-            },
-            // 获取学生作答数据
-            async getItem(data) {
-                let datas = []
-                if (data !== undefined) {
-                    let codes = this.getItemTitle
-                    let code = {
-                        scope: codes.scope,
-                        code: codes.scope === 'school' ? codes.school : codes.creatorId,
-                        blob: data
-                    }
-                    let blob = this.formUrl(code)
-                    code.blob = blob
-                    datas = await this.$evTools.getComposeItem(code)
-                    return datas
-                } else {
-                    return []
-                }
-            },
-            // 处理学生作答数据blob地址
-            formUrl(data) { 
-                let a = ""
-                if (data.blob.indexOf('https://teammodelstorage') > -1) {
-                    a = data.blob
-                } else {
-                    let blobUrl = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri
-                    let studentBlob = blobUrl.split('/')
-                    let url = data.scope == 'school' ? blobUrl : "https://" + studentBlob[studentBlob.length - 2] + '/' + this.getItemTitle.creatorId
-                    a = `${url}/exam/${data.blob}`
-                }
-                return a 
-            },
             async formPaper() {
                 let paper = []
                 this.paperData.length = 0
@@ -545,8 +519,36 @@ import { mapGetters } from 'vuex';
                     this.ansData= await this.getItem(this.examInfo.stuAns[0])
                 }
             },
-            closeDetail() {
-                this.closeAnsDetail = !this.closeAnsDetail;
+            // 获取学生作答数据
+            async getItem(data) {
+                let datas = []
+                if (data !== undefined) {
+                    let codes = this.getItemTitle
+                    let code = {
+                        scope: codes.scope,
+                        code: codes.scope === 'school' ? codes.school : codes.creatorId,
+                        blob: data
+                    }
+                    let blob = this.formUrl(code)
+                    code.blob = blob
+                    datas = await this.$evTools.getComposeItem(code)
+                    return datas
+                } else {
+                    return []
+                }
+            },
+            // 处理学生作答数据blob地址
+            formUrl(data) { 
+                let a = ""
+                if (data.blob.indexOf('https://teammodelstorage') > -1) {
+                    a = data.blob
+                } else {
+                    let blobUrl = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri
+                    let studentBlob = blobUrl.split('/')
+                    let url = data.scope == 'school' ? blobUrl : "https://" + studentBlob[studentBlob.length - 2] + '/' + this.getItemTitle.creatorId
+                    a = `${url}/exam/${data.blob}`
+                }
+                return a 
             },
             checkedAnsFilter(index) {
                 if (this.checkedAns.includes("right") == true && this.examInfo.stuScore[index] == this.paperData[index].score) {
@@ -560,6 +562,10 @@ import { mapGetters } from 'vuex';
                 else return false;
 
             },
+            /* =====未调用====== */
+            closeDetail() {
+                this.closeAnsDetail = !this.closeAnsDetail;
+            },
         },
         computed: {
             ...mapGetters([
@@ -573,7 +579,7 @@ import { mapGetters } from 'vuex';
                         data += item
                     }
                 }
-                if(String(data).indexOf(".") != -1) {
+                if (String(data).indexOf(".") != -1) {
                     data = data.toFixed(2)
                 }
                 return data
@@ -835,9 +841,9 @@ import { mapGetters } from 'vuex';
         }
 
     /**對問題進行篩選 */
-    .filterBtn {
-        /* display: inline-block; */
-    }
+    /* .filterBtn {
+        display: inline-block;
+    } */
 
     .filterBtn .wrong-exercises{
         /* border: 1px solid #515A6E; */

+ 28 - 18
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/LessonTestReportCharts/StudentScore.vue

@@ -4,7 +4,7 @@
             <div class="stu-info">
                 <ul>
                     <li>
-                        <p><Icon type="ios-home" size="24" />{{$t("studentWeb.exam.studentScore.examName")}}:<span>{{$store.getters.getItemTitle.name}}</span></p>
+                        <p><Icon type="ios-home" size="24" />{{$t("studentWeb.exam.studentScore.examName")}}:<span>{{getItemTitle.name}}</span></p>
                     </li>
                     <li>
                         <p><Icon type="ios-paper" size="24" />{{$t("studentWeb.exam.studentScore.examType")}}:<span>--</span></p>
@@ -13,13 +13,13 @@
                         <p><Icon type="ios-list-box" size="24" />{{$t("studentWeb.exam.studentScore.stableIndex")}}:<span>--</span></p>
                     </li>
                     <li>
-                        <p><Icon type="ios-person" size="24" />{{$t("studentWeb.exam.studentScore.name")}}:<span>{{$store.state.userInfo.name}}</span></p>
+                        <p><Icon type="ios-person" size="24" />{{$t("studentWeb.exam.studentScore.name")}}:<span>{{userInfo.name}}</span></p>
                     </li>
                     <li>
-                        <p style="margin-top:5px">{{$t("studentWeb.exam.studentScore.stuNo")}}:<span>{{$store.state.userInfo.sub}}</span></p>
+                        <p style="margin-top:5px">{{$t("studentWeb.exam.studentScore.stuNo")}}:<span>{{userInfo.sub}}</span></p>
                     </li>
                     <li>
-                        <p style="margin-top:5px">{{$t("studentWeb.exam.studentScore.class")}}:<span>{{$store.state.user.studentProfile.classinfo.name}}</span></p>
+                        <p style="margin-top:5px">{{$t("studentWeb.exam.studentScore.class")}}:<span>{{classinfo.name}}</span></p>
                     </li>
                 </ul>
             </div>
@@ -214,6 +214,7 @@
     </div>
 </template>
 <script>
+    import { mapGetters, mapState } from 'vuex'
     export default {
         props: {
             stuData: {
@@ -231,7 +232,7 @@
         },
         data() {
             return {
-                testData: [],
+                testData: [], //试卷的题目信息
                 stuScore: [],
                 scoreInfo: {}
             }
@@ -256,11 +257,11 @@
                     this.scoreInfo = {}
                     let req = {
                         // "code": this.$store.state.user.schoolCode,
-                        "code": this.$store.getters.getItemTitle.owner == 'school' ? this.$store.getters.getItemTitle.school : this.$store.getters.getItemTitle.creatorId,
+                        "code": this.getItemTitle.owner == 'school' ? this.getItemTitle.school : this.getItemTitle.creatorId,
                         "id": this.examData[0].id,
-                        "sId": this.$store.state.userInfo.sub,
+                        "sId": this.userInfo.sub,
                         "cId": this.stuData.claId[0],
-                        "gId": this.$store.state.user.studentProfile.classinfo.gradeId
+                        "gId": this.classinfo.gradeId
                     }
                     this.$api.studentWeb.getStudentAnalysis(req).then(res => {
                         if (res.gradeAverage && this.stuScore.length) {
@@ -294,12 +295,12 @@
                 } else {
                     let blobUrl = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri
                     let studentBlob = blobUrl.split('/')
-                    let url = data.scope == 'school' ? blobUrl : "https://" + studentBlob[studentBlob.length - 2] + '/' + this.$store.getters.getItemTitle.creatorId
+                    let url = data.scope == 'school' ? blobUrl : "https://" + studentBlob[studentBlob.length - 2] + '/' + this.getItemTitle.creatorId
                     a = `${url}/exam/${data.blob}`
                 }
                 return a 
             },
-            async getStudentData(data,score,ans) {
+            async getStudentData(data, score, ans) {
                 let paper = []
                 let item = {
                     objItem: [],
@@ -307,13 +308,13 @@
                 }
                 console.log('5636123322',data)
                 if (data !== undefined) {
-                    let codes = this.$store.getters.getItemTitle.scope == 'school' ? data.school : data.creatorId
-                        let code = {
-                            scope: data.scope,
-                            code: codes,
-                            blob: data.blob,
-                            examId:codes
-                        }
+                    let codes = this.getItemTitle.scope == 'school' ? data.school : data.creatorId
+                    let code = {
+                        scope: data.scope,
+                        code: codes,
+                        blob: data.blob,
+                        examId:codes
+                    }
                     let papers = await this.$evTools.getStuPaper(code)
                     let answer = await this.getItem(ans)
                     paper = await this.formPaper(papers)
@@ -344,7 +345,7 @@
             async getItem(data) {
                 let datas = []
                 if (data !== undefined) {
-                    let key = this.$store.getters.getItemTitle
+                    let key = this.getItemTitle
                     let code = {
                         scope: this.stuData.papers[0].scope,
                         code: key.scope == 'school' ? key.school : key.creatorId,
@@ -397,6 +398,15 @@
                 }
                 deep: true
             }
+        },
+        computed: {
+            ...mapState({
+                userInfo: state => state.userInfo,
+                classinfo: state => state.user.studentProfile.classinfo
+            }),
+            ...mapGetters([
+                "getItemTitle",
+            ])
         }
     }
 </script>

+ 51 - 24
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperTest.vue

@@ -289,6 +289,11 @@
                 // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+
                 return "关闭提示";
             }
+            /* if (window.history && window.history.pushState) {
+                // 向历史记录中插入了当前页
+                // history.pushState(null, null, document.URL);
+                window.addEventListener('popstate', this.docGoBack, false);
+            } */
         },
         props: {
             papers: {
@@ -360,6 +365,24 @@
             };
         },
         methods: {
+            docGoBack() {
+                console.log("点击了浏览器的返回按钮");
+                this.$Modal.confirm({
+                    title: this.$t("studentWeb.exam.testpop.exitQuizhint"),
+                    content: "离开页面,您已作答的数据不会保存,是否确认退出?",
+                    onOk: () => {
+                        window.removeEventListener("popstate", this.docGoBack, false)
+                        // sessionStorage.clear(); //删除当前页面的数据
+                        // window.history.back();
+                        this.quitTest()
+                    },
+                    onCancel: () => {
+                        // window.removeEventListener("popstate", this.docGoBack, false)
+                    },
+                })
+                /* sessionStorage.clear();
+                window.history.back(); */
+            },
             getClassName(index){
                 let names = []
                 if(this.queNo == index) {
@@ -445,10 +468,6 @@
                     this.hintHandon()
                 }
             },
-            getJudge() {
-                this.checkers[this.queNo] = []
-                this.checkers[this.queNo].push(this.judgeSelect)
-            },
             getPaper() {
                 let paper = this.getCurrentSubject
                 this.paperData = { ...paper }
@@ -595,25 +614,6 @@
                     this.isLoading = false
                 }, 500)
             },
-            async getItem(data) {
-                let datas = []
-                if (data !== undefined) {
-                    let key = this.getExamInfo.code.split('-')
-                    let code = {
-                        scope: this.getExamInfo.scope,
-                        code: key[(key.length - 1)],
-                        blob: data
-                    }
-                    let blob = this.formUrl(code)
-                    code.blob = blob
-                    console.log(code);
-                    datas = await this.$evTools.getComposeItem(code)
-                    console.log(datas);
-                    return datas
-                } else {
-                    return []
-                }
-            },
             //处理学生作答数据blob地址
             formUrl(data) { 
                 let a = ""
@@ -648,11 +648,38 @@
                     }
                 }
             },
+            /* ======未调用====== */
+            getJudge() {
+                this.checkers[this.queNo] = []
+                this.checkers[this.queNo].push(this.judgeSelect)
+            },
+            async getItem(data) {
+                let datas = []
+                if (data !== undefined) {
+                    let key = this.getExamInfo.code.split('-')
+                    let code = {
+                        scope: this.getExamInfo.scope,
+                        code: key[(key.length - 1)],
+                        blob: data
+                    }
+                    let blob = this.formUrl(code)
+                    code.blob = blob
+                    console.log(code);
+                    datas = await this.$evTools.getComposeItem(code)
+                    console.log(datas);
+                    return datas
+                } else {
+                    return []
+                }
+            },
+        },
+        destroyed () {
+            // window.removeEventListener("popstate", this.docGoBack, false)
         },
 
         watch: {
             checkers:{
-                handler(n,o){
+                handler(n, o) {
                     // 未作答:0  对:1  错:2  主观题:3  已作答:4
                     // 已作答
                     if(n[this.queNo] && n[this.queNo].length) {

+ 3 - 3
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperView.vue

@@ -60,7 +60,7 @@
 <script>
     import Load from "vue-loading-overlay";
     import "vue-loading-overlay/dist/vue-loading.css";
-import { mapGetters } from 'vuex';
+    import { mapGetters } from 'vuex';
     import EventBasicInfo from "../../EventBasicInfo";
     import LessonTestReport from "./LessonTestReport";
     import StudentScore from "./LessonTestReportCharts/StudentScore";
@@ -90,14 +90,14 @@ import { mapGetters } from 'vuex';
                 nextItem: "", //存放下個活動預告
                 isHintNextItem: false,
                 showHint: false,
-                paperData: [],
+                paperData: [], //试卷信息
                 openEva: false,
                 selectData: {}, // 存放完整试卷接口的返回值
                 isExamDown: false,
                 chooseData: {},
                 examData: [],
                 isLoad: false,
-                stuData: {},
+                stuData: {}, //当前评测的所有信息:classId、学科、试卷、作答答案
                 isTestOver: false,
                 selectTab: "test",
                 paperCtn: null, // 当前评测的scope

+ 45 - 42
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/QuesNaire.vue

@@ -36,54 +36,56 @@
 		</div> -->
 		<br />
 		<EventBasicInfo />
-		<!-- 已提交 -->
-		<div v-if="alreadyAnswered" style="text-align: center;padding-top: 15%;">
-			<Icon type="md-checkmark-circle-outline" color="#00ad6c" size="80"/>
-			<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.already') }}</p>
-		</div>
-		<!-- 活动结束 -->
-		<div v-if="!alreadyAnswered && surveyInfo.progress === 'finish'" style="text-align: center;padding-top: 15%;">
-			<Icon type="md-stopwatch" color="#00ad6c" size="80"/>
-			<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.overtime') }}</p>
-		</div>
-		
-
-		<!--問卷完成後,在時間結束前仍可修改答案再提交-->
-		<div v-if="surveyInfo.progress !== 'finish' && !alreadyAnswered">
-			<BillBoardandLightBox :activityData="surveyInfo" />
-			<div class="title-rect-group">
-				<!-- <div class="title-rect" /> -->
-				<h2 class="title-rect-name">{{ $t('survey.studentWeb.content') }}</h2>
+		<div>
+			<!-- 已提交 -->
+			<div v-if="alreadyAnswered" style="text-align: center;padding-top: 15%;">
+				<Icon type="md-checkmark-circle-outline" color="#00ad6c" size="80"/>
+				<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.already') }}</p>
 			</div>
-			<br />
-			<!-- 问卷内容 -->
-			<div v-for="(item, index) in surveyInfo.items" :key="index" class="survey-item">
-				<!-- <br /> -->
-				<div style="display: flex;font-weight: bold;">
-					<span>{{ index + 1 }}. </span>
-					<span v-html="item.question"></span>({{ typeList[item.type] }})<span></span>
+			<!-- 活动结束 -->
+			<div v-if="!alreadyAnswered && surveyInfo.progress === 'finish'" style="text-align: center;padding-top: 15%;">
+				<Icon type="md-stopwatch" color="#00ad6c" size="80"/>
+				<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.overtime') }}</p>
+			</div>
+			
+
+			<!--問卷完成後,在時間結束前仍可修改答案再提交-->
+			<div v-if="surveyInfo.progress !== 'finish' && !alreadyAnswered">
+				<BillBoardandLightBox :activityData="surveyInfo" />
+				<div class="title-rect-group">
+					<!-- <div class="title-rect" /> -->
+					<h2 class="title-rect-name">{{ $t('survey.studentWeb.content') }}</h2>
 				</div>
-				<!-- 非问答 -->
-				<div v-if="item.type !== 'subjective'">
-					<div class="unitTestBtn" v-for="(option, optionIndex) in item.option" :key="optionIndex">
-						<div class="unitTestbg" @click="onOptionClick(item,index,option.code)"
-							:style="{ backgroundColor: submitArr[index].includes(option.code) ?  '#24b880' : 'transparent' }">
-							{{ option.code }}. <span v-html="option.value" style="margin-left: 10px;"></span>
+				<br />
+				<!-- 问卷内容 -->
+				<div v-for="(item, index) in surveyInfo.items" :key="index" class="survey-item">
+					<!-- <br /> -->
+					<div style="display: flex;font-weight: bold;">
+						<span>{{ index + 1 }}. </span>
+						<span v-html="item.question"></span>({{ typeList[item.type] }})<span></span>
+					</div>
+					<!-- 非问答 -->
+					<div v-if="item.type !== 'subjective'">
+						<div class="unitTestBtn" v-for="(option, optionIndex) in item.option" :key="optionIndex">
+							<div class="unitTestbg" @click="onOptionClick(item,index,option.code)"
+								:style="{ backgroundColor: submitArr[index].includes(option.code) ?  '#24b880' : 'transparent' }">
+								{{ option.code }}. <span v-html="option.value" style="margin-left: 10px;"></span>
+							</div>
 						</div>
 					</div>
+					<!-- 问答 -->
+					<div v-if="item.type === 'subjective'">
+						<Input v-model="submitArr[index][0]" type="textarea" :rows="8" :placeholder="$t('studentWeb.exam.inputAnswers')" />
+					</div>
+					<Divider v-if="index != surveyInfo.items.length - 1" />
 				</div>
-				<!-- 问答 -->
-				<div v-if="item.type === 'subjective'">
-					<Input v-model="submitArr[index][0]" type="textarea" :rows="8" :placeholder="$t('studentWeb.exam.inputAnswers')" />
-				</div>
-				<Divider v-if="index != surveyInfo.items.length - 1" />
+				<br />
+				<br />
+				<button class="uploadBtn" @click="submitMessage()">
+					<svg-icon icon-class="quesnaire" class="uloadBtn-icon" />
+					<span>{{ $t('survey.studentWeb.submit') }}</span>
+				</button>
 			</div>
-			<br />
-			<br />
-			<button class="uploadBtn" @click="submitMessage()">
-				<svg-icon icon-class="quesnaire" class="uloadBtn-icon" />
-				<span>{{ $t('survey.studentWeb.submit') }}</span>
-			</button>
 		</div>
 
 		<!-- {{ createdSaveCheckers() }} -->
@@ -228,6 +230,7 @@ import { mapGetters } from 'vuex';
 			//获取投票数据
 			// 获取surveyInfo的数据
 			async getSurveyInfo() {
+				// this.surveyInfo = {}
 				if (this.getItemTitle.id) {
 					let params = {
 						"id": this.getItemTitle.id,

+ 110 - 100
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/Vote.vue

@@ -9,113 +9,115 @@
         </div>
         <EventBasicInfo />
         <div>
+            <div>
             <!--超时-->
-            <div v-if="getItemTitle.endTime <= '2020.02.10'">
-                <br />
-                <div class="dec animate__animated animate__bounceInLeft">
-                    <svg-icon icon-class="handonHint" class="warm-icon" />
-                    <span class="warm-hint">{{ $t("studentWeb.vote.timeoutHint") }}</span>
-                </div>
-            </div>
-            <div v-if="!showResult">
-                <div class="load-box">
-                    <Load :active.sync="isLoad"
-                          background-color="#000">
-                        <template slot="default">
-                            <svg-icon icon-class="loader" class="loader-icon" />
-                        </template>
-                    </Load>
-                </div>
-                <BillBoardandLightBox :activityData="voteInfo" :voteRes="voteResData" />
-                <div class="vote-title">
-                    <div class="title-rect-group">
-                        <!-- <div class="title-rect" /> -->
-                        <h2 class="title-rect-name">{{ $t("studentWeb.vote.bollotbox") }}</h2>
-                        <p v-if="voteInfo.repeat" style="margin-left:15px;margin-top:2px">{{ $t("studentWeb.vote.surplusTickets")}} <span style="font-size:16px">{{voteCount}}</span><span> {{ $t("studentWeb.vote.tickets")}} </span></p>
+                <div v-if="getItemTitle.endTime <= '2020.02.10'">
+                    <br />
+                    <div class="dec animate__animated animate__bounceInLeft">
+                        <svg-icon icon-class="handonHint" class="warm-icon" />
+                        <span class="warm-hint">{{ $t("studentWeb.vote.timeoutHint") }}</span>
                     </div>
-                    <Button v-show="isResult"
-                            style="float:right;margin-top:-30px"
-                            size="small" type="success"
-                            @click="showRes"
-                    >
-                        <span style="margin-left:5px">{{$t("studentWeb.vote.voteRes")}}</span>
-                    </Button>
                 </div>
-                <!-- 投票内容 -->
-                <!-- <div class="question-box">
-                    <span v-html="voteInfo.description"></span>
-                </div> -->
-                <div class="vote-option">
-                    <!-- 1票
-                    <RadioGroup v-model="voteChecked" v-if="voteInfo.voteNum == 1" class="option-group">
-                        <Radio :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
-                            <span v-html="item.value"></span>
-                        </Radio>
-                    </RadioGroup>
-                    多票  不重复
-                    <CheckboxGroup v-model="voteChecked" v-if="voteInfo.voteNum > 1 && !voteInfo.repeat" class="option-group">
-                        <Checkbox :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
-                            <span v-html="item.value"></span>
-                        </Checkbox>
-                    </CheckboxGroup>
-                    多票  重复
-                    <CheckboxGroup v-model="voteChecked" v-if="voteInfo.voteNum > 1 && voteInfo.repeat" class="option-group option-repeat">
-                        <Checkbox :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
-                            <InputNumber v-model="item.count"
-                                         :min="0"
-                                         size="small"
-                                         :formatter="value => `${value}` +$t('studentWeb.vote.tickets')"
-                            ></InputNumber>
-                            <span v-html="item.value"></span>
-                        </Checkbox>
-                    </CheckboxGroup> -->
-                    <div class="checkAnswer" v-for="(item, index) in voteInfo.options" :key="index">  
-                        <label class="testBtn">
-                            <input type="checkbox" :value="item" v-model="voteChecked" @click="getVote(item)" />
-                            <div class="testbg">
-                                <div class="vote-info">
-                                    <span style="display:flex;margin-right:5px">{{item.code}}.<span v-html="item.value"></span></span>
-                                </div>
+                <div v-if="!showResult">
+                    <div class="load-box">
+                        <Load :active.sync="isLoad"
+                            background-color="#000">
+                            <template slot="default">
+                                <svg-icon icon-class="loader" class="loader-icon" />
+                            </template>
+                        </Load>
+                    </div>
+                    <BillBoardandLightBox :activityData="voteInfo" :voteRes="voteResData" />
+                    <div class="vote-title">
+                        <div class="title-rect-group">
+                            <!-- <div class="title-rect" /> -->
+                            <h2 class="title-rect-name">{{ $t("studentWeb.vote.bollotbox") }}</h2>
+                            <p v-if="voteInfo.repeat" style="margin-left:15px;margin-top:2px">{{ $t("studentWeb.vote.surplusTickets")}} <span style="font-size:16px">{{voteCount}}</span><span> {{ $t("studentWeb.vote.tickets")}} </span></p>
+                        </div>
+                        <Button v-show="isResult"
+                                style="float:right;margin-top:-30px"
+                                size="small" type="success"
+                                @click="showRes"
+                        >
+                            <span style="margin-left:5px">{{$t("studentWeb.vote.voteRes")}}</span>
+                        </Button>
+                    </div>
+                    <!-- 投票内容 -->
+                    <!-- <div class="question-box">
+                        <span v-html="voteInfo.description"></span>
+                    </div> -->
+                    <div class="vote-option">
+                        <!-- 1票
+                        <RadioGroup v-model="voteChecked" v-if="voteInfo.voteNum == 1" class="option-group">
+                            <Radio :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
+                                <span v-html="item.value"></span>
+                            </Radio>
+                        </RadioGroup>
+                        多票  不重复
+                        <CheckboxGroup v-model="voteChecked" v-if="voteInfo.voteNum > 1 && !voteInfo.repeat" class="option-group">
+                            <Checkbox :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
+                                <span v-html="item.value"></span>
+                            </Checkbox>
+                        </CheckboxGroup>
+                        多票  重复
+                        <CheckboxGroup v-model="voteChecked" v-if="voteInfo.voteNum > 1 && voteInfo.repeat" class="option-group option-repeat">
+                            <Checkbox :label="item.code" v-for="(item, index) in voteInfo.options" :key="index" class="option-wrapper">
                                 <InputNumber v-model="item.count"
-                                             :formatter="value => `${value}` +$t('studentWeb.vote.tickets')"
-                                             :parser="value => value.replace($t('studentWeb.vote.tickets'), '')"
-                                             :min="0"
-                                             v-if="voteInfo.repeat"
-                                             @on-change="setVoteNum(item)"
-                                             :disabled="!voteStatus">
-                                </InputNumber>
-                            </div>
-                        </label>
+                                            :min="0"
+                                            size="small"
+                                            :formatter="value => `${value}` +$t('studentWeb.vote.tickets')"
+                                ></InputNumber>
+                                <span v-html="item.value"></span>
+                            </Checkbox>
+                        </CheckboxGroup> -->
+                        <div class="checkAnswer" v-for="(item, index) in voteInfo.options" :key="index">  
+                            <label class="testBtn">
+                                <input type="checkbox" :value="item" v-model="voteChecked" @click="getVote(item)" />
+                                <div class="testbg">
+                                    <div class="vote-info">
+                                        <span style="display:flex;margin-right:5px">{{item.code}}.<span v-html="item.value"></span></span>
+                                    </div>
+                                    <InputNumber v-model="item.count"
+                                                :formatter="value => `${value}` +$t('studentWeb.vote.tickets')"
+                                                :parser="value => value.replace($t('studentWeb.vote.tickets'), '')"
+                                                :min="0"
+                                                v-if="voteInfo.repeat"
+                                                @on-change="setVoteNum(item)"
+                                                :disabled="!voteStatus">
+                                    </InputNumber>
+                                </div>
+                            </label>
+                        </div>
                     </div>
-                </div>
-                <Button :disabled="!isVote" size="large" type="success" @click="submitMessage()">
-                    <svg-icon icon-class="vote" class="uploadBtn-icon" />
-                    <span style="margin-left:5px">{{ $t("studentWeb.vote.submitBVote") }}</span>
-                </Button>
-                <span class="clickbutnoChoosehint"
-                      v-if="clickbutnoChoose == true && voteChecked == ''">{{ $t("studentWeb.vote.note") }}</span>
-                <span v-if="isOverCount" style="margin-top:5px;margin-left:15px;color:red">{{$t("studentWeb.vote.warning2")}}</span>
+                    <Button :disabled="!isVote" size="large" type="success" @click="submitMessage()">
+                        <svg-icon icon-class="vote" class="uploadBtn-icon" />
+                        <span style="margin-left:5px">{{ $t("studentWeb.vote.submitBVote") }}</span>
+                    </Button>
+                    <span class="clickbutnoChoosehint"
+                        v-if="clickbutnoChoose == true && voteChecked == ''">{{ $t("studentWeb.vote.note") }}</span>
+                    <span v-if="isOverCount" style="margin-top:5px;margin-left:15px;color:red">{{$t("studentWeb.vote.warning2")}}</span>
 
-            </div>
-        </div>
-        <!-- 投票结果 -->
-        <div class="voteResults" v-if="showResult">
-            <h3 class="voteResultsMainRow ">
-                {{ $t("studentWeb.vote.voteResult") }}
-            </h3>
-            <div class="question-box">
-                <span style="display:block;width:90%" v-html="voteInfo.description"></span>
-                <Button style="float:right;margin-top:0px" size="small" type="success" @click="showRes">
-                    <span style="margin-left:5px">{{$t("studentWeb.vote.voteRecord")}}</span>
-                </Button>
-            </div>
-            <div v-for="(item,index) in voteInfo.options" :key="index">
-                <div class="voteResultsItem">
-                    <p style="display:flex">{{ item.code }}.<span v-html="item.value"></span></p>
                 </div>
             </div>
-            <div align="center">
-                <VoteResultChart :voteData="voteData" :voteList="voteList" />
+            <!-- 投票结果 -->
+            <div class="voteResults" v-if="showResult">
+                <h3 class="voteResultsMainRow ">
+                    {{ $t("studentWeb.vote.voteResult") }}
+                </h3>
+                <div class="question-box">
+                    <span style="display:block;width:90%" v-html="voteInfo.description"></span>
+                    <Button style="float:right;margin-top:0px" size="small" type="success" @click="showRes">
+                        <span style="margin-left:5px">{{$t("studentWeb.vote.voteRecord")}}</span>
+                    </Button>
+                </div>
+                <div v-for="(item,index) in voteInfo.options" :key="index">
+                    <div class="voteResultsItem">
+                        <p style="display:flex">{{ item.code }}.<span v-html="item.value"></span></p>
+                    </div>
+                </div>
+                <div align="center">
+                    <VoteResultChart :voteData="voteData" :voteList="voteList" />
+                </div>
             </div>
         </div>
     </div>
@@ -195,7 +197,15 @@
                     this.$api.studentWeb.getVoteInfo(params).then(res => {
                         if (res) {
                             if(res.status == 404) {
-                                this.delActivity()
+                                this.isLoad = false
+                                this.$Modal.confirm({
+                                    title: "投票已被删除,是否删除此条记录?",
+                                    okText: "删除",
+                                    cancelText: "取消",
+                                    onOk: () => {
+                                        this.delActivity()
+                                    }
+                                })
                             } else if(res.status == 200) {
                                 this.showResult = false
                                 this.isResult = false