|
@@ -341,7 +341,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- baseUrl: "http://192.168.100.8:3000/",
|
|
|
+ // baseUrl: "http://192.168.100.8:3000/",
|
|
|
+ baseUrl: "http://127.0.0.1:3000/",
|
|
|
emojiIcon: emojiData.icon,
|
|
|
inputRange: "", // 光标
|
|
|
emojiPath: new Map(), // emoji表情地址map对象,
|
|
@@ -403,22 +404,11 @@ export default {
|
|
|
// 调用函数分割文件 我这里是分割成不超过20M的文件快
|
|
|
this.fileDataList = this.createFileChunk(file, 1024 * 1024 * 20);
|
|
|
console.log(`this.fileDataList`, this.fileDataList);
|
|
|
- // return new Promise((reslove, reject)=>{
|
|
|
- // this.fileUpLoad(reslove, reject);
|
|
|
- // })
|
|
|
- let fd = new FormData();
|
|
|
- fd.append("filename", file);
|
|
|
- // upload_file(fd).then(
|
|
|
- request
|
|
|
- .upload_file(file)
|
|
|
+
|
|
|
+ request.upload_file(file)
|
|
|
.then(res => {
|
|
|
- console.log(`res5555`, res);
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.log(`err`, err);
|
|
|
- });
|
|
|
- this.$http.post(this.baseUrl + "api/upload/", fd).then(
|
|
|
- res => {
|
|
|
+ console.log(`res`, res)
|
|
|
+ console.log('============上传成功=======')
|
|
|
if (
|
|
|
file.type === "image/jpeg" ||
|
|
|
file.type === "image/png" ||
|
|
@@ -426,23 +416,34 @@ export default {
|
|
|
) {
|
|
|
this.messageType = "image";
|
|
|
this.sendMsg(null, res.data.data);
|
|
|
- console.log(`res.data.data`, res.data.data);
|
|
|
- console.log("========is image =====");
|
|
|
} else {
|
|
|
this.messageType = "file";
|
|
|
- console.log("=========not image=========");
|
|
|
}
|
|
|
- // this.importDataBtnText='导入成功';
|
|
|
- console.log(`res1111`, res);
|
|
|
- console.log("======success====");
|
|
|
- },
|
|
|
- res => {
|
|
|
- this.$message.error("文件发送失败");
|
|
|
- console.log("===========shibai====");
|
|
|
- // this.importDataBtnText='导入失败';
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
- );
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(`upload----err`, err);
|
|
|
+ console.log('===========上传失败2333-----')
|
|
|
+ });
|
|
|
+ // this.$http.post(this.baseUrl + "api/upload/", fd).then(
|
|
|
+ // res => {
|
|
|
+ // if (
|
|
|
+ // file.type === "image/jpeg" ||
|
|
|
+ // file.type === "image/png" ||
|
|
|
+ // file.type === "image/gif"
|
|
|
+ // ) {
|
|
|
+ // this.messageType = "image";
|
|
|
+ // this.sendMsg(null, res.data.data);
|
|
|
+ // } else {
|
|
|
+ // this.messageType = "file";
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // res => {
|
|
|
+ // this.$message.error("文件发送失败");
|
|
|
+ // console.log("===========shibai====");
|
|
|
+ // // this.importDataBtnText='导入失败';
|
|
|
+ // console.log(res);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
return false;
|
|
|
},
|
|
|
submitUpload() {
|