dusenyao 3 년 전
부모
커밋
f22b04754a
4개의 변경된 파일40개의 추가작업 그리고 17개의 파일을 삭제
  1. 1 1
      src/api/course.js
  2. 0 1
      src/layouts/components/LayoutHeader.vue
  3. 23 8
      src/views/course_details/index.vue
  4. 16 7
      src/views/login/index.vue

+ 1 - 1
src/api/course.js

@@ -287,7 +287,7 @@ export function ApplyJoinCourse(data) {
 
 /**
  * 检测我的物品购买状态
- * @param {Object} data
+ * @param { Object } data
  */
 export function CheckMyGoodsBuyStatus(data) {
   const params = getRequestParams('order-order_manager-CheckMyGoodsBuyStatus');

+ 0 - 1
src/layouts/components/LayoutHeader.vue

@@ -158,7 +158,6 @@ export default {
 
     isExistMyMessage_NotRead() {
       IsExistMyMessage_NotRead().then(({ is_exist }) => {
-        console.log(is_exist);
         this.isNotRead = JSON.parse(is_exist);
       });
     },

+ 23 - 8
src/views/course_details/index.vue

@@ -211,7 +211,9 @@
                                     v-for="(courseware, courseware_i) in it.courseware_list"
                                     :key="courseware_i"
                                     class="btn"
-                                    @click="preview(courseware.courseware_id, 'courseware')"
+                                    @click="
+                                      preview(courseware.courseware_id, 'courseware', courseware.courseware_book_id)
+                                    "
                                   >
                                     <img src="../../assets/course_details/file.png" alt="" />
                                     <span> {{ courseware.courseware_name }} </span>
@@ -464,14 +466,27 @@ export default {
       this.auditShow = false;
     },
 
-    preview(fileId, fileType) {
-      if (!this.is_buy) {
-        this.$message.warning('请先购买该课程');
-        return;
+    preview(fileId, fileType, goods_id) {
+      if (fileType === 'courseware') {
+        CheckMyGoodsBuyStatus({ goods_id, goods_type: 101 }).then(({ is_buy }) => {
+          if (is_buy === 'false') {
+            return this.$message.warning('请先购买该课件对应的教材');
+          }
+          this.fileId = fileId;
+          this.fileType = fileType;
+          this.visible = true;
+        });
+      }
+
+      if (fileType === 'file') {
+        if (this.$store.state.user.user_type !== 'TEACHER' && !this.is_buy) {
+          this.$message.warning('请先购买该课程');
+          return;
+        }
+        this.fileId = fileId;
+        this.fileType = fileType;
+        this.visible = true;
       }
-      this.visible = true;
-      this.fileId = fileId;
-      this.fileType = fileType;
     },
 
     dialogClose() {

+ 16 - 7
src/views/login/index.vue

@@ -35,8 +35,12 @@
       </el-form-item>
 
       <el-form-item class="verification-code" prop="verification_code_image_text">
-        <el-input v-model="loginForm.verification_code_image_text" />
-        <el-image v-if="image_content_base64.length > 0" :src="`data:image/jpg;base64,${image_content_base64}`" />
+        <el-input v-model="loginForm.verification_code_image_text" placeholder="验证码" />
+        <el-image
+          v-if="image_content_base64.length > 0"
+          :src="`data:image/jpg;base64,${image_content_base64}`"
+          @click="updateVerificationCode"
+        />
       </el-form-item>
 
       <el-row>
@@ -116,16 +120,20 @@ export default {
   },
   created() {
     this.getConfig();
-
-    GetVerificationCodeImage().then(({ image_id, image_content_base64 }) => {
-      this.loginForm.verification_code_image_id = image_id;
-      this.image_content_base64 = image_content_base64;
-    });
+    this.updateVerificationCode();
   },
   methods: {
     async getConfig() {
       await getConfigInformation();
     },
+
+    updateVerificationCode() {
+      GetVerificationCodeImage().then(({ image_id, image_content_base64 }) => {
+        this.loginForm.verification_code_image_id = image_id;
+        this.image_content_base64 = image_content_base64;
+      });
+    },
+
     handleLogin(user_type) {
       this.$refs.loginForm.validate(valid => {
         if (valid) {
@@ -187,6 +195,7 @@ export default {
       .el-image {
         margin-left: 24px;
         vertical-align: bottom;
+        cursor: pointer;
 
         &__inner {
           vertical-align: middle;