Browse Source

Fix: 我的课程-作业问卷投票删除和编辑名称问题&&新建活动后列表无法查看的问题

OnePsycho 2 years ago
parent
commit
cb6c5b0b34

+ 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()

+ 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