|
@@ -868,6 +868,13 @@
|
|
|
@click="openWordCloud(toolIndex)"
|
|
|
>生成词云</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="tool.tool[0] == 16 && worksStudent[toolIndex].length > 0"
|
|
|
+ style="position: absolute; right: 30px; top: 30px"
|
|
|
+ @click="uploadWorks(toolIndex)"
|
|
|
+ >导出作业</el-button
|
|
|
+ >
|
|
|
<!-- courseDetail.userid == userid || -->
|
|
|
<!-- <el-button
|
|
|
v-if="courseDetail.userid == userid"
|
|
@@ -12174,6 +12181,26 @@ import RecordRTC from "recordrtc";
|
|
|
import interVideo from "../interVideo/index.vue";
|
|
|
import UpdateMore from "../updateMore/updateMore.vue";
|
|
|
import wordCloud from "../wordCloud/index.vue";
|
|
|
+import axios from "axios";
|
|
|
+import JSZip from "jszip";
|
|
|
+import FileSaver from "file-saver";
|
|
|
+
|
|
|
+const getFile = (url) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ axios({
|
|
|
+ method: "get",
|
|
|
+ url,
|
|
|
+ responseType: "blob",
|
|
|
+ })
|
|
|
+ .then((data) => {
|
|
|
+ resolve({ data: data.data });
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ resolve({ data: 1 });
|
|
|
+ // reject(error.toString());
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -18498,6 +18525,119 @@ export default {
|
|
|
this.wordCloudData = array;
|
|
|
this.dialogVisibleWordCloud = true;
|
|
|
},
|
|
|
+ uploadWorks(i) {
|
|
|
+ const loading = this.$loading.service({
|
|
|
+ background: "rgba(255, 255, 255, 0.7)",
|
|
|
+ target: document.body,
|
|
|
+ text: "文件加载中...",
|
|
|
+ });
|
|
|
+ const _worksStudent = this.worksStudent;
|
|
|
+ let url = [];
|
|
|
+ var counts = {};
|
|
|
+ for (var l = 0; l < _worksStudent[i].length; l++) {
|
|
|
+ var item = _worksStudent[i][l];
|
|
|
+ var name = item.sName;
|
|
|
+ if (!counts.hasOwnProperty(name)) {
|
|
|
+ counts[name] = 0;
|
|
|
+ } else {
|
|
|
+ counts[name]++;
|
|
|
+ }
|
|
|
+ if (counts[name] > 0) {
|
|
|
+ item.sName += " (" + counts[name] + ")";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var l = 0; l < _worksStudent[i].length; l++) {
|
|
|
+ var item = _worksStudent[i][l];
|
|
|
+ if (
|
|
|
+ item.works.indexOf(
|
|
|
+ "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn"
|
|
|
+ ) !== -1 &&
|
|
|
+ item.works.indexOf("img") === -1
|
|
|
+ ) {
|
|
|
+ url.push({ name: item.sName, url: item.works });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // var toolList = [
|
|
|
+ // { name: "电子白板", tool: 1 },
|
|
|
+ // { name: "思维导图", tool: 3 },
|
|
|
+ // { name: "协同文档", tool: 6 },
|
|
|
+ // { name: "思维网格", tool: 7 },
|
|
|
+ // { name: "素材库", tool: 8 },
|
|
|
+ // { name: "学习资料", tool: 17 },
|
|
|
+ // { name: "便签", tool: 2 },
|
|
|
+ // { name: "问卷调查", tool: 4 },
|
|
|
+ // { name: "选择题", tool: 45 },
|
|
|
+ // { name: "倒计时", tool: 10 },
|
|
|
+ // { name: "问答", tool: 15 },
|
|
|
+ // { name: "课程设计", tool: 26 },
|
|
|
+ // { name: "训练服务器", tool: 18 },
|
|
|
+ // { name: "作业提交", tool: 16 },
|
|
|
+ // { name: "批量上传", tool: 50 },
|
|
|
+ // { name: "AIoT Blockly", tool: 21 },
|
|
|
+ // { name: "AI Python", tool: 23 },
|
|
|
+ // { name: "AI Blockly", tool: 24 },
|
|
|
+ // { name: "目标管理", tool: 25 },
|
|
|
+ // { name: "数学画板", tool: 31 },
|
|
|
+ // { name: "翻译", tool: 28 },
|
|
|
+ // { name: "魔盒识字", tool: 37 },
|
|
|
+ // { name: "数学画板", tool: 31 },
|
|
|
+ // { name: "24点", tool: 38 },
|
|
|
+ // { name: "GeoGebra", tool: 39 },
|
|
|
+ // { name: "源码编辑", tool: 32 },
|
|
|
+ // { name: "个人评价", tool: 40 },
|
|
|
+ // { name: "选择匹配", tool: 41 },
|
|
|
+ // { name: "汉字宫", tool: 44 },
|
|
|
+ // { name: "排序", tool: 47 },
|
|
|
+ // { name: "表格", tool: 48 },
|
|
|
+ // { name: "文档", tool: 52 },
|
|
|
+ // { name: "学生分组", tool: 49 },
|
|
|
+ // { name: "CocoPi", tool: 57 },
|
|
|
+ // { name: "模拟驾驶", tool: 58 },
|
|
|
+ // { name: "路径搜索", tool: 59 },
|
|
|
+ // { name: "深度学习", tool: 60 },
|
|
|
+ // { name: "全历史", tool: 61 },
|
|
|
+ // { name: "交互视频", tool: 62 },
|
|
|
+ // { name: "海龟编程", tool: 63 },
|
|
|
+ // { name: "挑人", tool: 65 },
|
|
|
+ // { name: "公式编辑", tool: 66 },
|
|
|
+ // { name: "分子结构", tool: 67 },
|
|
|
+ // { name: "时间轴", tool: 68 },
|
|
|
+ // ];
|
|
|
+ // var toolName = "";
|
|
|
+ // for(var w = 0;w<toolList.length;w++){
|
|
|
+ // if(this.chapInfoList[this.courseType].chapterInfo[0].taskJson[this.taskCount].toolChoose[i].tool[0] == toolList[w].tool){
|
|
|
+ // toolName = toolList[w].name;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ console.log(url);
|
|
|
+ this.downLoadAll(url, loading);
|
|
|
+ },
|
|
|
+ downLoadAll(url, loading) {
|
|
|
+ const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
|
|
|
+ const zip = new JSZip();
|
|
|
+ const cache = {};
|
|
|
+ const promises = [];
|
|
|
+ data.forEach((item) => {
|
|
|
+ const promise = getFile(item.url).then((data) => {
|
|
|
+ if (data.data != 1) {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ const file_name = item.name + "." + item.url.split(".")[item.url.split(".").length - 1]; // 获取文件名
|
|
|
+ zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
|
|
|
+ cache[file_name] = data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ promises.push(promise);
|
|
|
+ });
|
|
|
+ Promise.all(promises).then(() => {
|
|
|
+ zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
+ // 生成二进制流
|
|
|
+ FileSaver.saveAs(content, this.courseDetail.title + "-" + "作业提交工具.zip"); // 利用file-saver保存文件 自定义文件名
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.close();
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
pickStudent(stu) {
|
|
|
if (this.isPickStudent.indexOf(stu.userid) !== -1) {
|
|
|
return;
|