Browse Source

拓展课程-课件下载-下载单个文件

11wqe1 3 months ago
parent
commit
4133640f81
1 changed files with 17 additions and 1 deletions
  1. 17 1
      src/components/main/downloadCourse.vue

+ 17 - 1
src/components/main/downloadCourse.vue

@@ -668,7 +668,23 @@ const updateCourse = id => {
     }
   }, [], { "type": "POST", "withCredentials": true });
 }
-
+const downloadOne = (url, fileName) => {
+  try {
+    console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', 1])
+    top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', 1], function (res) {
+      console.log(res, '11111111111')
+    }, [], { "type": "POST", "withCredentials": true });
+  } catch (error) {
+    console.log(error);
+  }
+  const a = document.createElement('a');
+  a.style.display = 'none';
+  a.href = url;
+  a.download = fileName;
+  document.body.appendChild(a);
+  a.click();
+  document.body.removeChild(a);
+}
 const updateCourseId = (id, type) => {
   top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/copyCourseSz", [id, user.user.userid], function (res) {
     console.log(res)