Просмотр исходного кода

个人中心课程资源修改为多文件上传,课程资源修改详情页显示

bzkf30 1 год назад
Родитель
Сommit
52a676c3a8

+ 8 - 6
src/pages/courseResourcesChapter.vue

@@ -136,13 +136,15 @@ import { user } from "@/store/user.js";
     },
     /**预览页面*/
     reviewFile(item) {
-      let marklable = item.kf_path.substr(item.kf_path.lastIndexOf(".") + 1);
+      // let marklable = item.kf_path.substr(item.kf_path.lastIndexOf(".") + 1);
       let kfId = item.kf_id;
-      if (marklable == "mp4" || marklable == "mp3") {
-        this.$router.push({ path:'/resourceMovReview', query:{icon:marklable,kfId:kfId,kkID:this.kkID} });
-      } else {
-        this.$router.push({ path:'/resourceFileReview', query:{icon:marklable,kfId:kfId} });
-      }
+      sessionStorage.removeItem("index");
+      this.$router.push({ path:'/resourceMovReview', query:{kfId:kfId,kkID:this.kkID} });
+      // if (marklable == "mp4" || marklable == "mp3") {
+      //   this.$router.push({ path:'/resourceMovReview', query:{icon:marklable,kfId:kfId,kkID:this.kkID} });
+      // } else {
+      //   this.$router.push({ path:'/resourceFileReview', query:{icon:marklable,kfId:kfId} });
+      // }
     },
     /***/
     searchBtn() {

+ 35 - 24
src/pages/personal/components/MyCourse/components/MultiFileUpload.vue

@@ -6,7 +6,7 @@ import user from '~/store/user';
 const token = user?.token
 const action = window.GLOBAL_CONFIG.api + '/upload/main/file'
 
-const data = { token, client: 'web', api: 'json', issubmit: '1', site: 'tyyx' }
+let data = { token, client: 'web', api: 'json', issubmit: '1', site: 'tyyx' }
 const emit = defineEmits(['update:part', 'update:full', 'update:size', 'update:time', 'compile', 'image', 'start'])
 
 const props = defineProps({
@@ -28,27 +28,30 @@ const List_time = ref(props.time ?? (new Date().toLocaleString()))
 
 const FILE_LIST = ref([])
 
-if (List_part.value !== undefined && List_part.value !== '' && List_part.value !== null) {
-  FILE_LIST.value = List_part.value.split(';').map((part_url, idx) => ({
-    part_url,
-    url: window.GLOBAL_CONFIG.oss + part_url,
-    // _status: 1,
-    // uid: Date.now() - idx,
-    name: part_url.split('/').pop()
-  }))
-}
-if (List_full.value !== undefined && List_full.value !== '' && List_full.value !== null) {
-  FILE_LIST.value = List_full.value.split(';').map((item, idx) => {
-    const [part_url, name] = item.split('|')
-    return ({
+function init() {
+  if (List_part.value !== undefined && List_part.value !== '' && List_part.value !== null) {
+    FILE_LIST.value = List_part.value.split(';').map((part_url, idx) => ({
       part_url,
       url: window.GLOBAL_CONFIG.oss + part_url,
       // _status: 1,
-      name,
-      // uid: Date.now() - idx
+      // uid: Date.now() - idx,
+      name: part_url.split('/').pop()
+    }))
+  }
+  if (List_full.value !== undefined && List_full.value !== '' && List_full.value !== null) {
+    FILE_LIST.value = List_full.value.split(';').map((item, idx) => {
+      const [part_url, name] = item.split('|')
+      return ({
+        part_url,
+        url: window.GLOBAL_CONFIG.oss + part_url,
+        // _status: 1,
+        name,
+        // uid: Date.now() - idx
+      })
     })
-  })
+  }
 }
+init()
 // console.log('FILE_LIST :>> ', FILE_LIST.value);
 /**
     * const STATUS_MAP = {
@@ -58,6 +61,13 @@ if (List_full.value !== undefined && List_full.value !== '' && List_full.value !
     * }
 */
 
+watch(() => [props.part, props.full], (n, o) => {
+  List_part.value = (props.part)
+  List_full.value = (props.full)
+  init()
+})
+
+
 function beforeUpload(file) {
   if (props.sizeLimit) {
     const isLtSize = file.size / 1024 < props.sizeLimit;
@@ -76,9 +86,9 @@ function handleSuccess() {
     let full = [];
     FILE_LIST.value.forEach(item => {
       if (item.percentage === 100) {
-        const { url: part_url, file_name, filelist } = item.response.data
+        const { url: part_url, filename, file_name, filelist } = item.response.data
         part.push(part_url);
-        full.push(`${part_url}|${file_name}`);
+        full.push(`${part_url}|${filename || file_name}`);
         List_size.value += item.size ?? 0
         emit("image", filelist)
       } else {
@@ -101,13 +111,16 @@ function onExceed() {
   ElMessage.warning(`最多允许上传${attrs.limit}个文件`)
 }
 
-function handleChange(file) {
+function handleChange(file, fileList) {
   let fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
   let firstpage = fileType == "mp3" || fileType == "MP3" ? "" : 1;
   let lastpage = fileType == "mp3" || fileType == "MP3" ? "" : 3;
   let convert = fileType == "mp3" || fileType == "MP3" ? "" : "jpg";
-  let obj = { firstpage, lastpage, convert };
+  let obj = fileList.length == 1 ? { firstpage, lastpage, convert } : {};
+  console.log(obj)
+  data = { token, client: 'web', api: 'json', issubmit: '1', site: 'tyyx' }
   Object.assign(data, obj);
+  console.log(data)
 }
 
 const dialogImageUrl = ref('')
@@ -145,9 +158,7 @@ watch(() => List_part.value, () => {
 
 <template>
   <!-- :on-preview="handlePictureCardPreview" -->
-  <el-upload :action="action" :data="data" name="filedata" :on-success="handleSuccess" :on-remove="onRemove"
-    :on-exceed="onExceed" :on-change="handleChange" :before-upload="beforeUpload" v-model:file-list="FILE_LIST"
-    :on-preview="handlePictureCardPreview" v-bind="attrs" class="w-full">
+  <el-upload :action="action" :data="data" name="filedata" :on-success="handleSuccess" :on-remove="onRemove" :on-exceed="onExceed" :on-change="handleChange" :before-upload="beforeUpload" v-model:file-list="FILE_LIST" :on-preview="handlePictureCardPreview" v-bind="attrs" class="w-full">
     <template #default>
       <slot>
         <el-button type="primary">点击上传</el-button>

+ 7 - 6
src/pages/personal/components/MyCourse/kczy-zy.vue

@@ -128,13 +128,14 @@ export default {
       });
     },
     lookDetail(item) {
-      let marklable = item.kf_path.substr(item.kf_path.lastIndexOf(".") + 1);
+      // let marklable = item.kf_path.substr(item.kf_path.lastIndexOf(".") + 1);
       let kfId = item.kf_id;
-      if (marklable == "mp4" || marklable == "mp3") {
-        this.$router.push({ path: '/resourceMovReview', query: { icon: marklable, kfId: kfId, kkID: this.parentId } });
-      } else {
-        this.$router.push({ path: '/resourceFileReview', query: { icon: marklable, kfId: kfId } });
-      }
+      this.$router.push({ path: '/resourceMovReview', query: { kfId: kfId, kkID: this.parentId } });
+      // if (marklable == "mp4" || marklable == "mp3") {
+      //   this.$router.push({ path: '/resourceMovReview', query: { icon: marklable, kfId: kfId, kkID: this.parentId } });
+      // } else {
+      //   this.$router.push({ path: '/resourceFileReview', query: { icon: marklable, kfId: kfId } });
+      // }
     },
     handleCreate() {
       this.$router.push({ name: "course-kczy-zycreate", query: { parentId: this.parentId } });

+ 41 - 41
src/pages/personal/components/MyCourse/kczy-zycreate.vue

@@ -3,16 +3,14 @@
     <el-card>
       <div style="padding: 0 75px;">
         <span class="title">课程资源</span>
-        <span class="subTitle">我的课程 - 我创建的 - <span class="pointer" @click="goBack">课程资源</span> - <span
-            style="color: #000;">{{ editId== "" ? "添加" : "编辑"}}</span></span>
+        <span class="subTitle">我的课程 - 我创建的 - <span class="pointer" @click="goBack">课程资源</span> - <span style="color: #000;">{{ editId== "" ? "添加" : "编辑"}}</span></span>
       </div>
     </el-card>
 
     <el-card>
       <div style="color: #050026;font-size: 18px;font-weight: 400;">{{ editId== "" ? "添加" : "编辑"}}</div>
       <div class="formContent">
-        <el-form :model="formline" ref="formline" :rules="rules" size="large" label-position="top"
-          class="demo-ruleForm">
+        <el-form :model="formline" ref="formline" :rules="rules" size="large" label-position="top" class="demo-ruleForm">
           <!-- <div class="must">
             <div class="label">上传源文件</div>
             <div class="uploadDiv" v-loading="attachLoading">
@@ -30,30 +28,27 @@
             </div>
           </div> -->
           <el-form-item label="上传源文件" prop="kf_path">
-            <multi-file-upload v-model:part="formline.kf_path" @image="initImageData" :limit="1"
-              accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.mp4,.mp3" :size-limit="1500 * 1024"
-              @start="upload_loading = true" @compile="upload_loading = false">
+            <multi-file-upload v-model:full="formline.kf_path" @image="initImageData" :limit="6" accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.mp4,.mp3" :size-limit="1500 * 1024" @start="upload_loading = true" @compile="upload_loading = false">
               <template #default>
-                <div
-                  class="flex_center w-65px h-65px border border-dashed border-hex-E4E6E8 bg-hex-F9F9F9 text-hex-9D9AB9">
+                <div class="flex_center w-65px h-65px border border-dashed border-hex-E4E6E8 bg-hex-F9F9F9 text-hex-9D9AB9">
                   <i-akar-icons:plus class="text-xl" />
                 </div>
               </template>
               <template #tip>
                 <div class="mt-2">支持格式:doc,docx,xls,xlsx,ppt,pptx,pdf,mp4,mp3(1500M以内)</div>
+                <div>最多可上传6个文件</div>
               </template>
             </multi-file-upload>
           </el-form-item>
-          <div class="must">
+          <div class="must1">
             <div class="label" :style="{ marginTop: imageData.length != 0 ? '-100px' : 0 }">课程封面图</div>
             <div class="uploadDiv">
               <div style="display: flex;">
-                <el-upload class="mainUpload" action="" accept=".png, .jpg, .jpeg" :auto-upload="false"
-                  list-type="picture-card" :on-change="handleMainChange" :file-list="fileList">
-                  <el-icon size="38" color="#9d9ab9" v-if="fileList.length == 0">
+                <el-upload class="mainUpload" action="" accept=".png, .jpg, .jpeg" :auto-upload="false" list-type="picture-card" :on-change="handleMainChange" :file-list="fileList">
+                  <el-icon size="38" color="#9d9ab9" v-if="formline.kf_img==undefined || formline.kf_img==''">
                     <Picture />
                   </el-icon>
-                  <img v-else :src="fileList[0].url" alt="" style="width: 100%;height: 100%;" />
+                  <img v-else :src="getFullUrl(formline.kf_img)" alt="" style="width: 100%;height: 100%;" />
                 </el-upload>
                 <div style="font-size: 12px;margin-left: 20px;position: relative;">
                   <div style="color: #949494;">支持格式:jpg,png,jpeg(200kb以内) 建议尺寸600x320</div>
@@ -66,8 +61,7 @@
                 <div class="flex">
                   <!-- <img class="user" src="/images/personal/user.png" />
                   <img class="user" src="/images/personal/user.png" /> -->
-                  <img class="pointer" v-for="(item, index) in imageData" :key="index" :src="getFullUrl(item)" alt=""
-                    @click="initImg(item)" />
+                  <img class="pointer" v-for="(item, index) in imageData" :key="index" :src="getFullUrl(item)" alt="" @click="initImg(item)" />
                 </div>
               </div>
             </div>
@@ -90,8 +84,7 @@
           </el-form-item>
           <el-form-item>
             <div class="btnDiv">
-              <el-button type="primary" @click="submitForm('formline')"
-                :loading="commitLoading || upload_loading">{{ upload_loading?'文件上传中': '提 交' }}</el-button>
+              <el-button type="primary" @click="submitForm('formline')" :loading="commitLoading || upload_loading">{{ upload_loading?'文件上传中': '提 交' }}</el-button>
               <el-button @click="goBack">关 闭</el-button>
             </div>
           </el-form-item>
@@ -117,7 +110,7 @@ export default {
         kf_path: "",
         kf_name: "",
         yzk_id: "",
-        ka_attrib_level_1:"",//所属分类
+        ka_attrib_level_1: "",//所属分类
       },
       rules: {
         kf_path: [{ required: true, message: '请上传源文件', trigger: 'submit' }],
@@ -138,7 +131,7 @@ export default {
       commitLoading: false,
       upload_loading: false,
       ClassificationData: [],
-      
+
     }
   },
   components: { Picture, FolderOpened, MultiFileUpload },
@@ -159,9 +152,12 @@ export default {
             }
           }
 
-          this.fileList = [{
-            url: getFullUrl(this.formline.kf_img)
-          }]
+          if (this.formline.kf_img) {
+            this.fileList = [{
+              url: getFullUrl(this.formline.kf_img)
+            }]
+          }
+
           if (this.formline.kf_path != "") {
             let arr = this.formline.kf_path.split("/");
             this.attachList = [{
@@ -206,14 +202,16 @@ export default {
       })
     },
     initImageData(data) {
-      this.imageData = data || [];
-      if (this.imageData.length != 0 && this.formline.kf_img == "") {
-        this.formline.kf_img = this.imageData[0];
-        this.fileList = [{
-          url: getFullUrl(this.formline.kf_img)
-        }]
+      if (data) {
+        this.imageData = data || [];
+        if (this.imageData.length != 0 && this.formline.kf_img == "") {
+          // this.formline.kf_img = this.imageData[0];
+          this.fileList = [{
+            url: getFullUrl(this.formline.kf_img)
+          }]
+        }
+        this.$forceUpdate();
       }
-      this.$forceUpdate();
     },
     // 源文件
     // handleAttachChange(file) {
@@ -292,7 +290,7 @@ export default {
         return
       }
       this.$refs[formName].validate((valid) => {
-        if (valid && this.formline.kf_img != "" && this.formline.kf_path != "" && !this.attachLoading) {
+        if (valid && this.formline.kf_path != "" && !this.attachLoading) {
           this.formline.yzk_id = this.linkWork.join(",");
           this.formline.kk_id = this.parentId;
           let data = {
@@ -326,9 +324,9 @@ export default {
           if (this.attachLoading) {
             this.$message.error("源文件上传中!");
           }
-          if (this.formline.kf_img == "") {
-            this.mainTip = "请上传资源封面图";
-          }
+          // if (this.formline.kf_img == "") {
+          //   this.mainTip = "请上传资源封面图";
+          // }
           if (this.formline.kf_path == "") {
             this.attachTip = "请上传源文件";
           }
@@ -438,8 +436,16 @@ export default {
         }
       }
     }
-
     .must {
+      &::after {
+        content: "*";
+        color: #f35421;
+        margin-left: 4px;
+      }
+    }
+
+    .must,
+    .must1 {
       display: flex;
       align-items: center;
       margin-bottom: 22px;
@@ -448,12 +454,6 @@ export default {
         color: #949494;
         font-size: 14px;
         margin-right: 15px;
-
-        &::after {
-          content: "*";
-          color: #f35421;
-          margin-left: 4px;
-        }
       }
 
       .uploadDiv {

+ 114 - 40
src/pages/resourceMovReview.vue

@@ -1,18 +1,18 @@
 <template>
   <CommonHeader />
-  <div class="allPageWidthBg movPage">
+  <div class="allPageWidthBg movPage" v-loading="loading">
     <div class="withShadow">
       <div class="likeBread">
-        <div class="likeBread_left">{{ sourceDetailData.kf_name }}</div>
+        <div class="likeBread_left">{{ zyName }}</div>
         <div class="likeBread_right">
           <span>课程资源</span>- <span>查看详情</span>-
-          <span>{{ sourceDetailData.kf_name }}</span>
+          <span>{{ zyName }}</span>
         </div>
       </div>
     </div>
     <div class="common1280 vedioMain">
       <div class="vedio_titel">
-        <div class="vedio_titel_left">{{ sourceDetailData.kf_name }}</div>
+        <div class="vedio_titel_left">{{ zyName }} - {{ currentFilename }}</div>
         <div class="vedio_titel_right" @mouseenter="showTrue" @mouseleave="showFalse">
           <img src="../assets/kczy/shareIcon.png" alt="" /> 分享
           <div class="qrcodeAll" v-if="shareSwitch">
@@ -96,7 +96,7 @@
               </div>
             </div>
 
-            <div class="vedioMainContent_left_bottom" v-else>
+            <div class="vedioMainContent_left_bottom" v-else-if="transIconType == 'mp3'">
               <audio ref="urlResouce" controls :src="sourceDetailData.kf_path">
                 <source :src="prefixImg+sourceDetailData.kf_path" type="audio/mp3">
               </audio>
@@ -106,6 +106,8 @@
                 当前观看人数:{{ sourceDetailData.kf_view_num }}
               </div>
             </div>
+
+            <iframe v-else class="vedioMainContent_left_bottom" name="content_frame" :src="previewUrl+currentUrl" frameborder=0  scrolling="no"></iframe>
           </template>
         </div>
         <div class="vedioMainContent_right">
@@ -164,15 +166,27 @@
                     {{ item.user_name == false ? "未知" : item.user_name }}
                     <span class="itemSon1">{{ item.create_time }}</span>
                   </p>
-                  <div class="fileAll">
+                  <div class="px-5px pt-10px">
+                    <div class="text-15px">{{ item.kf_name }}</div>
+                    <div class="pt-8px">
+                      <div class="flex items-center text-13px mb-3px" v-for="(value, i) in item.fileData" :key="`${index}-${i}`">
+                        <div class="flex-1 truncate">
+                          <el-tooltip  effect="dark" :content="value.name"  placement="left">{{ value.name }}</el-tooltip>
+                        </div>
+                        <el-button class="!h-24px !bg-transparent !text-hex-409eff" plain round type="primary" size="mini" @click="handleDownload(value)">下载</el-button>
+                        <el-button class="!h-24px !bg-transparent !text-hex-409eff" plain round type="primary" size="mini" @click="handlePreview(item, value, i)">预览</el-button>
+                      </div>
+                    </div>
+                  </div>
+
+                  <!-- <div class="fileAll">
                     <div class="fileAll_left">
                       <img :src="item.kf_img" />
                     </div>
                     <div class="fileAll_middle">{{ item.kf_name }}</div>
                     <div class="fileAll_right" @click="downloadFile(item)">下载</div>
-                    <!-- <div class="fileAll_right" @click="handlePreview(getFullUrl(item.kf_path))">预览</div> -->
                     <div class="fileAll_right" @click="preview(item)">预览</div>
-                  </div>
+                  </div> -->
                 </div>
               </div>
             </div>
@@ -273,6 +287,12 @@ export default {
   },
   data() {
     return {
+      loading: false,
+      previewUrl: "https://view.officeapps.live.com/op/view.aspx?src=",
+      zyName: "",
+      currentIndex: 0,
+      currentUrl: "",
+      currentFilename: "",
       starsValue: "",
       transIconType: "",
       transKfId: "",
@@ -335,13 +355,15 @@ export default {
     },
     /**初始化数据*/
     initData() {
-      this.transIconType = this.$route.query.icon;
+      // this.transIconType = this.$route.query.icon;
       this.transKfId = this.$route.query.kfId;
       this.transKkId = this.$route.query.kkID;
+      this.currentIndex = sessionStorage.getItem("index");
       let transObj = {
         token: user?.token,
         kf_id: this.transKfId,
       };
+      this.loading = true;
       courseSourceDetail(transObj)
         .then((res) => {
           if (res.code == "1") {
@@ -352,43 +374,88 @@ export default {
 
            //示例设置清晰度为超清和高清的地址("OD": "<原画URL>","FD": "<流畅URL>","LD":"<标清URL>","SD": "<高清URL>","HD": "<超清URL>","2K": "<2K URL>","4K": "<4K URL>")
            // source:'{"HD":"http://******/player/hdexample.mp4","SD":"http://******/player/sdexample.mp4"}'
-            let oneInfoData = res.data.one_info;
-            this.sourceUrl = { "OD": oneInfoData.kf_path_od, "FD": oneInfoData.kf_path_fd, "LD": oneInfoData.kf_path_ld };
-            let stringSourceUrl = JSON.stringify( this.sourceUrl)
-            let _this = this;
-            // 初始换aliplayer
-            this.player = new Aliplayer({
-                id: 'J_prismPlayer',
-                source:stringSourceUrl,
-                language: "zh-cn",
-                width: '100%', //容器的大小
-                height: '100%', //容器的大小
-                isLive:false,//是不是直播
-                preload:true,//播放器自动加载
-                autoplay: true,//是否自动播放
-                qualitySort:'asc',//从小到大排序
-              },function(player){
-                console.log('播发器创建完成~')
-            });
-            if(localStorage.getItem('cur_time_'+ this.transKkId)) {
-              this.player.seek(localStorage.getItem('cur_time_'+ this.transKkId));
-            }
-            var timer = setInterval(() => {
-              var curTime = parseInt(this.player.getCurrentTime());
-              if (this.player && this.player.getStatus() == "playing") {
-                localStorage.setItem('cur_time_'+ this.transKkId,curTime);
-              }
-            }, 30000);
+
+            // let oneInfoData = res.data.one_info;
+            // console.log(oneInfoData)
+            // this.sourceUrl = { "OD": oneInfoData.kf_path_od, "FD": oneInfoData.kf_path_fd, "LD": oneInfoData.kf_path_ld };
+            // let stringSourceUrl = JSON.stringify( this.sourceUrl)
+
             this.fingerNum = res.data.one_info.kf_like_num; //点赞数
             this.fingerSwitch = res.data.one_info.is_like; //0:关 1:开
             this.loveNum = res.data.one_info.kf_fav_num; //关注
             this.loveSwitch = res.data.one_info.is_fav; //0:关 1:开
+
+            this.zyName = this.sourceDetailData.kf_name;
+            let fileData = this.initFileData(this.sourceDetailData.kf_path);
+            this.initCurrentFile(fileData[this.currentIndex || 0]);
+            this.loading = false;
           }
         })
         .catch((error) => {
           console.log(error);
         });
     },
+    initFileData(path) {
+      let arr = path.split(";");
+      let fileData = arr.map((item, index) => {
+        let file = item.split("|");
+        let url = this.getFullUrl(file[0])
+        let suffix = file[0]?.substr(file[0].lastIndexOf(".") + 1);
+        let name = file[1] || `文件${index+1}`;
+        return {
+          url, suffix, name
+        }
+      })
+      return fileData
+    },
+    initCurrentFile(data) {
+      this.player && this.player.dispose();
+      this.transIconType = data.suffix;
+      this.currentUrl = data.url;
+      this.currentFilename = data.name;
+      if (data.url && (data.suffix=="mp3" || data.suffix=="mp4")) {
+        setTimeout(() => {
+          this.initPlayer(data.url)
+        }, 1000)
+      }
+    },
+    initPlayer(source) {
+      let _this = this;
+      // 初始换aliplayer
+      this.player = new Aliplayer({
+          id: 'J_prismPlayer',
+          source: source,
+          language: "zh-cn",
+          width: '100%', //容器的大小
+          height: '100%', //容器的大小
+          isLive:false,//是不是直播
+          preload:true,//播放器自动加载
+          autoplay: true,//是否自动播放
+          qualitySort:'asc',//从小到大排序
+        },function(player){
+          console.log('播发器创建完成~')
+      });
+      if(localStorage.getItem('cur_time_'+ this.transKkId)) {
+        this.player.seek(localStorage.getItem('cur_time_'+ this.transKkId));
+      }
+      var timer = setInterval(() => {
+        var curTime = parseInt(this.player.getCurrentTime());
+        if (this.player && this.player.getStatus() == "playing") {
+          localStorage.setItem('cur_time_'+ this.transKkId,curTime);
+        }
+      }, 30000);
+    },
+    handlePreview(item, value, index) {
+      if (item.kf_id == this.transKfId) {
+        sessionStorage.setItem("index", index);
+        this.zyName = item.kf_name;
+        this.initCurrentFile(value);
+      } else {
+        const query = JSON.parse(JSON.stringify(this.$route.query));
+        query.kfId = item.kf_id;
+        this.$router.replace({ path: this.$route.path, query });
+      }
+    },
     /**初始化评论*/
     initEvaluaList() {
       let transObj = {
@@ -431,6 +498,9 @@ export default {
       sourceList(transObj)
         .then(res => {
           if (res.code == '1') {
+            res.data.page_data.map((item) => {
+              item.fileData = this.initFileData(item.kf_path);
+            })
             this.sourceData = res.data.page_data;
           }
         })
@@ -442,7 +512,8 @@ export default {
     initHomeworkList() {
       let transObj = {
         limit: 30,
-        yzk_ids: this.transKkId
+        // yzk_ids: this.transKkId
+        yzk_id: this.sourceDetailData.yzk_id
       }
       homeWork_list(transObj)
         .then(res => {
@@ -491,6 +562,10 @@ export default {
       let downFileUrl = item.kf_path;
       window.open(downFileUrl, '_self');
     },
+    handleDownload(value) {
+      let downFileUrl = value.url;
+      window.open(downFileUrl);
+    },
     /**预览*/
     preview(item) {
       let marklable = item.kf_path.substr(item.kf_path.lastIndexOf(".") + 1);
@@ -676,7 +751,7 @@ export default {
             kk_id: this.transKkId,//所属课程资源编号
             kk_name: this.kkName,//所属课程资源名称
             kf_id: this.transKfId,//所属课程资源编号
-            kf_name: this.sourceDetailData.kf_name,//所属课程资源名称
+            kf_name: this.zyName,//所属课程资源名称
             yzkx_content_json: JSON.stringify(this.singleAnswer),//学生答题情况
             yzkx_student_realname: user.user_realname,
           }
@@ -815,8 +890,7 @@ export default {
     },
     //文件下载
     downLoadFile1() {
-      let downFileUrl = this.sourceDetailData.kf_path;
-      window.open(downFileUrl);
+      window.open(this.currentUrl);
     },
   },
   watch: {