Browse Source

feat: 修改课件名称功能

ChenYangfan 6 years ago
parent
commit
4120427f08

+ 11 - 0
src/views/login/Login.vue

@@ -3,6 +3,11 @@
     <div>
       <h1 class="title"><span>SEEC</span> 用户登录</h1>
       <c-input placeholder="邮箱" type="email" v-model="email"></c-input>
+      <section class="tip mb-24">
+        <div>关于邮箱的说明:</div>
+        <div>1. 邮箱需为南京大学校邮(@nju.edu.cn | @smail.nju.edu.cn)</div>
+        <div>2. 系统根据邮箱判定您的身份为教师还是学生</div>
+      </section>
       <c-input placeholder="密码" type="password" v-model="password"></c-input>
       <div class="button-area">
         <c-button @click="handleSubmit" :disabled="!formChecked()">登录</c-button>
@@ -92,4 +97,10 @@ export default {
     margin: 0 8px;
   }
 }
+
+.tip {
+  font-weight: bold;
+  color: #7a8a9a;
+  font-size: 12px;
+}
 </style>

+ 32 - 3
src/views/teacher/components/TeacherSlideDetail.vue

@@ -8,6 +8,14 @@
         下载课件
       </c-button>
     </a>
+    <div class="sub-title">课件信息设置</div>
+    <div class="mb-8">
+      <b>修改课件名称</b>
+    </div>
+    <div class="mb-16 modify-slide-name">
+      <c-input placeholder="在此输入课件新名称" v-model="newSlideName"></c-input>
+      <c-button class="secondary" @click="handleModifySlideName">确认修改</c-button>
+    </div>
     <c-button class="full-width secondary mb-16" @click="handleQuizSetting">习题设置 & 习题完成统计</c-button>
     <c-button v-if="nextState" class="warning full-width mb-16" @click="handleToNextState">
       将幻灯片状态设置为:{{slideStateTranslation[nextState]}}
@@ -21,18 +29,20 @@ import TabSideComponent from '@/components/TabSideComponent'
 import CButton from '@/components/CButton'
 import BackTitle from '@/components/BackTitle'
 import { mapState } from 'vuex'
-import { getSlideUrl, modifySlideState, removeSlide } from '@/server/slide'
+import { getSlideUrl, modifySlide, modifySlideState, removeSlide } from '@/server/slide'
 import { SET_SLIDE_INFO, SET_SRC } from '@/store/types/pdf-types'
 import getSlideNextState from '@/utils/get-slide-next-state'
 import SlideDetail from '@/components/SlideDetail'
 import slideStateTranslation from '@/server/enums/slide-state-translation'
+import CInput from '@/components/CInput'
 
 export default {
-  components: { BackTitle, CButton, TabSideComponent, SlideDetail },
+  components: { CInput, BackTitle, CButton, TabSideComponent, SlideDetail },
   data () {
     return {
       slideUrl: '',
-      slideStateTranslation
+      slideStateTranslation,
+      newSlideName: ''
     }
   },
   computed: {
@@ -76,6 +86,16 @@ export default {
           this.$setErrorMessage(err.response.data.msg)
         })
       }
+    },
+    handleModifySlideName () {
+      modifySlide({ id: this.slide.id, name: this.newSlideName }).then(res => {
+        console.log(res)
+        this.$setSuccessMessage('修改成功')
+        this.$store.commit(SET_SLIDE_INFO, { slideInfo: res })
+        this.$router.push('')
+      }).catch(err => {
+        this.$setErrorMessage(err.response.data.msg)
+      })
     }
   }
 }
@@ -120,6 +140,15 @@ export default {
   color: $theme-red
 }
 
+.modify-slide-name {
+  display: flex;
+  align-items: center;
+
+  .c-button {
+    margin-left: 12px;
+  }
+}
+
 @media (max-width: 600px) {
   .file-uploader {
     font-size: 14px;

+ 9 - 0
src/views/teacher/tabs/TeacherExplore.vue

@@ -43,6 +43,7 @@ import { teacherGetCourses } from '@/server/course'
 import CButton from '@/components/CButton'
 import { SET_SLIDE_INFO } from '@/store/types/pdf-types'
 import { SET_COURSE } from '@/store/types/main-types'
+import { mapState } from 'vuex'
 
 export default {
   components: { CButton, CourseCard, SlideCard },
@@ -52,9 +53,17 @@ export default {
       slides: null
     }
   },
+  computed: {
+    ...mapState({
+      slideInfo: state => state.pdf.slideInfo
+    })
+  },
   watch: {
     $route () {
       this.updateInfo()
+    },
+    slideInfo () {
+      this.updateInfo()
     }
   },
   mounted () {