Browse Source

fix:设置为只有pdf课件可以选择是否可下载

chillqi 3 years ago
parent
commit
7606407a90
1 changed files with 9 additions and 8 deletions
  1. 9 8
      src/views/CourseDetailPage/tabs/CoursewareTab.vue

+ 9 - 8
src/views/CourseDetailPage/tabs/CoursewareTab.vue

@@ -56,7 +56,7 @@
                   </el-col>
               </el-row>
           </el-form-item>
-          <el-form-item label="允许下载" required>
+          <el-form-item label="允许下载" required v-if="fileType === '.pdf'">
               <el-switch v-model="downloadValue" />
           </el-form-item>
         </el-form>
@@ -126,7 +126,7 @@
                        style="color: #409EFF" type="text">打开</el-button>
             <el-button v-if="scope.row['courseWareVO'].useMethod === 'SCAN' && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PICTUREandATTACHMENT'"
                      @click="handlePreviewPicture(scope.row['courseWareVO'])"
-                     style="color: #409EFF; margin-right: 10px" type="text">打开</el-button>
+                     style="color: #409EFF" type="text">打开</el-button>
 
 <!--              <el-button v-if="checkDownloadButton(scope.row['courseWareVO'].id, scope.row['courseWareVO'].name) === '1'"-->
 <!--            <el-button v-if="getCanDownloadById(scope.row['courseWareVO'].id) === true-->
@@ -134,11 +134,6 @@
 <!--                     && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PDF'"-->
 <!--                     @click="handleDownloadPdfFile(scope.row['courseWareVO'].fileUrl)"-->
 <!--                     style="color: #67C23A" type="text">下载</el-button>-->
-            <a :href="scope.row['courseWareVO'].fileUrl"
-                v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'PICTUREandATTACHMENT'">
-              <el-button style="color: #67C23A" type="text">下载</el-button>
-            </a>
-
             <el-button v-if="Number(scope.row['courseWareVO'].senderId) === Number(this.$store.state.user.id)"
                        style="color: #F56C6C; margin-left: 10px" type="text"
                        @click="handleRemoveCourseWare(scope.row['courseWareVO'].id)">删除</el-button>
@@ -153,7 +148,10 @@
           <img :src="pictureUrl" alt="" style="width: 100%" class="image" />
           <template #footer>
       <span class="dialog-footer">
-        <el-button type="primary" @click="handleClosePreviewPicture" plain>关闭</el-button>
+          <a :href="pictureUrl">
+              <el-button type="success" style="margin-right: 10px" size="small">下载</el-button>
+          </a>
+          <el-button type="primary" @click="handleClosePreviewPicture" plain size="small">关闭</el-button>
       </span>
           </template>
       </el-dialog>
@@ -214,6 +212,7 @@ export default {
       idToBeChangeName: null,
       newName: null,
       nameAppend: null,
+      fileType: null,
       fileTag: null,
       fileNum: 0,
       pdfName: "",
@@ -351,6 +350,7 @@ export default {
               } else {
                   this.isNameUnique = true;
                   this.fileNum = 1;
+                  this.fileType = "." + fileType;
               }
           });
       },
@@ -484,6 +484,7 @@ export default {
         .then(() => {
             this.isChangeNameWhenUpload = false;
             this.nameAppend = null;
+            this.fileType = null;
             this.isNameUnique = false;
             this.file = null;
             this.fileNum = 0;