Browse Source

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

zj 2 years ago
parent
commit
8209f4c786

+ 1 - 1
TEAMModelOS/ClientApp/src/components/evaluation/ExerciseList.less

@@ -47,7 +47,7 @@
     flex-direction: row;
     justify-content: center;
     margin: 20px 0;
-    position: fixed;
+    // position: fixed;
     bottom: 5px;
     background: #fff;
     width: 100%;

+ 137 - 0
TEAMModelOS/ClientApp/src/view/evaluation/components/BasePaperItemPicker.vue

@@ -0,0 +1,137 @@
+<template>
+  <div class="paper-item-picker-container">
+    <div class="paper-list">
+      <p style="font-size:16px;margin-left:20px;" v-if="paperList.length">当前已挑选 <span style="font-weight:bold;color:#42a676">{{ checkList.length }}</span> 题</p>
+      <p style="font-size:16px;margin-left:20px;" v-if="!paperList.length">当前无试卷可选择!</p>
+      <Collapse simple v-if="paperList.length" accordion @on-change="onPaperClick">
+        <Panel v-for="(paper,index) in paperList" color="primary" :name="paper.id">
+          <span style="display:inline-flex;align-items: center">
+            <span style="margin-right:10px">{{ paper.name }}</span>
+            <Tag color="blue">{{ paper.scoring ? paper.scoring.length : 0 }}题</Tag>
+            <span style="margin-left: 8px;" v-for="(tag,tagIndex) in paper.tags">
+              <Tag color="geekblue">{{ tag }}</Tag>
+            </span>
+            <span style="margin-left: 8px;" v-if="paper.mode">
+              <Tag color="green">{{ paper.mode }}</Tag>
+            </span>
+          </span>
+          <template #content>
+            <div class="question-list" v-if="questionList.length">
+              <div :class="[ 'question-item',checkList.find(i => i.id === item.id) ? 'question-item-active' : 'question-item' ]" v-for="(item,index) in questionList" @click="onQuestionClick(item,index)">
+                <div class="question-stem">
+                  <span>{{ index + 1 }}.</span>
+                  <span v-html="item.question">{{  }}</span>
+                </div>
+              </div>
+            </div>
+          </template>
+        </Panel>
+      </Collapse>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'BasePaperItemPicker',
+  props: {
+    gradeCode: {
+      type: Array,
+      default: () => []
+    },
+    subjectCode: {
+      type: String,
+      default: ''
+    },
+    periodCode: {
+      type: String,
+      default: ''
+    },
+  },
+  data() {
+    return {
+      paperList: [],
+      questionList: [],
+      checkList: [],
+      originQuestionList: [],
+    }
+  },
+  created() {
+    console.error(this.gradeCode, this.subjectCode, this.periodCode)
+    this.findPaper()
+  },
+  methods: {
+    onQuestionClick(item, index) {
+      let findIndex = this.checkList.findIndex(i => i.id === item.id)
+      if (findIndex > -1) {
+        this.checkList.splice(findIndex, 1)
+      } else {
+        let newItem = this.originQuestionList.find(i => i.id === item.id)
+        newItem.score = 0
+        this.checkList.push(newItem)
+      }
+    },
+    findPaper() {
+      this.$api.learnActivity.FindExamPaper({
+        '@DESC': "createTime",
+        'code': this.isSchool ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+        'gradeIds[*]': this.isSchool ? this.gradeCode.map(i => i + '') : [],
+        'periodId': this.isSchool ? this.periodCode : [],
+        'scope': this.isSchool ? 'school' : "private",
+        'subjectId': this.isSchool ? [this.subjectCode] : []
+      }).then(res => {
+        this.paperList = res.papers
+      })
+    },
+    async onPaperClick(paperId) {
+      if (!paperId.length) return
+      this.question = []
+      let paper = this.paperList.find(i => i.id === paperId[0])
+      let fullPaperJson = await this.$evTools.getFullPaper(paper)
+      this.questionList = fullPaperJson.item
+      this.originQuestionList = this._.cloneDeep(fullPaperJson.item)
+      this.questionList.forEach(i => {
+        i.question = i.question.replace(/<[^>]+>/g, "")
+      })
+      console.log(fullPaperJson)
+    },
+
+
+  },
+  computed: {
+    isSchool() {
+      return this.$route.name === 'newSchoolPaper'
+    },
+  }
+}
+</script>
+
+<style lang="less">
+.paper-item-picker-container {
+  .ivu-collapse {
+    border: none;
+  }
+  .ivu-collapse-header {
+    height: 50px !important;
+    line-height: 50px !important;
+  }
+
+  .ivu-collapse-content {
+    padding: 0 45px;
+  }
+
+  .question-item {
+    margin: 10px 0;
+    display: flex;
+    justify-content: space-between;
+    border: 1px dashed #ccc;
+    padding: 10px;
+    cursor: pointer;
+  }
+
+  .question-item-active {
+    background: #42a676;
+    color: #fff;
+  }
+}
+</style>

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

@@ -86,7 +86,7 @@
                 <!-- 预览试卷 -->
                 <TabPane :label="$t('evaluation.paperList.tab5')" name="preview" :index="4" tab="createTest">
                   <vuescroll ref="paperRef" @handle-scroll="handleScroll">
-                    <TestPaper v-if="!examAnalysisStatus" :paper="evaluationInfo" :class="examAnalysisStatus ? '':'animated fadeIn'" ref="testPaper" @onViewModelChange="onViewModelChange" :isPreviewItems="!isGeneratePaper">
+                    <TestPaper v-if="!examAnalysisStatus" :subjectCode="propSubject" :periodCode="propPeriod" :gradeCode="propGrades" :paper="evaluationInfo" :class="examAnalysisStatus ? '':'animated fadeIn'" ref="testPaper" @onViewModelChange="onViewModelChange" :isPreviewItems="!isGeneratePaper">
                     </TestPaper>
                   </vuescroll>
                 </TabPane>
@@ -336,7 +336,6 @@ export default {
         this.evaluationInfo.item = importList
         this.activeTab = 'preview'
         this.$Message.success(this.$t('evaluation.importFile.warningTips3'))
-        console.log(this.evaluationInfo)
         if (this.errorList.length) {
           this.$EventBus.$emit('importFinish', this.errorList)
         }
@@ -427,7 +426,6 @@ export default {
     },
     /* 获取手动组题的数据 */
     getSelectedQuestion(data) {
-      console.log(data)
       let arr = data.questions
       // 如果是编辑试卷 则往原试卷添加不包含的新题目进入
       if (this.isEditPaper) {
@@ -559,7 +557,6 @@ export default {
         let promiseArr = []
         for (let i = 0; i < list.length; i++) {
           let exerciseItem = list[i]
-          console.log(exerciseItem.blob)
           // 如果题目是来自题库或者试卷库 (不需要进行入库操作)
           if (exerciseItem.blob) {
             if (exerciseItem.children.length) {

+ 59 - 57
TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.less

@@ -1,37 +1,35 @@
 .paper-container {
-	position: relative;
-	
-	.back-to-top {
-	    position:fixed;
-	    right:-98%;
-	    bottom:60px;
-	    height:48px;
-	    width:50px;
-	    background:#595959;
-	    z-index:99999;
-		border-radius: 50%;
-	    cursor:pointer;
-	}
-	
-	 .back-to-top:hover {
-	    background:rgb(128,128,128);
-	}
-	
-	    .back-to-top .ivu-icon {
-	        font-size:26px;
-	        color:white;
-	    }
-	
+    position: relative;
+
+    .back-to-top {
+        position: fixed;
+        right: -98%;
+        bottom: 60px;
+        height: 48px;
+        width: 50px;
+        background: #595959;
+        z-index: 99999;
+        border-radius: 50%;
+        cursor: pointer;
+    }
+
+    .back-to-top:hover {
+        background: rgb(128, 128, 128);
+    }
 
+    .back-to-top .ivu-icon {
+        font-size: 26px;
+        color: white;
+    }
 
 
     .paper-title {
         font-size: 30px;
-		margin: 30px 0;
+        margin: 30px 0;
         font-weight: bold;
         vertical-align: middle;
         text-align: center;
-		cursor: pointer;
+        cursor: pointer;
     }
 
     .paper-subTitle {
@@ -65,14 +63,14 @@
     padding: 20px 0;
 
     .paper-analysis {
-        position:sticky;
-        top:0;
+        position: sticky;
+        top: 0;
         background: White;
         width: 20%;
         padding: 20px 10px;
 
-        .ivu-radio-group{
-            margin:15px 0 0 0;
+        .ivu-radio-group {
+            margin: 15px 0 0 0;
         }
 
         .analysis-btns {
@@ -148,12 +146,12 @@
 .paper-content {
     width: 100%;
     height: ~"calc(100% - 5px)";
-	min-height: 1552px;
+    min-height: 1552px;
     background: #fff;
-    padding:10px;
+    padding: 10px;
     display: flex;
     flex-direction: row;
-	// min-height: 73vh;
+    // min-height: 73vh;
 
     .paper-body {
         width: 98%;
@@ -197,15 +195,16 @@
                 height: 50px;
             }
         }
+
         // .base-info-item:not(:first-child) {
         //     margin-left: 30px;
         // }
-		
-		.base-info-btn{
-			padding: 0 8px;
-			margin-bottom: 8px;
-		}
-		
+
+        .base-info-btn {
+            padding: 0 8px;
+            margin-bottom: 8px;
+        }
+
         .base-info-btn:not(:last-child) {
             margin-right: 10px;
         }
@@ -228,7 +227,7 @@
         padding: 5px 10px !important;
         box-sizing: border-box;
         background: transparent;
-        border: 1px solid rgba(1,1,1,0);
+        border: 1px solid rgba(1, 1, 1, 0);
 
         .item-concept {
             margin-top: 10px;
@@ -282,10 +281,12 @@
         }
     }
 }
+
 /*.paper-content .paper-part:hover {
             background: #bfcdad45;
         }*/
-.paper-content .item-answer, .paper-content .item-explain {
+.paper-content .item-answer,
+.paper-content .item-explain {
     line-height: 26px;
 }
 
@@ -320,22 +321,22 @@
     }
 }
 
-.rules-modal{
-	
-	.ivu-modal-body{
-		
-		.rule-item{
-			display: flex;
-			flex-direction: column;
-			
-			&-title{
-				margin: 10px 0;
-				font-weight: bold;
-			}
-		}
-		
-	}
-	
+.rules-modal {
+
+    .ivu-modal-body {
+
+        .rule-item {
+            display: flex;
+            flex-direction: column;
+
+            &-title {
+                margin: 10px 0;
+                font-weight: bold;
+            }
+        }
+
+    }
+
 }
 
 
@@ -346,10 +347,11 @@
     justify-content: center;
     align-items: center;
 }
+
 /*向垂直水平居中*/
 .flex-col-center {
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
-}
+}

+ 43 - 4
TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.vue

@@ -64,6 +64,12 @@
         <TabPane :label="$t('evaluation.quickCreate')" name="name2" tab="newExerciseTab" v-if="isDevEnv">
           <BasePasteTool v-if="addNewModal" @addFinish="onAddNewFinish"></BasePasteTool>
         </TabPane>
+        <!-- <TabPane :label="`从题库挑选`" name="name3" tab="newExerciseTab">
+          <ManualCreate v-if="curModalTab === 'name3'" ref="bankPicker" :subjectCode="subjectCode" :periodCode="periodCode" :gradeCode="gradeCode"></ManualCreate>
+        </TabPane> -->
+        <TabPane :label="`从试卷挑选`" name="name4" tab="newExerciseTab">
+          <BasePaperItemPicker v-if="curModalTab === 'name4'" ref='paperPicker' :subjectCode="subjectCode" :periodCode="periodCode" :gradeCode="gradeCode"></BasePaperItemPicker>
+        </TabPane>
       </Tabs>
       <div slot="footer">
         <Button @click="addNewModal = false">{{$t('evaluation.cancel')}}</Button>
@@ -91,8 +97,11 @@
 </template>
 <script>
 import ExamPaperAnalysis from '@/view/learnactivity/ExamPaperAnalysis.vue'
+import ManualCreate from '@/view/learnactivity/ManualCreate.vue'
+
 export default {
   components: {
+    ManualCreate,
     ExamPaperAnalysis,
   },
   props: {
@@ -140,6 +149,18 @@ export default {
       type: Boolean,
       default: false
     },
+    gradeCode: {
+      type: Array,
+      default: () => []
+    },
+    subjectCode: {
+      type: String,
+      default: ''
+    },
+    periodCode: {
+      type: String,
+      default: ''
+    }
   },
   data() {
     return {
@@ -191,11 +212,17 @@ export default {
       downLoading: false,
       analysisTableData: [],
       viewModel: 'type',
-      paperDiff: 0
+      paperDiff: 0,
+      curModalTab: ''
 
     }
   },
   methods: {
+    getSelectedQuestion(val) {
+      // this.onAddNewFinish(val.item)
+      // this.paperInfo.item = this._.cloneDeep(val.item)
+
+    },
     /* 退出预览 */
     exitPreview() {
       this.$emit('exitPreview')
@@ -203,15 +230,23 @@ export default {
     /* 手动保存 */
     doSaveEdit() {
       this.editLoading = true
-      this.$refs.newEdit.getContent(this.$refs.newEdit.exersicesType)
+      if (this.curModalTab === 'name4') {
+        let newItems = this.$refs.paperPicker.checkList
+        this.onAddNewFinish(newItems)
+      } else if (this.curModalTab === 'name3') {
+        let newItems = this.$refs.bankPicker.shoppingQuestionList
+        this.onAddNewFinish(newItems)
+      } else {
+        this.$refs.newEdit.getContent(this.$refs.newEdit.exersicesType)
+      }
     },
     onTabChange(val) {
+      this.curModalTab = val
       // if (val === 'name1') {
       // 	this.isShowPasteTool = true
       // }
     },
     onClickOrderTemp(val) {
-      console.log(val);
       this.curOrderTempIndex = val
     },
     onChooseOrderTemp() {
@@ -222,7 +257,6 @@ export default {
     },
     /* 下载Blob答题卡 */
     async downloadSheet() {
-      console.log(this.paperInfo)
       this.downLoading = true
       let examId = this.paperInfo.examId
       let sheetMode = this.paperInfo.mode ? `(${this.paperInfo.mode})` : ``
@@ -409,6 +443,11 @@ export default {
     this.paperDiff = paper.item ? this.handleDiffCalc(paper.item) : 0
     this.curOrderTempIndex = paper.orderTemp || 0
 
+    console.error(this.$parent)
+    console.error(this.$parent.propPeriod)
+    console.error(this.$parent.propSubject)
+    console.error(this.$parent.propGrades)
+
   },
   computed: {
     isAuto() {

+ 1 - 0
TEAMModelOS/ClientApp/src/view/homework/ManageHomeWork.vue

@@ -858,6 +858,7 @@ export default {
     /** 新增作业成功回调 */
     onAddSuccess() {
       //this.addHwModal = false
+      this.continueToken = null
       this.isAddActivity = false
       this.split2 = 0
       this.getVoteList()

File diff suppressed because it is too large
+ 499 - 500
TEAMModelOS/ClientApp/src/view/learnactivity/ManualCreate.vue


+ 295 - 209
TEAMModelOS/ClientApp/src/view/mycourse/homework/Homework.vue

@@ -1,230 +1,316 @@
 <template>
-    <div class="hw-container">
-        <div class="ac-action-wrap">
-            <span class="action-item" @click="onCreateAc">
-                <Icon type="md-add" />
-                {{$t('cusMgt.cusTab9')}}
-            </span>
-        </div>
-        <vuescroll>
-            <div class="hw-item" v-for="(item,index) in hwList" :key="index" @click="toAcDetail(index)">
-                <Icon custom="iconfont icon-hw" class="list-icon" />
-                <div class="exam-info-wrap">
-                    <h3 class="exam-name">
-                        {{item.name}}
-                    </h3>
-                    <p class="exam-detail-wrap">
-                        <!-- 学校|个人 -->
-                        <Tag color="blue">
-                            {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
-                        </Tag>
-                        <!-- 活动进度状态 -->
-                        <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
-                            {{ item.progText }}
-                        </Tag>
-                        <Tag>
-                            <Icon type="md-time" size="16" />
-                            {{$jsFn.timeFormat(item.startTime)}}
-                        </Tag>
-                    </p>
-                </div>
-                <div class="item-action-wrap">
-                    <span style="float:right;margin-right:20px">
-                        <!-- 修改名称 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
-                        <!-- 删除记录 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
-                        <!-- 收藏 -->
-                        <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
-                    </span>
-                </div>
-            </div>
-            <EmptyData v-show="!hwList.length" :top="150"></EmptyData>
-        </vuescroll>
+  <div class="hw-container">
+    <div class="ac-action-wrap">
+      <span class="action-item" @click="onCreateAc">
+        <Icon type="md-add" />
+        {{$t('cusMgt.cusTab9')}}
+      </span>
     </div>
+    <Loading v-show="isLoading"></Loading>
+    <vuescroll>
+      <div class="hw-item" v-for="(item,index) in hwList" :key="index" @click="toAcDetail(index)">
+        <Icon custom="iconfont icon-hw" class="list-icon" />
+        <div class="exam-info-wrap">
+          <h3 class="exam-name">
+            {{item.name}}
+          </h3>
+          <p class="exam-detail-wrap">
+            <!-- 学校|个人 -->
+            <Tag color="blue">
+              {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
+            </Tag>
+            <!-- 活动进度状态 -->
+            <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
+              {{ item.progText }}
+            </Tag>
+            <Tag>
+              <Icon type="md-time" size="16" />
+              {{$jsFn.timeFormat(item.startTime)}}
+            </Tag>
+          </p>
+        </div>
+        <div class="item-action-wrap">
+          <span style="float:right;margin-right:20px">
+            <!-- 修改名称 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
+            <!-- 删除记录 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
+            <!-- 收藏 -->
+            <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
+          </span>
+        </div>
+      </div>
+      <EmptyData v-show="!hwList.length" :top="150"></EmptyData>
+    </vuescroll>
+    <!-- 修改评测名称 -->
+    <Modal v-model="editNameStatus" className="ed-name-modal" footer-hide>
+      <div slot="header" class="modal-header">
+        {{$t('learnActivity.mgtScEv.edName')}}
+      </div>
+      <div class="edit-name-content">
+        <p class="edit-name-label">
+          {{$t('cusMgt.listName')}}
+        </p>
+        <Input v-model="editName" :placeholder="$t('learnActivity.mgtScEv.edNameHolder')" />
+        <Button :loading="btnLoading" @click="confirmEditName" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
+      </div>
+    </Modal>
+  </div>
 </template>
 <script>
 export default {
-    props: {
-        //收藏id,双向绑定
-        value: {
-            type: Array,
-            default: () => {
-                return []
-            }
-        },
-        classInfo: {
-            type: Object,
-            default: () => {
-                return {}
+  props: {
+    //收藏id,双向绑定
+    value: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    classInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    courseInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data() {
+    return {
+      btnLoading: false,
+      editName: '',
+      editNameStatus: false,
+      edNameIndex: 0,
+      isLoading: false,
+      fIds: [],
+      hwList: []
+    }
+  },
+  methods: {
+    editEvName(index) {
+      this.editNameStatus = true
+      this.edNameIndex = index
+      this.editName = this.hwList[index]?.name
+    },
+    // 修改活动名称
+    confirmEditName() {
+      if (this.editName) {
+        this.btnLoading = true
+        this.$api.learnActivity.updateAcInfo({
+          id: this.hwList[this.edNameIndex].id,
+          code: this.hwList[this.edNameIndex].code,
+          name: this.editName
+        }).then(
+          res => {
+            if (res.code == 200) {
+              this.hwList[this.edNameIndex].name = this.editName
+              this.$Message.success(this.$t('learnActivity.mgtScEv.updOk'))
+            } else {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
             }
-        },
-        courseInfo: {
-            type: Object,
-            default: () => {
-                return {}
+          },
+          err => {
+            this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
+          }
+        ).finally(() => {
+          this.editNameStatus = false
+          this.btnLoading = false
+        })
+      } else {
+        this.$Message.warning(this.$t('learnActivity.mgtScEv.edNameHolder'))
+      }
+    },
+    delEv(ev) {
+      this.$Modal.confirm({
+        title: this.$t('cusMgt.delAcTitle'),
+        content: this.$t('cusMgt.delAcContent'),
+        onOk: () => {
+          this.isLoading = true
+          let params = {
+            id: ev.id,
+            code: ev.code.replace('Homework-', ''),
+            scope: ev.scope
+          }
+          this.$api.learnActivity.DeleteHomeWork(params).then(
+            res => {
+              if (!res.error) {
+                let index = this.hwList.findIndex(item => item.id === ev.id)
+                if (index > -1) {
+                  this.hwList.splice(index, 1)
+                }
+                this.$Message.success(this.$t('learnActivity.mgtScEv.deleteOk'))
+              } else {
+                this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
+              }
+            },
+            err => {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
             }
+          ).finally(() => {
+            setTimeout(() => {
+              this.isLoading = false
+            }, 500)
+          })
         }
+      })
     },
-    data() {
-        return {
-            fIds: [],
-            hwList: []
+    //收藏 取消
+    toggleFavorite(data) {
+      if (data && data.id) {
+        if (this.isFavorite(data.id)) {
+          this.delCollection(data) //取消收藏
+        } else {
+          this.collection(data) //收藏
         }
+      }
     },
-    methods: {
-        //收藏 取消
-        toggleFavorite(data) {
-            if (data && data.id) {
-                if (this.isFavorite(data.id)) {
-                    this.delCollection(data) //取消收藏
-                } else {
-                    this.collection(data) //收藏
-                }
-            }
-        },
-        collection(data) {
-            let params = {
-                favorite: {
-                    "name": data.name,
-                    "id": data.id,
-                    "code": this.$store.state.userInfo.TEAMModelId,
-                    "fromId": data.id,
-                    "fromCode": data.code,
-                    "scope": data.scope,
-                    "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
-                    "type": data.pk
-                }
-            }
-            this.$api.courseMgmt.FavoriteUpsert(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.fvtOk'))
-                    this.fIds.push(data.id)
-                    this.$emit("on-favorite-change", this.fIds)
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.fvtOk'))
-                }
-            )
-        },
-        delCollection(data) {
-            let params = {
-                "id": data.id,
-                "code": this.$store.state.userInfo.TEAMModelId,
-            }
-            this.$api.courseMgmt.FavoriteDelete(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.unfvtOk'))
-                    let index = this.fIds.findIndex(item => item == data.id)
-                    if (index > -1) {
-                        this.fIds.splice(index, 1)
-                        this.$emit("on-favorite-change", this.fIds)
-                    }
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.unfvtErr'))
-                }
-            )
-        },
-        /* 新建活动 跳转活动创建页面 */
-        async onCreateAc() {
-            if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
-                this.$Message.warning(this.$t('cusMgt.noCusTips2'))
-                return
-            }
-            let isFull = await this.$tools.isBlobContainerFull('private')
-            if (isFull) {
-                this.$Message.warning(this.$t('vote.fullTip'))
-            } else {
-                this.$router.push({
-                    name: 'manageHomeWork',
-                    params: {
-                        isAdd: true,
-                        classInfo: this.classInfo,
-                        courseInfo:this.courseInfo
-                    }
-                })
-            }
+    collection(data) {
+      let params = {
+        favorite: {
+          "name": data.name,
+          "id": data.id,
+          "code": this.$store.state.userInfo.TEAMModelId,
+          "fromId": data.id,
+          "fromCode": data.code,
+          "scope": data.scope,
+          "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+          "type": data.pk
+        }
+      }
+      this.$api.courseMgmt.FavoriteUpsert(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.fvtOk'))
+          this.fIds.push(data.id)
+          this.$emit("on-favorite-change", this.fIds)
         },
-        isFavorite(id) {
-            return this.fIds.includes(id)
+        err => {
+          this.$Message.error(this.$t('cusMgt.fvtOk'))
+        }
+      )
+    },
+    delCollection(data) {
+      let params = {
+        "id": data.id,
+        "code": this.$store.state.userInfo.TEAMModelId,
+      }
+      this.$api.courseMgmt.FavoriteDelete(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.unfvtOk'))
+          let index = this.fIds.findIndex(item => item == data.id)
+          if (index > -1) {
+            this.fIds.splice(index, 1)
+            this.$emit("on-favorite-change", this.fIds)
+          }
         },
-        toAcDetail(index) {
-            this.$router.push({
-                name: 'manageHomeWork',
-                params: {
-                    ac: this.hwList[index]
-                }
+        err => {
+          this.$Message.error(this.$t('cusMgt.unfvtErr'))
+        }
+      )
+    },
+    /* 新建活动 跳转活动创建页面 */
+    async onCreateAc() {
+      if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
+        this.$Message.warning(this.$t('cusMgt.noCusTips2'))
+        return
+      }
+      let isFull = await this.$tools.isBlobContainerFull('private')
+      if (isFull) {
+        this.$Message.warning(this.$t('vote.fullTip'))
+      } else {
+        this.$router.push({
+          name: 'manageHomeWork',
+          params: {
+            isAdd: true,
+            classInfo: this.classInfo,
+            courseInfo: this.courseInfo
+          }
+        })
+      }
+    },
+    isFavorite(id) {
+      return this.fIds.includes(id)
+    },
+    toAcDetail(index) {
+      this.$router.push({
+        name: 'manageHomeWork',
+        params: {
+          ac: this.hwList[index]
+        }
+      })
+    },
+    getStatusInfo(progress) {
+      let info = {}
+      if (progress == 'pending') {
+        info.progText = this.$t('learnActivity.mgtScEv.pending')
+        info.progColor = '#2d8cf0'
+      } else if (progress == 'going') {
+        info.progText = this.$t('learnActivity.mgtScEv.going')
+        info.progColor = '#19be6b'
+      } else if (progress == 'finish') {
+        info.progText = this.$t('learnActivity.mgtScEv.finish')
+        info.progColor = '#515a6e'
+      }
+      return info
+    },
+    //获取活动列表
+    findTchAc(classId) {
+      this.examList = []
+      this.isShowGrade = false
+      this.isLoading = true
+      let requestData = {
+        school: this.$store.state.userInfo.schoolCode,
+        classes: [classId],
+        userid: this.$store.state.userInfo.TEAMModelId,
+        pk: 'Homework'
+      }
+      this.$api.courseMgmt.findTchAc(requestData).then(
+        res => {
+          if (!res.error) {
+            res.datas.forEach(item => {
+              let statusInfo = this.getStatusInfo(item.progress)
+              item.progText = statusInfo.progText
+              item.progColor = statusInfo.progColor
             })
-        },
-        getStatusInfo(progress) {
-            let info = {}
-            if (progress == 'pending') {
-                info.progText = this.$t('learnActivity.mgtScEv.pending')
-                info.progColor = '#2d8cf0'
-            } else if (progress == 'going') {
-                info.progText = this.$t('learnActivity.mgtScEv.going')
-                info.progColor = '#19be6b'
-            } else if (progress == 'finish') {
-                info.progText = this.$t('learnActivity.mgtScEv.finish')
-                info.progColor = '#515a6e'
-            }
-            return info
-        },
-        //获取活动列表
-        findTchAc(classId) {
-            this.examList = []
-            this.isShowGrade = false
-            this.isLoading = true
-            let requestData = {
-                school: this.$store.state.userInfo.schoolCode,
-                classes: [classId],
-                userid: this.$store.state.userInfo.TEAMModelId,
-                pk: 'Homework'
-            }
-            this.$api.courseMgmt.findTchAc(requestData).then(
-                res => {
-                    if (!res.error) {
-                        res.datas.forEach(item => {
-                            let statusInfo = this.getStatusInfo(item.progress)
-                            item.progText = statusInfo.progText
-                            item.progColor = statusInfo.progColor
-                        })
-                        res.datas.sort((a, b) => {
-                            return a.startTime - b.startTime > 0 ? -1 : 1
-                        })
-                        this.hwList = res.datas
-                    }
-                },
-                err => {
-                    // this.$Message.error('API error')
-                }
-            ).finally(() => {
-                this.isLoading = false
+            res.datas.sort((a, b) => {
+              return a.startTime - b.startTime > 0 ? -1 : 1
             })
+            this.hwList = res.datas
+          }
         },
+        err => {
+          // this.$Message.error('API error')
+        }
+      ).finally(() => {
+        this.isLoading = false
+      })
     },
-    watch: {
-        classInfo: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                console.log(n)
-                if (n && (n.classId || n.stulist)) {
-                    this.findTchAc(n.classId || n.stulist)
-                } else {
-                    this.hwList = []
-                }
-            }
-        },
-        value: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                this.fIds = n
-            }
+  },
+  watch: {
+    classInfo: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        console.log(n)
+        if (n && (n.classId || n.stulist)) {
+          this.findTchAc(n.classId || n.stulist)
+        } else {
+          this.hwList = []
         }
+      }
+    },
+    value: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        this.fIds = n
+      }
     }
+  }
 }
 </script>
 <style lang="less" scoped>
@@ -232,6 +318,6 @@ export default {
 </style>
 <style lang="less">
 .hw-container .ivu-list-item:hover {
-    background: var(--active-item-start);
+  background: var(--active-item-start);
 }
 </style>

+ 299 - 214
TEAMModelOS/ClientApp/src/view/mycourse/survey/Survey.vue

@@ -1,235 +1,320 @@
 <template>
-    <div class="hw-container">
-        <div class="ac-action-wrap">
-            <span class="action-item" @click="onCreateAc">
-                <Icon type="md-add" />
-                {{$t('cusMgt.cusTab11')}}
-            </span>
-        </div>
-        <vuescroll>
-            <div class="survey-item" v-for="(item,index) in surveyList" :key="index" @click="toAcDetail(index)">
-                <Icon custom="iconfont icon-vote" class="list-icon" />
-                <div class="exam-info-wrap">
-                    <h3 class="exam-name">
-                        {{item.name}}
-                    </h3>
-                    <p class="exam-detail-wrap">
-                        <!-- 学校|个人 -->
-                        <Tag color="blue">
-                            {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
-                        </Tag>
-                        <!-- 活动进度状态 -->
-                        <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
-                            {{ item.progText }}
-                        </Tag>
-                        <Tag>
-                            <Icon type="md-time" size="16" />
-                            {{$jsFn.timeFormat(item.startTime)}}
-                        </Tag>
-                    </p>
-                </div>
-                <div class="item-action-wrap">
-                    <span style="float:right;margin-right:20px">
-                        <!-- 修改评测名称 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
-                        <!-- 删除记录 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
-                        <!-- 收藏 -->
-                        <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
-                    </span>
-                </div>
-            </div>
-            <EmptyData v-show="!surveyList.length" :top="150"></EmptyData>
-        </vuescroll>
+  <div class="hw-container">
+    <div class="ac-action-wrap">
+      <span class="action-item" @click="onCreateAc">
+        <Icon type="md-add" />
+        {{$t('cusMgt.cusTab11')}}
+      </span>
     </div>
+    <Loading v-show="isLoading"></Loading>
+    <vuescroll>
+      <div class="survey-item" v-for="(item,index) in surveyList" :key="index" @click="toAcDetail(index)">
+        <Icon custom="iconfont icon-vote" class="list-icon" />
+        <div class="exam-info-wrap">
+          <h3 class="exam-name">
+            {{item.name}}
+          </h3>
+          <p class="exam-detail-wrap">
+            <!-- 学校|个人 -->
+            <Tag color="blue">
+              {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
+            </Tag>
+            <!-- 活动进度状态 -->
+            <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
+              {{ item.progText }}
+            </Tag>
+            <Tag>
+              <Icon type="md-time" size="16" />
+              {{$jsFn.timeFormat(item.startTime)}}
+            </Tag>
+          </p>
+        </div>
+        <div class="item-action-wrap">
+          <span style="float:right;margin-right:20px">
+            <!-- 修改评测名称 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
+            <!-- 删除记录 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
+            <!-- 收藏 -->
+            <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
+          </span>
+        </div>
+      </div>
+      <EmptyData v-show="!surveyList.length" :top="150"></EmptyData>
+    </vuescroll>
+    <Modal v-model="editNameStatus" className="ed-name-modal" footer-hide>
+      <div slot="header" class="modal-header">
+        {{$t('learnActivity.mgtScEv.edName')}}
+      </div>
+      <div class="edit-name-content">
+        <p class="edit-name-label">
+          {{$t('cusMgt.listName')}}
+        </p>
+        <Input v-model="editName" :placeholder="$t('learnActivity.mgtScEv.edNameHolder')" />
+        <Button :loading="btnLoading" @click="confirmEditName" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
+      </div>
+    </Modal>
+  </div>
 </template>
 <script>
 export default {
-    props: {
-        courseInfo: {
-            type: Object,
-            default: () => {
-                return {}
-            }
-        },
-        classInfo: {
-            type: Object,
-            default: () => {
-                return {}
-            }
-        },
-        //收藏id,双向绑定
-        value: {
-            type: Array,
-            default: () => {
-                return []
-            }
-        },
+  props: {
+    courseInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
     },
-    model: {
-        prop: "value", //绑定的值,通过父组件传递
-        event: "on-favorite-change", //自定义时间名    
+    classInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
     },
-    data() {
-        return {
-            fIds: [],
-            surveyList: []
-        }
+    //收藏id,双向绑定
+    value: {
+      type: Array,
+      default: () => {
+        return []
+      }
     },
-    methods: {
-        //收藏 取消
-        toggleFavorite(data) {
-            if (data && data.id) {
-                if (this.isFavorite(data.id)) {
-                    this.delCollection(data) //取消收藏
-                } else {
-                    this.collection(data) //收藏
-                }
-            }
-        },
-        collection(data) {
-            let params = {
-                favorite: {
-                    "name": data.name,
-                    "id": data.id,
-                    "code": this.$store.state.userInfo.TEAMModelId,
-                    "fromId": data.id,
-                    "fromCode": data.code,
-                    "scope": data.scope,
-                    "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
-                    "type": data.pk
-                }
-            }
-            this.$api.courseMgmt.FavoriteUpsert(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.fvtOk'))
-                    this.fIds.push(data.id)
-                    this.$emit("on-favorite-change", this.fIds)
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.fvtOk'))
-                }
-            )
-        },
-        delCollection(data) {
-            let params = {
-                "id": data.id,
-                "code": this.$store.state.userInfo.TEAMModelId,
+  },
+  model: {
+    prop: "value", //绑定的值,通过父组件传递
+    event: "on-favorite-change", //自定义时间名    
+  },
+  data() {
+    return {
+      btnLoading: false,
+      editName: '',
+      editNameStatus: false,
+      edNameIndex: 0,
+      isLoading: false,
+      fIds: [],
+      surveyList: []
+    }
+  },
+  methods: {
+    editEvName(index) {
+      this.editNameStatus = true
+      this.edNameIndex = index
+      this.editName = this.surveyList[index]?.name
+    },
+    // 修改活动名称
+    confirmEditName() {
+      if (this.editName) {
+        this.btnLoading = true
+        this.$api.learnActivity.updateAcInfo({
+          id: this.surveyList[this.edNameIndex].id,
+          code: this.surveyList[this.edNameIndex].code,
+          name: this.editName
+        }).then(
+          res => {
+            if (res.code == 200) {
+              this.surveyList[this.edNameIndex].name = this.editName
+              this.$Message.success(this.$t('learnActivity.mgtScEv.updOk'))
+            } else {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
             }
-            this.$api.courseMgmt.FavoriteDelete(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.unfvtOk'))
-                    let index = this.fIds.findIndex(item => item == data.id)
-                    if (index > -1) {
-                        this.fIds.splice(index, 1)
-                        this.$emit("on-favorite-change", this.fIds)
-                    }
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.unfvtErr'))
+          },
+          err => {
+            this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
+          }
+        ).finally(() => {
+          this.editNameStatus = false
+          this.btnLoading = false
+        })
+      } else {
+        this.$Message.warning(this.$t('learnActivity.mgtScEv.edNameHolder'))
+      }
+    },
+    delEv(ev) {
+      this.$Modal.confirm({
+        title: this.$t('cusMgt.delAcTitle'),
+        content: this.$t('cusMgt.delAcContent'),
+        onOk: () => {
+          this.isLoading = true
+          let params = {
+            id: ev.id,
+            code: ev.code.replace('Homework-', ''),
+            scope: ev.scope
+          }
+          this.$api.questionnaire.DeleteSurvey(params).then(
+            res => {
+              if (!res.error) {
+                let index = this.surveyList.findIndex(item => item.id === ev.id)
+                if (index > -1) {
+                  this.surveyList.splice(index, 1)
                 }
-            )
-        },
-        /* 新建活动 跳转活动创建页面 */
-        async onCreateAc() {
-            if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
-                this.$Message.warning(this.$t('cusMgt.noCusTips4'))
-                return
-            }
-            let isFull = await this.$tools.isBlobContainerFull('private')
-            if (isFull) {
-                this.$Message.warning(this.$t('vote.fullTip'))
-            } else {
-                this.$router.push({
-                    name: 'personalSurvey',
-                    params: {
-                        isAdd: true,
-                        classInfo: this.classInfo,
-                        courseInfo: this.courseInfo
-                    }
-                })
+                this.$Message.success(this.$t('learnActivity.mgtScEv.deleteOk'))
+              } else {
+                this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
+              }
+            },
+            err => {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
             }
+          ).finally(() => {
+            setTimeout(() => {
+              this.isLoading = false
+            }, 500)
+          })
+        }
+      })
+    },
+    //收藏 取消
+    toggleFavorite(data) {
+      if (data && data.id) {
+        if (this.isFavorite(data.id)) {
+          this.delCollection(data) //取消收藏
+        } else {
+          this.collection(data) //收藏
+        }
+      }
+    },
+    collection(data) {
+      let params = {
+        favorite: {
+          "name": data.name,
+          "id": data.id,
+          "code": this.$store.state.userInfo.TEAMModelId,
+          "fromId": data.id,
+          "fromCode": data.code,
+          "scope": data.scope,
+          "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+          "type": data.pk
+        }
+      }
+      this.$api.courseMgmt.FavoriteUpsert(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.fvtOk'))
+          this.fIds.push(data.id)
+          this.$emit("on-favorite-change", this.fIds)
         },
-        isFavorite(id) {
-            return this.fIds.includes(id)
+        err => {
+          this.$Message.error(this.$t('cusMgt.fvtOk'))
+        }
+      )
+    },
+    delCollection(data) {
+      let params = {
+        "id": data.id,
+        "code": this.$store.state.userInfo.TEAMModelId,
+      }
+      this.$api.courseMgmt.FavoriteDelete(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.unfvtOk'))
+          let index = this.fIds.findIndex(item => item == data.id)
+          if (index > -1) {
+            this.fIds.splice(index, 1)
+            this.$emit("on-favorite-change", this.fIds)
+          }
         },
-        toAcDetail(index) {
-            let owner = this.surveyList[index].owner
-            this.$router.push({
-                name: owner == 'school' ? 'manageQuestionnaire' : 'personalSurvey',
-                params: {
-                    ac: this.surveyList[index]
-                }
+        err => {
+          this.$Message.error(this.$t('cusMgt.unfvtErr'))
+        }
+      )
+    },
+    /* 新建活动 跳转活动创建页面 */
+    async onCreateAc() {
+      if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
+        this.$Message.warning(this.$t('cusMgt.noCusTips4'))
+        return
+      }
+      let isFull = await this.$tools.isBlobContainerFull('private')
+      if (isFull) {
+        this.$Message.warning(this.$t('vote.fullTip'))
+      } else {
+        this.$router.push({
+          name: 'personalSurvey',
+          params: {
+            isAdd: true,
+            classInfo: this.classInfo,
+            courseInfo: this.courseInfo
+          }
+        })
+      }
+    },
+    isFavorite(id) {
+      return this.fIds.includes(id)
+    },
+    toAcDetail(index) {
+      let owner = this.surveyList[index].owner
+      this.$router.push({
+        name: owner == 'school' ? 'manageQuestionnaire' : 'personalSurvey',
+        params: {
+          ac: this.surveyList[index]
+        }
+      })
+    },
+    getStatusInfo(progress) {
+      let info = {}
+      if (progress == 'pending') {
+        info.progText = this.$t('learnActivity.mgtScEv.pending')
+        info.progColor = '#2d8cf0'
+      } else if (progress == 'going') {
+        info.progText = this.$t('learnActivity.mgtScEv.going')
+        info.progColor = '#19be6b'
+      } else if (progress == 'finish') {
+        info.progText = this.$t('learnActivity.mgtScEv.finish')
+        info.progColor = '#515a6e'
+      }
+      return info
+    },
+    //获取活动列表
+    findTchAc(classId) {
+      this.examList = []
+      this.isShowGrade = false
+      this.isLoading = true
+      let requestData = {
+        school: this.$store.state.userInfo.schoolCode,
+        classes: [classId],
+        userid: this.$store.state.userInfo.TEAMModelId,
+        pk: 'Survey'
+      }
+      this.$api.courseMgmt.findTchAc(requestData).then(
+        res => {
+          if (!res.error) {
+            res.datas.forEach(item => {
+              let statusInfo = this.getStatusInfo(item.progress)
+              item.progText = statusInfo.progText
+              item.progColor = statusInfo.progColor
             })
-        },
-        getStatusInfo(progress) {
-            let info = {}
-            if (progress == 'pending') {
-                info.progText = this.$t('learnActivity.mgtScEv.pending')
-                info.progColor = '#2d8cf0'
-            } else if (progress == 'going') {
-                info.progText = this.$t('learnActivity.mgtScEv.going')
-                info.progColor = '#19be6b'
-            } else if (progress == 'finish') {
-                info.progText = this.$t('learnActivity.mgtScEv.finish')
-                info.progColor = '#515a6e'
-            }
-            return info
-        },
-        //获取活动列表
-        findTchAc(classId) {
-            this.examList = []
-            this.isShowGrade = false
-            this.isLoading = true
-            let requestData = {
-                school: this.$store.state.userInfo.schoolCode,
-                classes: [classId],
-                userid: this.$store.state.userInfo.TEAMModelId,
-                pk: 'Survey'
-            }
-            this.$api.courseMgmt.findTchAc(requestData).then(
-                res => {
-                    if (!res.error) {
-                        res.datas.forEach(item => {
-                            let statusInfo = this.getStatusInfo(item.progress)
-                            item.progText = statusInfo.progText
-                            item.progColor = statusInfo.progColor
-                        })
-                        res.datas.sort((a, b) => {
-                            return a.startTime - b.startTime > 0 ? -1 : 1
-                        })
-                        this.surveyList = res.datas
-                    }
-                },
-                err => {
-                    // this.$Message.error('API error')
-                }
-            ).finally(() => {
-                this.isLoading = false
+            res.datas.sort((a, b) => {
+              return a.startTime - b.startTime > 0 ? -1 : 1
             })
+            this.surveyList = res.datas
+          }
         },
+        err => {
+          // this.$Message.error('API error')
+        }
+      ).finally(() => {
+        this.isLoading = false
+      })
     },
-    watch: {
-        classInfo: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                console.log(n)
-                if (n && (n.classId || n.stulist)) {
-                    this.findTchAc(n.classId || n.stulist)
-                } else {
-                    this.surveyList = []
-                }
-            }
-        },
-        value: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                this.fIds = n
-            }
+  },
+  watch: {
+    classInfo: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        console.log(n)
+        if (n && (n.classId || n.stulist)) {
+          this.findTchAc(n.classId || n.stulist)
+        } else {
+          this.surveyList = []
         }
+      }
+    },
+    value: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        this.fIds = n
+      }
     }
+  }
 }
 </script>
 <style lang="less" scoped>
@@ -237,6 +322,6 @@ export default {
 </style>
 <style lang="less">
 .hw-container .ivu-list-item:hover {
-    background: var(--active-item-start);
+  background: var(--active-item-start);
 }
 </style>

+ 294 - 209
TEAMModelOS/ClientApp/src/view/mycourse/vote/Vote.vue

@@ -1,230 +1,315 @@
 <template>
-    <div class="hw-container">
-        <div class="ac-action-wrap">
-            <span class="action-item" @click="onCreateAc">
-                <Icon type="md-add" />
-                {{$t('cusMgt.cusTab12')}}
-            </span>
-        </div>
-        <vuescroll>
-            <div class="vote-item" v-for="(item,index) in voteList" :key="index" @click="toAcDetail(index)">
-                <Icon custom="iconfont icon-vote" class="list-icon" />
-                <div class="exam-info-wrap">
-                    <h3 class="exam-name">
-                        {{item.name}}
-                    </h3>
-                    <p class="exam-detail-wrap">
-                        <!-- 学校|个人 -->
-                        <Tag color="blue">
-                            {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
-                        </Tag>
-                        <!-- 活动进度状态 -->
-                        <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
-                            {{ item.progText }}
-                        </Tag>
-                        <Tag>
-                            <Icon type="md-time" size="16" />
-                            {{$jsFn.timeFormat(item.startTime)}}
-                        </Tag>
-                    </p>
-                </div>
-                <div class="item-action-wrap">
-                    <span style="float:right;margin-right:20px">
-                        <!-- 修改评测名称 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
-                        <!-- 删除记录 -->
-                        <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
-                        <!-- 收藏 -->
-                        <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
-                    </span>
-                </div>
-            </div>
-            <EmptyData v-show="!voteList.length" :top="150"></EmptyData>
-        </vuescroll>
+  <div class="hw-container">
+    <div class="ac-action-wrap">
+      <span class="action-item" @click="onCreateAc">
+        <Icon type="md-add" />
+        {{$t('cusMgt.cusTab12')}}
+      </span>
     </div>
+    <Loading v-show="isLoading"></Loading>
+    <vuescroll>
+      <div class="vote-item" v-for="(item,index) in voteList" :key="index" @click="toAcDetail(index)">
+        <Icon custom="iconfont icon-vote" class="list-icon" />
+        <div class="exam-info-wrap">
+          <h3 class="exam-name">
+            {{item.name}}
+          </h3>
+          <p class="exam-detail-wrap">
+            <!-- 学校|个人 -->
+            <Tag color="blue">
+              {{ item.owner == 'school' ? $t('cusMgt.school') : $t('cusMgt.private') }}
+            </Tag>
+            <!-- 活动进度状态 -->
+            <Tag :color="item.progress == 'going' ? 'success' : 'warning'">
+              {{ item.progText }}
+            </Tag>
+            <Tag>
+              <Icon type="md-time" size="16" />
+              {{$jsFn.timeFormat(item.startTime)}}
+            </Tag>
+          </p>
+        </div>
+        <div class="item-action-wrap">
+          <span style="float:right;margin-right:20px">
+            <!-- 修改评测名称 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
+            <!-- 删除记录 -->
+            <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
+            <!-- 收藏 -->
+            <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
+          </span>
+        </div>
+      </div>
+      <EmptyData v-show="!voteList.length" :top="150"></EmptyData>
+    </vuescroll>
+    <Modal v-model="editNameStatus" className="ed-name-modal" footer-hide>
+      <div slot="header" class="modal-header">
+        {{$t('learnActivity.mgtScEv.edName')}}
+      </div>
+      <div class="edit-name-content">
+        <p class="edit-name-label">
+          {{$t('cusMgt.listName')}}
+        </p>
+        <Input v-model="editName" :placeholder="$t('learnActivity.mgtScEv.edNameHolder')" />
+        <Button :loading="btnLoading" @click="confirmEditName" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
+      </div>
+    </Modal>
+  </div>
 </template>
 <script>
 export default {
-    props: {
-        //收藏id,双向绑定
-        value: {
-            type: Array,
-            default: () => {
-                return []
-            }
-        },
-        classInfo: {
-            type: Object,
-            default: () => {
-                return {}
+  props: {
+    //收藏id,双向绑定
+    value: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    classInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    courseInfo: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data() {
+    return {
+      btnLoading: false,
+      editName: '',
+      editNameStatus: false,
+      edNameIndex: 0,
+      isLoading: false,
+      fIds: [],
+      voteList: []
+    }
+  },
+  methods: {
+    editEvName(index) {
+      this.editNameStatus = true
+      this.edNameIndex = index
+      this.editName = this.voteList[index]?.name
+    },
+    // 修改活动名称
+    confirmEditName() {
+      if (this.editName) {
+        this.btnLoading = true
+        this.$api.learnActivity.updateAcInfo({
+          id: this.voteList[this.edNameIndex].id,
+          code: this.voteList[this.edNameIndex].code,
+          name: this.editName
+        }).then(
+          res => {
+            if (res.code == 200) {
+              this.voteList[this.edNameIndex].name = this.editName
+              this.$Message.success(this.$t('learnActivity.mgtScEv.updOk'))
+            } else {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
             }
-        },
-        courseInfo: {
-            type: Object,
-            default: () => {
-                return {}
+          },
+          err => {
+            this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
+          }
+        ).finally(() => {
+          this.editNameStatus = false
+          this.btnLoading = false
+        })
+      } else {
+        this.$Message.warning(this.$t('learnActivity.mgtScEv.edNameHolder'))
+      }
+    },
+    delEv(ev) {
+      this.$Modal.confirm({
+        title: this.$t('cusMgt.delAcTitle'),
+        content: this.$t('cusMgt.delAcContent'),
+        onOk: () => {
+          this.isLoading = true
+          let params = {
+            id: ev.id,
+            code: ev.code.replace('Homework-', ''),
+            scope: ev.scope
+          }
+          this.$api.questionnaire.DeleteSurvey(params).then(
+            res => {
+              if (!res.error) {
+                let index = this.voteList.findIndex(item => item.id === ev.id)
+                if (index > -1) {
+                  this.voteList.splice(index, 1)
+                }
+                this.$Message.success(this.$t('learnActivity.mgtScEv.deleteOk'))
+              } else {
+                this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
+              }
+            },
+            err => {
+              this.$Message.error(this.$t('learnActivity.mgtScEv.deleteErr'))
             }
+          ).finally(() => {
+            setTimeout(() => {
+              this.isLoading = false
+            }, 500)
+          })
         }
+      })
     },
-    data() {
-        return {
-            fIds: [],
-            voteList: []
+    //收藏 取消
+    toggleFavorite(data) {
+      if (data && data.id) {
+        if (this.isFavorite(data.id)) {
+          this.delCollection(data) //取消收藏
+        } else {
+          this.collection(data) //收藏
         }
+      }
     },
-    methods: {
-        //收藏 取消
-        toggleFavorite(data) {
-            if (data && data.id) {
-                if (this.isFavorite(data.id)) {
-                    this.delCollection(data) //取消收藏
-                } else {
-                    this.collection(data) //收藏
-                }
-            }
-        },
-        collection(data) {
-            let params = {
-                favorite: {
-                    "name": data.name,
-                    "id": data.id,
-                    "code": this.$store.state.userInfo.TEAMModelId,
-                    "fromId": data.id,
-                    "fromCode": data.code,
-                    "scope": data.scope,
-                    "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
-                    "type": data.pk
-                }
-            }
-            this.$api.courseMgmt.FavoriteUpsert(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.fvtOk'))
-                    this.fIds.push(data.id)
-                    this.$emit("on-favorite-change", this.fIds)
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.fvtOk'))
-                }
-            )
-        },
-        delCollection(data) {
-            let params = {
-                "id": data.id,
-                "code": this.$store.state.userInfo.TEAMModelId,
-            }
-            this.$api.courseMgmt.FavoriteDelete(params).then(
-                res => {
-                    this.$Message.success(this.$t('cusMgt.unfvtOk'))
-                    let index = this.fIds.findIndex(item => item == data.id)
-                    if (index > -1) {
-                        this.fIds.splice(index, 1)
-                        this.$emit("on-favorite-change", this.fIds)
-                    }
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.unfvtErr'))
-                }
-            )
-        },
-        /* 新建活动 跳转活动创建页面 */
-        async onCreateAc() {
-            if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
-                this.$Message.warning(this.$t('cusMgt.noCusTips3'))
-                return
-            }
-            let isFull = await this.$tools.isBlobContainerFull('private')
-            if (isFull) {
-                this.$Message.warning(this.$t('vote.fullTip'))
-            } else {
-                this.$router.push({
-                    name: 'personalVote',
-                    params: {
-                        isAdd: true,
-                        classInfo: this.classInfo,
-                        courseInfo: this.courseInfo
-                    }
-                })
-            }
+    collection(data) {
+      let params = {
+        favorite: {
+          "name": data.name,
+          "id": data.id,
+          "code": this.$store.state.userInfo.TEAMModelId,
+          "fromId": data.id,
+          "fromCode": data.code,
+          "scope": data.scope,
+          "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+          "type": data.pk
+        }
+      }
+      this.$api.courseMgmt.FavoriteUpsert(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.fvtOk'))
+          this.fIds.push(data.id)
+          this.$emit("on-favorite-change", this.fIds)
         },
-        isFavorite(id) {
-            return this.fIds.includes(id)
+        err => {
+          this.$Message.error(this.$t('cusMgt.fvtOk'))
+        }
+      )
+    },
+    delCollection(data) {
+      let params = {
+        "id": data.id,
+        "code": this.$store.state.userInfo.TEAMModelId,
+      }
+      this.$api.courseMgmt.FavoriteDelete(params).then(
+        res => {
+          this.$Message.success(this.$t('cusMgt.unfvtOk'))
+          let index = this.fIds.findIndex(item => item == data.id)
+          if (index > -1) {
+            this.fIds.splice(index, 1)
+            this.$emit("on-favorite-change", this.fIds)
+          }
         },
-        toAcDetail(index) {
-            this.$router.push({
-                name: 'personalVote',
-                params: {
-                    ac: this.voteList[index]
-                }
+        err => {
+          this.$Message.error(this.$t('cusMgt.unfvtErr'))
+        }
+      )
+    },
+    /* 新建活动 跳转活动创建页面 */
+    async onCreateAc() {
+      if (!this.courseInfo.id || !this.classInfo || (!this.classInfo.classId && !this.classInfo.stulist)) {
+        this.$Message.warning(this.$t('cusMgt.noCusTips3'))
+        return
+      }
+      let isFull = await this.$tools.isBlobContainerFull('private')
+      if (isFull) {
+        this.$Message.warning(this.$t('vote.fullTip'))
+      } else {
+        this.$router.push({
+          name: 'personalVote',
+          params: {
+            isAdd: true,
+            classInfo: this.classInfo,
+            courseInfo: this.courseInfo
+          }
+        })
+      }
+    },
+    isFavorite(id) {
+      return this.fIds.includes(id)
+    },
+    toAcDetail(index) {
+      this.$router.push({
+        name: 'personalVote',
+        params: {
+          ac: this.voteList[index]
+        }
+      })
+    },
+    getStatusInfo(progress) {
+      let info = {}
+      if (progress == 'pending') {
+        info.progText = this.$t('learnActivity.mgtScEv.pending')
+        info.progColor = '#2d8cf0'
+      } else if (progress == 'going') {
+        info.progText = this.$t('learnActivity.mgtScEv.going')
+        info.progColor = '#19be6b'
+      } else if (progress == 'finish') {
+        info.progText = this.$t('learnActivity.mgtScEv.finish')
+        info.progColor = '#515a6e'
+      }
+      return info
+    },
+    //获取活动列表
+    findTchAc(classId) {
+      this.examList = []
+      this.isShowGrade = false
+      this.isLoading = true
+      let requestData = {
+        school: this.$store.state.userInfo.schoolCode,
+        classes: [classId],
+        userid: this.$store.state.userInfo.TEAMModelId,
+        pk: 'Vote'
+      }
+      this.$api.courseMgmt.findTchAc(requestData).then(
+        res => {
+          if (!res.error) {
+            res.datas.forEach(item => {
+              let statusInfo = this.getStatusInfo(item.progress)
+              item.progText = statusInfo.progText
+              item.progColor = statusInfo.progColor
             })
-        },
-        getStatusInfo(progress) {
-            let info = {}
-            if (progress == 'pending') {
-                info.progText = this.$t('learnActivity.mgtScEv.pending')
-                info.progColor = '#2d8cf0'
-            } else if (progress == 'going') {
-                info.progText = this.$t('learnActivity.mgtScEv.going')
-                info.progColor = '#19be6b'
-            } else if (progress == 'finish') {
-                info.progText = this.$t('learnActivity.mgtScEv.finish')
-                info.progColor = '#515a6e'
-            }
-            return info
-        },
-        //获取活动列表
-        findTchAc(classId) {
-            this.examList = []
-            this.isShowGrade = false
-            this.isLoading = true
-            let requestData = {
-                school: this.$store.state.userInfo.schoolCode,
-                classes: [classId],
-                userid: this.$store.state.userInfo.TEAMModelId,
-                pk: 'Vote'
-            }
-            this.$api.courseMgmt.findTchAc(requestData).then(
-                res => {
-                    if (!res.error) {
-                        res.datas.forEach(item => {
-                            let statusInfo = this.getStatusInfo(item.progress)
-                            item.progText = statusInfo.progText
-                            item.progColor = statusInfo.progColor
-                        })
-                        res.datas.sort((a, b) => {
-                            return a.startTime - b.startTime > 0 ? -1 : 1
-                        })
-                        this.voteList = res.datas
-                    }
-                },
-                err => {
-                    // this.$Message.error('API error')
-                }
-            ).finally(() => {
-                this.isLoading = false
+            res.datas.sort((a, b) => {
+              return a.startTime - b.startTime > 0 ? -1 : 1
             })
+            this.voteList = res.datas
+          }
         },
+        err => {
+          // this.$Message.error('API error')
+        }
+      ).finally(() => {
+        this.isLoading = false
+      })
     },
-    watch: {
-        classInfo: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                console.log(n)
-                if (n && (n.classId || n.stulist)) {
-                    this.findTchAc(n.classId || n.stulist)
-                } else {
-                    this.voteList = []
-                }
-            }
-        },
-        value: {
-            deep: true,
-            immediate: true,
-            handler(n, o) {
-                this.fIds = n
-            }
+  },
+  watch: {
+    classInfo: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        console.log(n)
+        if (n && (n.classId || n.stulist)) {
+          this.findTchAc(n.classId || n.stulist)
+        } else {
+          this.voteList = []
         }
+      }
+    },
+    value: {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        this.fIds = n
+      }
     }
+  }
 }
 </script>
 <style lang="less" scoped>
@@ -232,6 +317,6 @@ export default {
 </style>
 <style lang="less">
 .hw-container .ivu-list-item:hover {
-    background: var(--active-item-start);
+  background: var(--active-item-start);
 }
 </style>

+ 1 - 0
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -1216,6 +1216,7 @@ export default {
 
     /** 新增问卷成功回调 */
     onAddSuccess() {
+      this.continueToken = null
       this.handleTabClick(this.$route.name === "manageQuestionnaire" ? 0 : 1);
     },
 

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

@@ -1116,6 +1116,7 @@ export default {
     /** 新增投票成功回调 */
     onAddSuccess() {
       //this.addHwModal = false
+      this.continueToken = null
       this.handleTabClick(this.$route.name === 'manageVote' ? 0 : 1)
       this.hasNewAdd = false
       this.isAddActivity = false

+ 1 - 1
TEAMModelOS/Controllers/Client/HiTAControlller.cs

@@ -351,7 +351,7 @@ namespace TEAMModelOS.Controllers.Client
                     }
                     ////學校分派給老師的空間
                     int GsizeFromSchool = 0;
-                    string querySizeFromSchool = $"SELECT sum(c.size) as size FROM c WHERE c.pk = 'Teacher' AND c.id = {id}";
+                    string querySizeFromSchool = $"SELECT sum(c.size) as size FROM c WHERE c.pk = 'Teacher' AND c.id = '{id}'";
                     await foreach (var item in clientc.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(querySizeFromSchool, requestOptions: new QueryRequestOptions() { }))
                     {
                         var json = await JsonDocument.ParseAsync(item.ContentStream);

+ 3 - 3
TEAMModelOS/Controllers/Normal/ArtSettingController.cs

@@ -76,8 +76,8 @@ namespace TEAMModelOS.Controllers
                 List<School> schools = new List<School>();
                 School schoolHbcn = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>("hbcn", new PartitionKey("Base"));
                 schools.Add(schoolHbcn);
-                if (!string.IsNullOrWhiteSpace("_schoolCode")) {
-                    School schoolSelf = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>("hbcn", new PartitionKey("Base"));
+                if (!string.IsNullOrWhiteSpace($"{_schoolCode}") && !$"{_schoolCode}".Equals("hbcn")) {
+                    School schoolSelf = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>($"{_schoolCode}", new PartitionKey("Base"));
                     schools.Add(schoolSelf);
                 }
                 List<dynamic> papersData = new List<dynamic>();
@@ -103,6 +103,7 @@ namespace TEAMModelOS.Controllers
                                 {
                                     papersData.Add(new
                                     {
+                                        schoolId = school.id,
                                         x.id,
                                         x.name,
                                         x.blob,
@@ -120,7 +121,6 @@ namespace TEAMModelOS.Controllers
                                 }
                             }
                         });
-                      
                     }
                 }
                 return Ok(new { status = 0, papers = papersData });