27
This commit is contained in:
@@ -67,7 +67,9 @@
|
||||
import SimpleEditor from "./SimpleEditor";
|
||||
import ChatingActionBar from "./ChatingActionBar";
|
||||
import Recoder from "./Recoder";
|
||||
|
||||
import {upload} from "@/api/login.js"
|
||||
import IM from "@/util/im.js";
|
||||
import permision from "@/js_sdk/wa-permission/permission.js"
|
||||
const needClearTypes = [MessageType.TextMessage];
|
||||
|
||||
const rtcChoose = [
|
||||
@@ -177,8 +179,12 @@
|
||||
if (needClearTypes.includes(message.contentType)) {
|
||||
this.$refs.customEditor.clear();
|
||||
}
|
||||
let method = IMMethods.SendMessage;
|
||||
if([MessageType.PictureMessage,MessageType.VoiceMessage,MessageType.VideoMessage,MessageType.FileMessage].includes(message.contentType)){
|
||||
method = IMMethods.SendMessageNotOss;
|
||||
}
|
||||
this.$emit("scrollToBottom");
|
||||
IMSDK.asyncApi(IMMethods.SendMessage, IMSDK.uuid(), {
|
||||
IMSDK.asyncApi(method, IMSDK.uuid(), {
|
||||
recvID: user_id,
|
||||
groupID: group_id,
|
||||
message,
|
||||
@@ -211,7 +217,6 @@
|
||||
});
|
||||
},
|
||||
recordAudioMsg(){
|
||||
|
||||
if (uni.getSystemInfoSync().platform == "android") {
|
||||
permission.requestAndroid("android.permission.RECORD_AUDIO"); //Android请求录音权限
|
||||
} else {
|
||||
@@ -281,36 +286,15 @@
|
||||
sendMediaMesage(paths) {
|
||||
const _this = this;
|
||||
paths.forEach(async (item) => {
|
||||
console.log(item);
|
||||
try {
|
||||
let message = null;
|
||||
if(item.search('.mp4')>0){
|
||||
const realVideoPath = await getPurePath(item);
|
||||
console.log('处理后的可用路径', realVideoPath);
|
||||
const info = await getVideoInfo(realVideoPath);
|
||||
//const cover = await getVideoCover(item);
|
||||
const res1 = await IMSDK.getVideoCover(item);
|
||||
//console.log(res1.path);
|
||||
const videoParams = {
|
||||
videoPath: realVideoPath,
|
||||
videoType: "mp4",
|
||||
duration: info.duration,
|
||||
snapshotPath: getPurePath(res1.path),
|
||||
//snapshotPath: getPurePath(cover),
|
||||
};
|
||||
console.log('videoParams', videoParams);
|
||||
message = await IMSDK.asyncApi(
|
||||
IMMethods.CreateVideoMessageFromFullPath,
|
||||
IMSDK.uuid(),
|
||||
videoParams
|
||||
);
|
||||
message = await IM.createVideoMessage(item);
|
||||
}else{
|
||||
message = await IMSDK.asyncApi(
|
||||
IMMethods.CreateImageMessageFromFullPath,
|
||||
IMSDK.uuid(),
|
||||
getPurePath(item)
|
||||
);
|
||||
message = await IM.createImageMessage(item);
|
||||
}
|
||||
//console.log(message);
|
||||
console.log(message);
|
||||
if(message){
|
||||
_this.sendMessage(message,_this.storeCurrentConversation.userID,_this.storeCurrentConversation.groupID);
|
||||
}
|
||||
@@ -401,6 +385,31 @@
|
||||
break;
|
||||
}
|
||||
},
|
||||
pickMedia(){
|
||||
const _this = this;
|
||||
plus.gallery.pick(({files})=>{
|
||||
console.log(files);
|
||||
_this.sendMediaMesage(files);
|
||||
}, (error )=>{
|
||||
console.log(error);
|
||||
}, {
|
||||
animation:true,
|
||||
confirmText:"确定",
|
||||
//crop:null,
|
||||
editable:true,
|
||||
filename:"_doc/",
|
||||
//filter:"none",//image,none,video
|
||||
filter:"image",
|
||||
maximum:9,
|
||||
multiple:true,
|
||||
permissionAlert:true,
|
||||
//popover:{},
|
||||
//selected:[""],
|
||||
onmaxed(){
|
||||
console.log("超出最大选择数");
|
||||
},
|
||||
});
|
||||
},
|
||||
onUserEvent(e){
|
||||
const _this = this;
|
||||
switch(e.type){
|
||||
@@ -455,33 +464,8 @@
|
||||
return ;
|
||||
}
|
||||
if(e.source == "album"){
|
||||
// IMSDK.pickFile().then(res=>{
|
||||
// console.log(res);
|
||||
// }).catch(e=>{
|
||||
// console.log(e);
|
||||
// });
|
||||
// return;
|
||||
plus.gallery.pick(({files})=>{
|
||||
_this.sendMediaMesage(files);
|
||||
}, (error )=>{
|
||||
console.log(error);
|
||||
}, {
|
||||
animation:true,
|
||||
confirmText:"确定",
|
||||
//crop:null,
|
||||
editable:true,
|
||||
filename:"_doc/",
|
||||
filter:"none",
|
||||
maximum:9,
|
||||
multiple:true,
|
||||
permissionAlert:true,
|
||||
//popover:{},
|
||||
//selected:[""],
|
||||
onmaxed(){
|
||||
console.log("超出最大选择数");
|
||||
},
|
||||
});
|
||||
}
|
||||
_this.pickMedia();
|
||||
}
|
||||
break;
|
||||
case "prepend_call_message":
|
||||
this.actionSheetMenu = [...rtcChoose];
|
||||
|
||||
Reference in New Issue
Block a user