Bladeren bron

上传测试

SanHQin 9 maanden geleden
bovenliggende
commit
bc246618fa

+ 478 - 0
src/components/pages/csTest/component/shareDialog.vue

@@ -0,0 +1,478 @@
+<template>
+  <div>
+    <el-dialog
+      title="分享设置"
+      :visible.sync="dialogVisible"
+      width="600px"
+      v-loading="loading"
+    >
+      <!-- <div class="shareContent">
+        <div class="sc_formItemDate">
+          <div>有效期:</div>
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="7"
+            >7天</el-radio
+          >
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="31"
+            >31天</el-radio
+          >
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="0"
+            >永久有效</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setPassword"
+            active-text="密码设置"
+          >
+          </el-switch>
+          <el-input
+            class="sc_fai_input"
+            :disabled="!form.setPassword || form.id ? true : false"
+            placeholder="请输入密码"
+            v-model="form.password"
+          ></el-input>
+          <span>仅支持数字及英文字母</span>
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setStudentLook"
+            active-text="查看学生作业权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setStudentLook || form.id ? true : false"
+            v-model="form.studentLook"
+            label="0"
+            >显示学生姓名</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setStudentLook || form.id ? true : false"
+            v-model="form.studentLook"
+            label="1"
+            >不显示学生真实姓名</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setComment"
+            active-text="评论权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setComment || form.id ? true : false"
+            v-model="form.comment"
+            label="0"
+            >组织内人员</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setComment || form.id ? true : false"
+            v-model="form.comment"
+            label="1"
+            >所有人(包括游客用户)</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setDownload"
+            active-text="课程资源下载权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setDownload || form.id ? true : false"
+            v-model="form.download"
+            label="0"
+            >组织内人员</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setDownload || form.id ? true : false"
+            v-model="form.download"
+            label="1"
+            >所有人(包括游客用户)</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setHomeWorkUpload"
+            active-text="作业上传权限"
+          >
+          </el-switch>
+          <span>仅组织内成员可使用工具上传内容</span>
+        </div>
+      </div> -->
+
+      <div class="sc_formUrl" v-show="form.url">
+        <el-input
+          class="sc_fu_input"
+          style="color: black"
+          disabled
+          v-model="form.url"
+        >
+          <template slot="append"
+            ><div class="sc_fu_copyBtn" @click.stop="copyUrl()">
+              复制链接
+            </div></template
+          >
+        </el-input>
+        <div class="qrcode" ref="qrCodeRef"></div>
+				<el-link class="qrcodeBtn" type="primary" @click="downloadQrCode()">下载二维码</el-link>
+      </div>
+      <span slot="footer" class="shareFooter">
+        <el-button @click="close()">取 消</el-button>
+        <!-- <el-button type="primary" v-if="!form.id" @click="generate()"
+					>生成</el-button
+				>
+				<el-button type="primary" v-else @click="resetGenerate()"
+					>重置生成</el-button
+				> -->
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import QRCode from "qrcodejs2";
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      loading: false,
+      date: "0",
+      courseId: "",
+      form: {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      }
+    };
+  },
+  watch: {
+    "form.url"(newValue) {
+      this.$nextTick(() => {
+        this.$refs.qrCodeRef.innerHTML = "";
+        if (!newValue) return;
+        new QRCode(this.$refs.qrCodeRef, {
+          text: `https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E9%A1%B9%E7%9B%AE%E5%88%97%E8%A1%A8%20%2828%291714535763655.xlsx`, // 需要转换为二维码的内容
+          width: 100,
+          height: 100,
+          colorDark: "#000000",
+          colorLight: "#ffffff",
+          correctLevel: QRCode.CorrectLevel.H
+        });
+      });
+    }
+  },
+  methods: {
+    open(courseId) {
+      this.courseId = courseId;
+      this.dialogVisible = true;
+      this.form.id = "default";
+			this.form.url = `https://view.officeapps.live.com/op/view.aspx?src=https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E9%A1%B9%E7%9B%AE%E5%88%97%E8%A1%A8%20%2828%291714535763655.xlsx`
+      // this.form.url = `https://beta.cloud.cocorobo.cn/#/?shareCourseId=${this.courseId}`;
+      // this.getData();
+    },
+    close() {
+      this.dialogVisible = false;
+      this.form = {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      };
+      this.date = "0";
+      this.courseId = "";
+    },
+    generate() {
+      if (!this.courseId) return this.$message.error("错误:无课程ID");
+      if (this.loading) return;
+      this.loading = true;
+      if (this.form.setPassword) {
+        // 判断密码是否没输入
+        if (!this.form.password) {
+          this.loading = false;
+          return this.$message.error("请输入密码");
+        }
+        // 判断密码是否符合规则
+        const reg = /^[A-Za-z0-9]+$/;
+        if (!reg.test(this.form.password)) {
+          this.loading = false;
+          return this.$message.error("密码仅支持数字及英文字母");
+        }
+      }
+      this.form.url = `https://beta.cloud.cocorobo.cn/#/?shareCourseId=${this.courseId}`;
+      let pram = [
+        {
+          cid: this.courseId,
+          jsonData: JSON.stringify(this.form),
+          date: this.date,
+          type: 1
+        }
+      ];
+      this.ajax
+        .post(this.$store.state.api + "addShareCourse", pram)
+        .then(res => {
+          if (res.data == 1) {
+            this.$message.success("生成成功");
+          } else {
+            this.$message.error("生成失败");
+          }
+          this.getData();
+        })
+        .catch(err => {
+          console.log(err);
+          this.$message.error("生成失败");
+          this.getData();
+          this.loading = false;
+        });
+
+      // this.$message.success("生成成功");
+      this.loading = false;
+    },
+    resetGenerate() {
+      this.$confirm("此操作将重置分享链接, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        let pram = [
+          {
+            cid: this.courseId,
+            type: 1
+          }
+        ];
+        this.ajax
+          .post(this.$store.state.api + "delShareCourse", pram)
+          .then(res => {
+            if (res.data == 1) {
+              this.$message.success("重置成功");
+            } else {
+              this.$message.error("重置失败");
+            }
+            this.getData();
+          })
+          .catch(err => {
+            console.log(err);
+            this.$message.error("重置失败");
+            this.getData();
+            this.loading = false;
+          });
+        // this.form = {
+        // 	setPassword: false,
+        // 	password: "",
+        // 	setStudentLook: false,
+        // 	studentLook: "1",
+        // 	setComment: false,
+        // 	comment: "1",
+        // 	setDownload: false,
+        // 	download: "1",
+        // 	setHomeWorkUpload: false,
+        // 	url: "",
+        // };
+        // this.date = "0";
+        // this.$message.success('重置成功')
+      });
+    },
+    copyUrl() {
+      if (!this.form.url) {
+        return this.$message.info("请先生成链接");
+      }
+      const input = document.createElement("input");
+      // 设置 display为none会导致无法复制
+      // input.style.display = "none";
+      // 所以只能用其他方法隐藏
+      input.style.opacity = 0;
+      // 为了不影响布局
+      input.style.position = "fixed";
+      input.style.left = "-100%";
+      input.style.top = "-100%";
+      input.value = this.form.url;
+      document.body.appendChild(input);
+      input.select();
+      const success = document.execCommand("copy");
+      document.body.removeChild(input);
+      if (!success) {
+        return this.$message.error("复制失败");
+      } else {
+        return this.$message.success("复制成功");
+      }
+    },
+    getData() {
+      this.form = {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      };
+      this.date = "0";
+      this.loading = true;
+      // 这里查询数据库是否有数据
+      this.ajax
+        .get(this.$store.state.api + "getShareCourse", {
+          cid: this.courseId,
+          type: 1
+        })
+        .then(res => {
+          let _data = res.data[0];
+          if (_data.length == 0) return (this.loading = false);
+          let jsonData = _data[0].json ? JSON.parse(_data[0].json) : {};
+          this.form = { ...jsonData, id: _data[0].id };
+          this.date = _data[0].time;
+          this.loading = false;
+        })
+        .catch(err => {
+          this.loading = false;
+          console.error(err);
+        });
+    },
+		downloadQrCode(){
+			let canvas = this.$refs.qrCodeRef.getElementsByTagName('canvas')[0];
+			let ctx = canvas.getContext('2d');
+
+			// 创建一个新的canvas,大小为原来的两倍
+			var newCanvas = document.createElement("canvas");
+			newCanvas.width = canvas.width * 2;
+			newCanvas.height = canvas.height * 2;
+
+			// 获取新canvas的context,并绘制原来的canvas到新canvas上
+			var newCtx = newCanvas.getContext("2d");
+			newCtx.drawImage(canvas, 0, 0, newCanvas.width, newCanvas.height);
+
+			// 创建一个链接来下载图片
+			var link = document.createElement("a");
+			link.download = "课程分享二维码.png";
+			link.href = newCanvas.toDataURL();
+			link.click();
+		}
+  }
+};
+</script>
+
+<style scoped>
+.shareContent {
+  width: 600px;
+  max-width: 600px;
+  height: auto;
+}
+
+.shareFooter {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.sc_formItemDate {
+  width: 100%;
+  height: auto;
+  display: flex;
+  align-items: center;
+  margin: 10px 0;
+}
+
+.sc_fd_radio {
+  margin-left: 55px;
+}
+
+.sc_formAuthorityItem {
+  margin-top: 30px;
+  margin-bottom: 20px;
+}
+
+.sc_formAuthorityItem > span {
+  font-size: 14px;
+  color: #7f7f7f;
+  margin-left: 20px;
+}
+
+.sc_fai_switch {
+  width: 190px;
+}
+
+.sc_fai_input {
+  width: 120px;
+  text-align: center;
+  margin-left: 20px;
+}
+
+.sc_fai_radio {
+  width: 120px;
+  margin-left: 20px;
+}
+.sc_fu_copyBtn {
+  color: black;
+  cursor: pointer;
+}
+
+.qrcode {
+  width: 100px;
+  height: 100px;
+  margin-top: 20px;
+}
+
+.sc_fu_input /deep/.el-input__inner {
+  color: black !important;
+  cursor: text !important;
+}
+
+.sc_fu_input >>> .el-input__inner {
+  color: black !important;
+  cursor: text !important;
+}
+
+.qrcodeBtn{
+	width: 100px;
+	display: flex;
+	justify-content: center;
+	margin-top: 10px;
+}
+</style>

+ 282 - 0
src/components/pages/csTest/component/uploadFile.vue

@@ -0,0 +1,282 @@
+<template>
+	<div class="uploadBox"></div>
+</template>
+
+<script>
+import { v4 as uuidv4 } from "uuid";
+import "../../../../common/aws-sdk-2.235.1.min.js";
+export default {
+	data() {
+		return {
+			bucket: "", //aws上传接口
+			bucketname: "ccrb", //桶
+			uploadid: "",
+			partsize: 1 * 1024 * 1024, //1MB  分片
+			filestate: {
+				status: "", //有 error(直接报错) 和 fail(上传的时候报错) 和 success(上传成功) 和 processing(上传中)
+				percent: "", //(0-100的进度)
+			},
+		};
+	},
+	watch: {
+		filestate() {
+			console.log(this.filestate);
+		},
+	},
+	methods: {
+		//--------------------------分断上传保证稳定性
+		//初始化上传
+		// async init(){
+		// 	const credentials = {
+		// 	    accessKeyId: "AKIATLPEDU37QV5CHLMH",
+		// 	    secretAccessKey: "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",
+		// 	}; //秘钥形式的登录上传
+		// 	window.AWS.config.update(credentials);
+		// 	window.AWS.config.region = "cn-northwest-1"; //设置区域
+		// 	//桶的设置
+		// 	bucket = new window.AWS.S3({
+		// 	    params: {
+		// 	        Bucket: this.bucketname
+		// 	    }
+		// 	});
+		// 	return bucket;
+		// },
+		// 初始化上传入口
+		async initMultipartUpload(key) {
+			const params = {
+				Bucket: this.bucketname,
+				Key: key,
+			};
+			//创建一个续传通道
+			const data = await this.bucket.createMultipartUpload(params).promise();
+			return data.UploadId;
+		},
+		// 上传文件的某一部分
+		async uploadPart(file, keyname, uploadid, pn, start, end) {
+			//key可以设置为桶的相对路径,Body为文件, ACL最好要设置
+			var params = {
+				Bucket: this.bucketname,
+				Key: keyname,
+				// ContentType: file.type,
+				PartNumber: pn,
+				UploadId: uploadid,
+				Body: file.slice(start, end),
+				// "Access-Control-Allow-Credentials": "*",
+				// ACL: "public-read",
+			};
+			const result = await this.bucket.uploadPart(params).promise();
+			// .then((data) => {
+			return { ETag: result.ETag, PartNumber: pn };
+			// })
+			// .catch((err) => {
+			//     return err;
+			// });
+		},
+		//完成分块上传
+		async completeMultipartUpload(parts, keyname) {
+			const params = {
+				Bucket: this.bucketname,
+				Key: keyname,
+				MultipartUpload: { Parts: parts },
+				UploadId: this.uploadid
+			};
+			return await this.bucket.completeMultipartUpload(params).promise();
+		},
+		async abortMultipartUpload(key, uploadid) {
+			const params = {
+				Bucket: this.bucketname,
+				Key: key,
+				UploadId: uploadid,
+			};
+			await this.bucket.abortMultipartUpload(params).promise();
+		},
+		// 实际的上传逻辑
+		async uploadFile(file, folderid) {
+			folderid = folderid || uuidv4(); //分配到一个随机的id里
+			var keyname = folderid + "/" + file.name; //保存在指定的文件夹里
+			this.uploadid = "";
+			try {
+				this.init(); // 初始化aws接口
+				// 初始化分块上传
+				this.uploadid = await this.initMultipartUpload(keyname);
+				// 分块上传文件
+				let parts = [];
+				let start = 0;
+				let end = 0;
+				let len = Math.ceil(file.length / this.partsize); //循环的长度
+				//循环上传
+				for (let i = 0; i < len; i++) {
+					start = i * this.partsize;
+					end = (i + 1) * this.partsize;
+					parts.push(
+						await uploadPart(file, keyname, this.uploadid, i, start, end)
+					);
+				}
+				// 完成分块上传
+				await this.completeMultipartUpload(parts, this.uploadid);
+				return this.uploadid;
+			} catch (error) {
+				// 如果出现错误,中止分块上传
+				console.error("An error occurred during file upload:", error);
+				await abortMultipartUpload(keyname, this.uploadid);
+			}
+		},
+		//--------------------------------下面支持断点续传
+
+		//初始化亚马逊参数
+		async init() {
+			//秘钥形式的登录上传
+			const credentials = {
+				accessKeyId: "AKIATLPEDU37QV5CHLMH",
+				secretAccessKey: "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",
+				region: "cn-northwest-1",
+			};
+			window.AWS.config.update(credentials);
+			// window.AWS.config.region = "cn-northwest-1"; //设置区域
+			//桶的设置
+			this.bucket = new window.AWS.S3({
+				params: {
+					Bucket: this.bucketname,
+				},
+			});
+			return this.bucket;
+		},
+
+		//获取当前文件是否有已上传断点信息
+		async getawscheckpoint(key) {
+			let partsinfo;
+			try {
+				const result = await this.bucket
+					.listMultipartUploads({ Bucket: this.bucketname, Prefix: key })
+					.promise();
+				//获取具体分片信息
+				if (result.Uploads.length) {
+					this.uploadid = result.Uploads[result.Uploads.length - 1].UploadId;
+					partsinfo = await this.bucket
+						.listParts({
+							Bucket: this.bucketname,
+							Key: key,
+							UploadId: this.uploadid,
+						})
+						.promise();
+				}
+			} catch (err) {
+				console.log(err);
+			}
+			return { uploadid: this.uploadid, partsinfo };
+		},
+
+		//分段上传
+		async awsuploadpart(filestate, file, uploadid, parts, key) {
+			var partarr = []; //已完成的数组
+			//已完成的分片,转化成提交格式
+			const completeparts = parts.map((_) => {
+				partarr.push(_.PartNumber);
+				return { PartNumber: _.PartNumber, ETag: _.ETag };
+			});
+			// 分块上传文件
+			// parts = [];
+			let uploadpart;
+			let start = 0;
+			let end = 0;
+			let len = Math.ceil(file.size / this.partsize); //循环的长度
+			if (partarr.length) {
+				this.filestate.status = "processing";
+				this.filestate.percent = parseInt((completeparts.length * 100) / len);
+			}
+			//循环上传
+			for (let i = 0; i < len; i++) {
+				start = i * this.partsize;
+				end = (i + 1) * this.partsize;
+				if (!partarr.includes(i)) {
+					uploadpart = await this.uploadPart(
+						file,
+						key,
+						uploadid,
+						i + 1,
+						start,
+						end
+					);
+					if (uploadpart.ETag != null) {
+						completeparts.push(uploadpart);
+						this.filestate.percent = parseInt(
+							(completeparts.length * 100) / len
+						);
+					} else {
+						this.filestate.status = "fail";
+						return;
+					}
+				}
+			}
+			//提交上传成功信息
+			let data = await this.completeMultipartUpload(completeparts, uploadid);
+			this.filestate.status = "success";
+			return data;
+		},
+
+		//上传的接口
+		async awsupload(file, folderid) {
+			debugger;
+			this.init(); //初始化桶
+			const key = (folderid || uuidv4()) + "/" + file.name; //需要上传的文件名
+			this.filestate.percent = 0;
+			this.filestate.status = "start";
+			//上传的参数
+			var params = {
+				Bucket: this.bucketname,
+				Key: key,
+			};
+			//设置桶上传文件
+			try {
+				//检查文件是否已上传
+				this.bucket.headObject(params, async (err, data) => {
+					// 没有上传成功,head方法会返回失败
+					if (err) {
+						//检查是否部分上传
+						const { uploadid, partsinfo } = await this.getawscheckpoint(
+							key,
+							this.bucket
+						);
+						console.log(uploadid);
+						//如果已经部分存在,那么直接在节点续传
+						if (uploadid) {
+							//断点续传
+							this.awsuploadpart(
+								this.filestate,
+								file,
+								uploadid,
+								partsinfo.Parts,
+								key
+							);
+						}
+						//不存在,上传新的
+						else {
+							const uploadid = await this.initMultipartUpload(key); //初始化文件上传
+							this.awsuploadpart(this.filestate, file, uploadid, [], key);
+						}
+					}
+					//如果已经上传成功了,那么直接返回状态百分百
+					else if (data) {
+						//data存在,上传成功
+						console.log(data);
+
+						this.filestate.percent = 100;
+						this.filestate.status = "success";
+					}
+				});
+			} catch (err) {
+				this.filestate.status = "error";
+				console.log(err);
+			}
+			return this.filestate;
+		},
+	},
+	mounted() {},
+};
+</script>
+
+<style scoped>
+.uploadBox {
+	display: none;
+}
+</style>

+ 55 - 0
src/components/pages/csTest/index.vue

@@ -0,0 +1,55 @@
+<template>
+	<div>
+		<el-button @click="open()">打开弹窗</el-button>
+		<!-- ?userid=1298a40e-1566-11ee-91d8-005056b86db5&oid=797f7d4d-12bf-11ef-ade9-005056b86db5&org=1973f6c7-1561-11ee-91d8-005056b86db5 -->
+		<!-- ?userid=5943e08c-b7d4-11ed-8d51-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5&role=0 -->
+		<!-- <el-button type="primary" @click="$router.push('/classroomObservation?userid=5943e08c-b7d4-11ed-8d51-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5')">去课堂观察</el-button> -->
+		<!-- <el-button type="primary" @click="$router.push('/classroomObservation?userid=1298a40e-1566-11ee-91d8-005056b86db5&oid=797f7d4d-12bf-11ef-ade9-005056b86db5&org=1973f6c7-1561-11ee-91d8-005056b86db5')">去课堂观察</el-button> -->
+		<el-button type="primary" @click="$router.push('/classroomObservation?userid=6c56ec0e-2c74-11ef-bee5-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5')">去课堂观察</el-button>
+		<!-- <el-button type="primary" @click="$router.push('/pblCourse?courseId=75a6969d-f917-11ed-91d8-005056b86db5&userid=cf9fa855-db6b-11ee-b534-005056b86db5&oid=c32d9cc0-db6b-11ee-b534-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5&cid=&tType=1&screenType=1&tcid=fc230009-b963-11ed-8d51-005056b86db5')">去pblCourse</el-button> -->
+		<el-button type="primary" @click="$router.push('/guide?userid=6c56ec0e-2c74-11ef-bee5-005056b86db5&oid=c32d9cc0-db6b-11ee-b534-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5')">去课堂列表</el-button>
+		<el-button type="primary" @click="$router.push('/contrastObservation?tid=QGT2004022621')">去对比观察</el-button>
+		<el-button @click="testUpload">测试上传文件</el-button>
+
+		<shareDialog ref="shareDialogRef"/>
+		<uploadFile ref="uploadFileRef"/>
+	</div>
+</template>
+
+<script>
+import shareDialog from './component/shareDialog'
+import uploadFile from './component/uploadFile.vue';
+export default {
+	components:{
+		shareDialog,
+		uploadFile
+	},
+	data(){
+		return{
+			value:``
+		}
+	},
+	methods:{
+		open(){
+			this.$refs.shareDialogRef.open("cb0d7605-f61d-11ee-b534-005056b86db5");
+		},
+		testUpload(){
+			let input = document.createElement("input");
+			input.type = "file";
+			// input.accept = ".wav";
+			// input.accept = "audio/*, .txt, .pdf, .xlsx";
+			input.accept = "*";
+			input.click();
+			input.onchange = () => {
+				this.uploadFileLoading = true;
+				let file = input.files[0];
+				this.$refs.uploadFileRef.awsupload(file);
+			}
+		}
+	}
+}
+</script>
+
+<style scoped>
+
+</style>

+ 8 - 0
src/router/index.js

@@ -130,6 +130,7 @@ import pblCourse from '@/components/pages/pblCourse/index'
 import guide from '@/components/pages/pblCourse/guide'
 import testExamine from '@/components/pages/test/examine'
 import testPersonExamine from '@/components/pages/testPerson/examine'
+import csTest from '@/components/pages/csTest'
 // 全局修改默认配置,点击空白处不能关闭弹窗
 ElementUI.Dialog.props.closeOnClickModal.default = false
 Vue.use(Router).use(ElementUI)
@@ -1117,6 +1118,13 @@ export default new Router({
 					meta:{
 						requireAuth:''//不需要鉴权
 					}
+				},{
+					path:"/csTest",
+					name:"csTest",
+					component:csTest,
+					meta:{
+						requireAuth:''//不需要鉴权
+					}
 				}
     ]
 })