This commit is contained in:
2025-11-25 05:36:02 +08:00
parent 8e036cc171
commit b10e4b4336
65 changed files with 2672 additions and 2270 deletions
@@ -25,40 +25,26 @@
</template>
<script>
import {
mapGetters,
mapActions
} from "vuex";
import {
getPurePath,
html2Text
} from "@/util/common";
import {
offlinePushInfo
} from "@/util/imCommon";
import {
ChatingFooterActionTypes,
UpdateMessageTypes,
} from "@/constant";
import IMSDK, {
IMMethods,
MessageStatus,
MessageType,
} from "openim-uniapp-polyfill";
import {mapGetters,mapActions} from "vuex";
import {getPurePath,html2Text} from "@/util/common";
import {offlinePushInfo} from "@/util/imCommon";
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
import UParse from "@/components/gaoyia-parse/parse.vue";
import CustomEditor from "./CustomEditor.vue";
import ChatingActionBar from "./ChatingActionBar.vue";
const needClearTypes = [MessageType.TextMessage];
const albumChoose = [{
name: "图片",
type: ChatingFooterActionTypes.Album,
const rtcChoose = [
{
name: "视频通话",
type: ChatingFooterActionTypes.Video,
idx: 0,
},
{
name: "拍照",
type: ChatingFooterActionTypes.Camera,
name: "语言通话",
type: ChatingFooterActionTypes.Voice,
idx: 1,
},
];
@@ -133,23 +119,19 @@
message,
offlinePushInfo,
})
.then(({
data
}) => {
.then(({data}) => {
this.updateOneMessage({
message: data,
isSuccess: true,
});
})
.catch(({
data,
errCode,
errMsg
}) => {
.catch(({data,errCode,errMsg}) => {
uni.$u.toast(errMsg);
this.updateOneMessage({
message: data,
type: UpdateMessageTypes.KeyWords,
keyWords: [{
keyWords: [
{
key: "status",
value: MessageStatus.Failed,
},
@@ -186,14 +168,62 @@
this.inputHtml = e.detail.html;
},
prepareMediaMessage(type) {
if (type === ChatingFooterActionTypes.Album) {
this.actionSheetMenu = [...albumChoose];
console.log(type)
if (type === ChatingFooterActionTypes.Video) {
this.actionSheetMenu = [...rtcChoose];
this.showActionSheet = true;
}
if (type === ChatingFooterActionTypes.Album) {
this.chooseOrShotImage(["album"]).then((paths) =>
this.batchCreateImageMesage(paths)
);
}
if (type === ChatingFooterActionTypes.Camera) {
this.chooseOrShotImage(["camera"]).then((paths) =>
this.batchCreateImageMesage(paths)
);
}
if (type === ChatingFooterActionTypes.Location) {
uni.chooseLocation({
complete(res) {
console.log(res);
},
fail(res) {
console.log(res);
}
//latitude:1,
//longitude:1,
})
}
this.showActionSheet = true;
},
// from comp
batchCreateImageMesage(paths) {
/*
createAdvancedTextMessage
createTextAtMessage
createLocationMessage
createTextMessage
createCustomMessage
createQuoteMessage
createAdvancedQuoteMessage
createCardMessage
createImageMessage
createImageMessage
createImageMessageByURL
createSoundMessage
createSoundMessageFromFullPath
createSoundMessageByURL
createVideoMessage
createVideoMessageFromFullPath
createVideoMessageByURL
createFileMessage
createFileMessageFromFullPath
createFileMessageByURL
createMergerMessage
createFaceMessage
createForwardMessage
*/
paths.forEach(async (path) => {
const message = await IMSDK.asyncApi(
IMMethods.CreateImageMessageFromFullPath,
@@ -203,17 +233,19 @@
this.sendMessage(message);
});
},
selectClick({
idx
}) {
selectClick({idx}) {
if (idx === 0) {
this.chooseOrShotImage(["album"]).then((paths) =>
this.batchCreateImageMesage(paths)
);
uni.$u.toast('根据相关政策,暂时禁用视频通话');
//发送视频通话
// this.chooseOrShotImage(["album"]).then((paths) =>
// this.batchCreateImageMesage(paths)
// );
} else {
this.chooseOrShotImage(["camera"]).then((paths) =>
this.batchCreateImageMesage(paths)
);
uni.$u.toast('根据相关政策,暂时禁用音频通话');
//发送音频通话
// this.chooseOrShotImage(["camera"]).then((paths) =>
// this.batchCreateImageMesage(paths)
// );
}
},
chooseOrShotImage(sourceType) {
@@ -222,9 +254,7 @@
count: 9,
sizeType: ["compressed"],
sourceType,
success: function({
tempFilePaths
}) {
success: function({tempFilePaths}) {
resolve(tempFilePaths);
},
fail: function(err) {
@@ -236,9 +266,7 @@
},
// keyboard
keyboardChangeHander({
height
}) {
keyboardChangeHander({height}) {
if (height > 0) {
if (this.actionBarVisible) {
this.actionBarVisible = false;