|
@@ -470,8 +470,20 @@ export default {
|
|
|
},
|
|
|
//生成词云图
|
|
|
addNephogram(){
|
|
|
- this.$message.info("生成词云图")
|
|
|
+ // this.$message.info("生成词云图")
|
|
|
},
|
|
|
+ delVideo(key){
|
|
|
+ this.$confirm("确定删除该视频吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.data.imageList.videoList = [];
|
|
|
+ this.$message.success("删除成功")
|
|
|
+ }).catch(e=>{
|
|
|
+ console.log("取消删除")
|
|
|
+ });
|
|
|
+ },
|
|
|
//资源库添加文件
|
|
|
resourceLibraryDialogAddFile(file){
|
|
|
let _file = file[0];
|
|
@@ -555,25 +567,98 @@ export default {
|
|
|
},
|
|
|
//上传课堂图片
|
|
|
addImage2(){
|
|
|
- this.$message.info("上传课堂图片")
|
|
|
- // let input = document.createElement("input");
|
|
|
- // input.type = "file";
|
|
|
- // input.accept = "image/*";
|
|
|
- // input.multiple = true;
|
|
|
- // input.click();
|
|
|
-
|
|
|
-
|
|
|
- // input.onchange = () => {
|
|
|
- // this.uploadImageLoading = true;
|
|
|
- // let promise =[];
|
|
|
- // for(let i=0;i<input.files.length;i++){
|
|
|
- // promise.push(this.uploadFile(input.files[i]));
|
|
|
- // }
|
|
|
- // Promise.all(promise).then(res=>{
|
|
|
- // this.$emit("saveImage2",res);
|
|
|
- // this.uploadImageLoading = false;
|
|
|
- // })
|
|
|
- // };
|
|
|
+ let input = document.createElement("input");
|
|
|
+ input.type = "file";
|
|
|
+ input.accept = "image/*";
|
|
|
+ input.multiple = true;
|
|
|
+ input.click();
|
|
|
+
|
|
|
+
|
|
|
+ input.onchange = () => {
|
|
|
+ this.uploadImageLoading = true;
|
|
|
+ let promise =[];
|
|
|
+ for(let i=0;i<input.files.length;i++){
|
|
|
+ promise.push(this.uploadFile(input.files[i]));
|
|
|
+ }
|
|
|
+ Promise.all(promise).then(res=>{
|
|
|
+ this.saveImage2(res)
|
|
|
+ // this.$emit("saveImage2",res);
|
|
|
+ this.uploadImageLoading = false;
|
|
|
+ })
|
|
|
+ };
|
|
|
+ },
|
|
|
+ saveImage2(dataList){
|
|
|
+ for(let i=0;i<dataList.length;i++){
|
|
|
+ if (this.data.imageList.fileList1.length == 0) {
|
|
|
+ this.data.imageList.fileList1.push(dataList[i]);
|
|
|
+ } else if (this.data.imageList.fileList2.length == 0) {
|
|
|
+ this.data.imageList.fileList2.push(dataList[i]);
|
|
|
+ } else if (this.data.imageList.fileList3.length == 0) {
|
|
|
+ this.data.imageList.fileList3.push(dataList[i]);
|
|
|
+ } else {
|
|
|
+ this.$message.error("最多只能上传3张图片");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ delImage(key){
|
|
|
+ this.$confirm("确定删除该图片吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.data.imageList[key] = [];
|
|
|
+ // this.$emit("delImage", key);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ uploadFile(file){
|
|
|
+ return new Promise(resolve=>{
|
|
|
+ var credentials = {
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
+
|
|
|
+ var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
|
|
|
+ var _this = this;
|
|
|
+ if (file) {
|
|
|
+ var params = {
|
|
|
+ Key:
|
|
|
+ file.name.split(".")[0] +
|
|
|
+ new Date().getTime() +
|
|
|
+ "." +
|
|
|
+ file.name.split(".")[file.name.split(".").length - 1],
|
|
|
+ ContentType: file.type,
|
|
|
+ Body: file,
|
|
|
+ "Access-Control-Allow-Credentials": "*",
|
|
|
+ ACL: "public-read",
|
|
|
+ }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
|
|
|
+ var options = {
|
|
|
+ partSize: 2048 * 1024 * 1024,
|
|
|
+ queueSize: 2,
|
|
|
+ leavePartsOnError: true,
|
|
|
+ };
|
|
|
+ bucket
|
|
|
+ .upload(params, options)
|
|
|
+ .on("httpUploadProgress", function (evt) {
|
|
|
+ //这里可以写进度条
|
|
|
+ // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
+ })
|
|
|
+ .send(function (err, data) {
|
|
|
+ if (err) {
|
|
|
+ resolve(0)
|
|
|
+ } else {
|
|
|
+ resolve({
|
|
|
+ name: data.key,
|
|
|
+ status: "success",
|
|
|
+ uid: "1",
|
|
|
+ url: data.Location,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
previewVideo(url){
|
|
|
this.$refs.previewVideoDialogRef.open(url)
|