恢复视频的发布

This commit is contained in:
cansnow
2026-02-15 19:40:36 +08:00
parent 7c6656d1fc
commit abd279e7a7
22 changed files with 236 additions and 129 deletions
+43 -31
View File
@@ -1,21 +1,27 @@
<template>
<view class="contact_choose_container">
<custom-nav-bar title="联系人">
<view slot="more" style="margin-right: 10rpx;">
<u-button type="primary" @click="confirm" :disabled="!isConfirmEnable">确定</u-button>
</view>
</custom-nav-bar>
<uni-nav-bar
left-icon="back"
@clickLeft="uni.$u.route({type:'back'})"
statusBar
title="联系人">
<template v-slot:right>
<u-button type="primary" size="mini" @click="confirm" :disabled="!isConfirmEnable">确定</u-button>
</template>
</uni-nav-bar>
<view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
</view>
<view class="tab_container">
<template v-if="activeTab === 0">
<setting-item @click="tabChange(tabs[0].idx)" :title="tabs[0].title" :border="false" />
<div @click="tabChange(tabs[0].idx)" style="display: flex; align-items: center;justify-content: space-between;padding: 20rpx 40rpx;">
{{ tabs[0].title }}
<u-icon name="arrow-right" />
</div>
<view class="tab_pane">
<template v-for="cell in conversationList">
<template v-if="cell.groupID">
<template v-if="cell.groupID && type!='Invite'">
<user-item
v-if="allowGroup"
@itemClick="updateCheckedUserOrGroup"
@@ -25,7 +31,7 @@
:checkVisible="muitple"
:item="cell" :key="cell.groupID" />
</template>
<template v-if="cell.userID">
<template v-if="cell.userID && !cell.userID.startsWith('system')">
<user-item
@itemClick="updateCheckedUserOrGroup"
@updateCheck="updateCheckedUserOrGroup"
@@ -57,20 +63,16 @@
import { mapGetters } from "vuex";
import {ContactChooseTypes} from "@/constant";
import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import IMSDK from "openim-uniapp-polyfill"
import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
import SettingItem from "@/components/SettingItem/index.vue";
export default {
components: {
CustomNavBar,
UserItem,
ChooseIndexList,
ChooseIndexFooter,
SettingItem,
ChooseIndexFooter
},
data() {
return {
@@ -94,18 +96,23 @@
};
},
computed: {
...mapGetters([
"storeFriendList",
"storeCurrentConversation",
"storeCurrentUserID",
"storeConversationList",
]),
...mapGetters(["storeCurrentUserID","storeFriendList","storeConversationList",'storeCurrentConversation']),
getChooseData() {
const _this = this;
let list = [...this.storeFriendList];
list = list.filter((item)=>{
return !item.userID.startsWith('system') && !item.userID.startsWith('official_team') && item.userID !== this.storeCurrentUserID
});
if(!this.allowGroup){
list = list.filter((item)=>{
return !item.groupID
});
}
if (this.keyword) {
return {
indexList: ["#"],
dataList: [
this.storeFriendList.filter(
list.filter(
(friend) =>
friend.nickname.includes(this.keyword) ||
friend.remark.includes(this.keyword)
@@ -113,12 +120,20 @@
],
};
}
return formatChooseData(this.storeFriendList);
return formatChooseData(list);
},
conversationList(){
const _this = this;
let list = [...this.storeConversationList];
list = list.filter((item)=>{
return !item.userID.startsWith('system') && !item.userID.startsWith('official_team') && item.userID !== this.storeCurrentUserID
});
if(!this.allowGroup){
list = list.filter((item)=>{
return !item.groupID
});
}
if(this.keyword){
list = list.filter((item)=>{
return item.showName.indexOf(_this.kw)>-1 || item.userID.indexOf(_this.kw)>-1 || item.groupID.indexOf(_this.kw)>-1
@@ -165,18 +180,16 @@
}
},
onLoad(options) {
const {groupID,type,checkedUserIDList,muitple} = options;
const {groupID,type,checkedUserIDList,muitple,allowType} = options;
this.type = type;
if(allowType){
this.allowGroup = allowType === 'All';
}
this.groupID = groupID;
if(muitple){
this.muitple = muitple;
}
//this.muitple = true;
this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : [];
//console.log(this.checkedUserIDList);
//console.log(this.groupID);
//console.log(this.muitple);
//console.log(this.type);
if (this.type === ContactChooseTypes.Invite) {
this.allowGroup = false;
this.checkDisabledUser();
@@ -299,7 +312,7 @@
}
.contact_choose_container {
height: 100vh;
min-height: 100vh;
display: flex;
flex-direction: column;
@@ -311,7 +324,6 @@
.tab_container {
@include colBox(false);
flex: 1;
overflow: hidden;
.setting_item {
padding: 32rpx 36rpx;
@@ -1,10 +1,14 @@
<template>
<view class="contact_choose_container">
<custom-nav-bar title="群成员">
<view slot="more" style="margin-right: 10rpx;">
<u-button type="primary" @click="confirm" :disabled="!isConfirmEnable">确定</u-button>
</view>
</custom-nav-bar>
<uni-nav-bar
left-icon="back"
@clickLeft="uni.$u.route({type:'back'})"
statusBar
title="群成员">
<template v-slot:right>
<u-button type="primary" size="mini" @click="confirm" :disabled="!isConfirmEnable">确定</u-button>
</template>
</uni-nav-bar>
<view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
@@ -25,16 +29,13 @@
</template>
<script>
import {mapGetters} from "vuex";
import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import IMSDK from "openim-uniapp-polyfill"
import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
export default {
components: {
CustomNavBar,
UserItem,
ChooseIndexList
},
+53 -19
View File
@@ -1,6 +1,11 @@
<template>
<view class="contact_choose_container">
<custom-nav-bar title="联系人" />
<uni-nav-bar
left-icon="back"
@clickLeft="uni.$u.route({type:'back'})"
statusBar
title="联系人">
</uni-nav-bar>
<view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
@@ -8,14 +13,17 @@
<view class="tab_container">
<template v-if="activeTab === 0">
<setting-item @click="tabChange(tabs[0].idx)" :title="tabs[0].title" :border="false" />
<div @click="tabChange(tabs[0].idx)" style="display: flex; align-items: center;justify-content: space-between;padding: 20rpx 40rpx;">
{{ tabs[0].title }}
<u-icon name="arrow-right" />
</div>
<view class="tab_pane">
<user-item
@updateCheck="updateCheckedUser"
:checked="checkedUserIDList.includes(cell.userID)"
:disabled="disabledUserIDList.includes(cell.userID)"
:checkVisible="true"
v-for="cell in storeConversationList" :item="cell" :key="cell.userID" />
v-for="cell in conversationList" :item="cell" :key="cell.userID" />
</view>
</template>
@@ -36,20 +44,16 @@
import { mapGetters } from "vuex";
import {ContactChooseTypes} from "@/constant";
import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import IMSDK from "openim-uniapp-polyfill"
import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
import SettingItem from "@/components/SettingItem/index.vue";
export default {
components: {
CustomNavBar,
UserItem,
ChooseIndexList,
ChooseIndexFooter,
SettingItem,
ChooseIndexFooter
},
data() {
return {
@@ -70,18 +74,42 @@
};
},
computed: {
...mapGetters([
"storeFriendList",
"storeCurrentConversation",
"storeCurrentUserID",
"storeConversationList",
]),
...mapGetters(["storeFriendList","storeConversationList",'storeCurrentConversation',"storeCurrentUserID"]),
conversationList(){
const _this = this;
let list = [...this.storeConversationList];
list = list.filter((item)=>{
return !item.userID.startsWith('system') && !item.userID.startsWith('official_team') && item.userID !== this.storeCurrentUserID
});
if(!this.allowGroup){
list = list.filter((item)=>{
return !item.groupID
});
}
if(this.keyword){
list = list.filter((item)=>{
return item.showName.indexOf(_this.kw)>-1 || item.userID.indexOf(_this.kw)>-1 || item.groupID.indexOf(_this.kw)>-1
})
}
return list;
},
getChooseData() {
const _this = this;
let list = [...this.storeFriendList];
list = list.filter((item)=>{
return !item.userID.startsWith('system') && !item.userID.startsWith('official_team') && item.userID !== this.storeCurrentUserID
});
if(!this.allowGroup){
list = list.filter((item)=>{
return !item.groupID
});
}
if (this.keyword) {
return {
indexList: ["#"],
dataList: [
this.storeFriendList.filter(
list.filter(
(friend) =>
friend.nickname.includes(this.keyword) ||
friend.remark.includes(this.keyword)
@@ -89,7 +117,7 @@
],
};
}
return formatChooseData(this.storeFriendList);
return formatChooseData(list);
},
getCheckedInfo() {
const tmpUserIDList = [...this.checkedUserIDList];
@@ -106,10 +134,16 @@
},
},
onLoad(options) {
const {groupID,type,checkedUserIDList,limit} = options;
//console.log(this.storeFriendList);
//cardInfo
const {groupID,type,checkedUserIDList,muitple,allowType,limit} = options;
this.type = type;
if(allowType){
this.allowGroup = allowType === 'All';
}
this.groupID = groupID;
if(muitple){
this.muitple = muitple;
}
this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : [];
if (this.type === ContactChooseTypes.Invite) {
this.checkDisabledUser();
+1 -1
View File
@@ -84,7 +84,7 @@ export default {
(member) => member.userID,
);
uni.navigateTo({
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.GetList}&checkedUserIDList=${JSON.stringify(checkedIDList)}`,
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.GetList}&checkedUserIDList=${JSON.stringify(checkedIDList)}&allowType=User`,
});
},
complateCreate() {
+3 -3
View File
@@ -130,7 +130,7 @@
info = {
...friendInfo
};
console.log(info);
//console.log(info);
} else {
const {
data
@@ -142,7 +142,7 @@
info = {
...(data[0] ?? {})
};
console.log(info);
//console.log(info);
}
this.isLoading = true
try {
@@ -157,7 +157,7 @@
info = {};
}
this.isLoading = false
console.log(info);
//console.log(info);
this.sourceUserInfo = {
...info,
};
+6 -1
View File
@@ -75,7 +75,12 @@
},
confirmRemove() {
IMSDK.asyncApi(IMSDK.IMMethods.DeleteFriend,IMSDK.uuid(),this.sourceInfo.userID,)
.then(() => this.showToast("操作成功"))
.then(() => {
this.showToast("操作成功");
uni.navigateBack({
delta: 2,
})
})
.catch(() => this.showToast("操作失败"))
.finally(() => (this.showConfirm = false));
},
@@ -180,9 +180,9 @@
this.$refs.customEditor.clear();
}
let method = IMMethods.SendMessage;
if([MessageType.PictureMessage,MessageType.VoiceMessage,MessageType.VideoMessage,MessageType.FileMessage].includes(message.contentType)){
method = IMMethods.SendMessageNotOss;
}
// if([MessageType.PictureMessage,MessageType.VoiceMessage,MessageType.VideoMessage,MessageType.FileMessage].includes(message.contentType)){
// method = IMMethods.SendMessageNotOss;
// }
this.$emit("scrollToBottom");
IMSDK.asyncApi(method, IMSDK.uuid(), {
recvID: user_id,
@@ -271,16 +271,8 @@
},
async sendVoiceMessage(audio){
const _this = this;
const message = await IMSDK.asyncApi(
IMMethods.CreateSoundMessageFromFullPath,
IMSDK.uuid(),
{
soundPath:getPurePath(audio.tempFilePath),
duration:audio.contentDuration
}
);
const message = await IM.createVoiceMessage(audio.tempFilePath,audio.contentDuration);
_this.sendMessage(message,_this.storeCurrentConversation.userID,_this.storeCurrentConversation.groupID);
},
// from comp
sendMediaMesage(paths) {
@@ -290,8 +282,10 @@
try {
let message = null;
if(item.search('.mp4')>0){
console.log('1');
message = await IM.createVideoMessage(item);
}else{
console.log('2');
message = await IM.createImageMessage(item);
}
console.log(message);
@@ -335,7 +329,7 @@
const _this = this;
if(e.type=="atevent" && this.storeCurrentConversation.groupID){
uni.navigateTo({
url: `/pages/common/contactChoose/chooseGroupMember?groupID=${this.storeCurrentConversation.groupID}&checkedUserIDList=[]&hideUserIDList=[${this.storeCurrentUserID}]`,
url: `/pages/common/contactChoose/chooseGroupMember?groupID=${this.storeCurrentConversation.groupID}&checkedUserIDList=[]&hideUserIDList=[${this.storeCurrentUserID}]&allowType=User`,
events: {
onSelectedConfirm(userList) {
userList.forEach((user)=>{
@@ -398,8 +392,7 @@
//crop:null,
editable:true,
filename:"_doc/",
//filter:"none",//image,none,video
filter:"image",
filter:"none",//image,none,video
maximum:9,
multiple:true,
permissionAlert:true,
@@ -51,11 +51,6 @@
return 120 * aspectRatio;
}
},
watch: {
src(newVal, oldVal) {
console.log(newVal,oldVal);
}
},
created() {
this.init();
},
@@ -63,18 +58,38 @@
async init(){
const self = this;
let url = "";
const pictureElem = this.message.pictureElem;
// 如果有远程 snapshotUrl,则下载到 coverCachePath
//const snapshotUrl = (this.message.pictureElem.snapshotPicture?.url ?? this.message.pictureElem.sourcePath );
const snapshotUrl = this.message.pictureElem.sourcePicture?.url;
let snapshotUrl = pictureElem?.sourcePath;
if(snapshotUrl && await util.fileExsit(snapshotUrl)){
self.src = snapshotUrl;
return ;
}
snapshotUrl = (pictureElem?.sourcePicture.url ?? pictureElem.bigPicture?.url);
if(!snapshotUrl){
console.log(this.message);
return;
}
//console.log(snapshotUrl);
console.log(snapshotUrl);
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
self.coverDownloading = false;
self.src = fn;
//console.log(fn);
console.log(fn);
});
},
getShowPath(url){
return new Promise((resolve,reject)=>{
if(url.startsWith('file')||url.startsWith('_')||url.startsWith('http')||url.startsWith('blob')){
return resolve(url);
}
plus.io.resolveLocalFileSystemURL(url, function(entry) {
return resolve(entry.toLocalURL());
}, function(e) {
console.log(e);
resolve(url);
});
});
},
clickMediaItem() {
@@ -162,7 +162,7 @@
},
deleteConversation(conversationID){
IMSDK.asyncApi(IMSDK.IMMethods.DeleteConversationAndDeleteAllMsg, IMSDK.uuid(), conversationID).then(res=>{
this.$store.dispatch('conversation/deleteConversation',conversationID).then(res=>{
console.log('删除成功');
}).catch(e=>{
@@ -85,7 +85,7 @@
},
inviteMember() {
uni.navigateTo({
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}&allowType=User`,
});
},
removeMember() {
+2 -2
View File
@@ -30,15 +30,15 @@
<u-loading-icon></u-loading-icon>
</view>
</u-list>
<template v-if="showCheck" >
<choose-index-footer
v-if="showCheck"
:comfirmLoading="comfirmLoading"
@removeItem="updateCheck"
@confirm="confirm"
:choosedData="getChoosedData"
:isRemove="isRemove"
:maxLength="groupMemberLength" />
</template>
<u-modal
:show="showConfirmModal"
@@ -76,7 +76,7 @@
},
inviteMember() {
uni.navigateTo({
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}&allowType=User`,
});
},
kickMember() {
+1 -1
View File
@@ -245,7 +245,7 @@
showTypeSheet() {
const _this = this;
uni.showActionSheet({
itemList:['文字','照片'/*,'视频'*/],
itemList:['文字','照片','视频'],
success: function (res) {
//toChooseRelease
if([1,2].includes(res.tapIndex)){
+2 -2
View File
@@ -22,9 +22,9 @@
<u-gap :height="10"></u-gap>
<uni-list>
<uni-list-item title="扫一扫" thumb="/static/images/find/03.png" :thumbSize="thumbSize" @click="scan" clickable showArrow></uni-list-item>
<uni-list-item v-if="1==2" title="摇一摇" thumb="/static/images/find/05.png" :thumbSize="thumbSize" to="/pages/find/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item v-if="1==2" title="摇一摇" thumb="/static/images/find/05.png" :thumbSize="thumbSize" to="/pages/find/shake/index" showArrow></uni-list-item>
<uni-list-item v-if="1==2" title="看一看" thumb="/static/images/find/06.png" :thumbSize="thumbSize" to="/pages/find/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item v-if="1==2" title="听一听" thumb="/static/images/find/06.png" :thumbSize="thumbSize" to="/pages/find/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item v-if="1==2" title="听一听" thumb="/static/images/find/06.png" :thumbSize="thumbSize" to="/pages/find/music/index" showArrow></uni-list-item>
<uni-list-item v-if="config.near_user_open == '1'" title="附近" thumb="/static/images/find/08.png" :thumbSize="thumbSize" to="/pages/find/near/near" showArrow></uni-list-item>
<uni-list-item v-if="1===2" title="购物" thumb="/static/images/find/09.png" :thumbSize="thumbSize" :to="'/pages/common/webview?url='+encodeURI('http://pinduoduo.com')" showArrow></uni-list-item>
</uni-list>
+1 -1
View File
@@ -85,7 +85,7 @@
let system = uni.getSystemInfoSync();
const _this = this;
plus.runtime.getProperty(plus.runtime.appid,(inf) => {
console.log(inf);
//console.log(inf);
_this.appversion = inf.version
});
},
+10
View File
@@ -72,6 +72,16 @@
],
};
},
// onShow() {
// const path = plus.io.convertLocalFileSystemURL('/storage/emulated/0/DCIM/Download/oceans.mp4');
// console.log('path:', path);
// const res1 = IMSDK.getVideoCover(path).then(res => {
// console.log('视频封面:', res);
// }).catch(err => {
// console.error('获取视频封面失败:', err);
// });
// console.log('res1:', res1);
// },
methods: {
...util,
copy() {
+1 -1
View File
@@ -31,7 +31,7 @@ const actions = {
},
async getFriendCircleInfo({ commit, state}) {
uni.$u.http.get('/friendcircle/info').then(data=>{
console.log("获取朋友圈信息",data);
//console.log("获取朋友圈信息",data);
commit("SET_UNREAD_COUNT", data.unread_count);
commit("SET_TOP_UNREAD_ITEMS", data.top_unread_items);
commit("SET_SETTINGS", data.settings);
+8 -5
View File
@@ -1,8 +1,6 @@
import {
v4 as uuidv4
} from "uuid";
import {v4 as uuidv4} from "uuid";
import IMSDK from "openim-uniapp-polyfill";
import conversation from "./conversation";
const state = {
friendList: [],
blackList: [],
@@ -160,7 +158,7 @@ const actions = {
commit("SET_FRIEND_LIST", [...tmpList, friendInfo]);
}
},
updateFriendInfo({commit,state}, { friendInfo,isRemove = false}) {
updateFriendInfo({commit,state,dispatch }, { friendInfo,isRemove = false}) {
const tmpList = [...state.friendList];
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
@@ -174,6 +172,11 @@ const actions = {
}
commit("SET_FRIEND_LIST", tmpList);
}
if (isRemove) {
const conversationID = friendInfo.userID ? `si_${friendInfo.ownerUserID}_${friendInfo.userID}` : `si_${friendInfo.groupID}`;
dispatch('conversation/deleteConversation',conversationID, { root: true });
}
},
pushNewBlack({ commit, state}, blackInfo) {
const tmpList = [...state.blackList];
+15 -3
View File
@@ -103,13 +103,25 @@ const actions = {
commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo);
}
},
resetConversationState({
commit
}) {
resetConversationState({commit}) {
commit("SET_CURRENT_MEMBER_IN_GROUP", {});
commit("SET_CURRENT_GROUP", {});
commit("SET_CURRENT_CONVERSATION", {});
},
deleteConversation({state,commit},conversationID) {
return new Promise((reject,resolve)=>{
IMSDK.asyncApi('deleteConversationAndDeleteAllMsg',uuidv4(), conversationID).then(res=>{
const list = state.conversationList.filter((item)=>{
return item.conversationID != conversationID;
});
commit("SET_CONVERSATION_LIST", [...list]);
resolve();
}).catch((e)=>{
console.error(e);
reject(e);
})
})
},
};
export default {
+1 -1
View File
@@ -81,7 +81,7 @@ const actions = {
resetMessageState({commit}) {
commit("SET_HISTORY_MESSAGE_LIST", []);
commit("SET_HAS_MORE_MESSAGE", true);
},
}
};
export default {
+40 -18
View File
@@ -7,12 +7,16 @@ import {getVideoInfo} from "@/util/common";
import {downloadFile} from "@/uni_modules/network-manage";
// #endif
export const imapi = (method,data)=>{
console.log(method);
console.log(data);
return new Promise((resolve, reject) => {
IMSDK.asyncApi(method,IMSDK.uuid(),data)
.then(res=>{
console.log(res);
return resolve(res);
})
.catch(e=>{
console.log(e);
return reject(e);
})
});
@@ -64,7 +68,14 @@ export const getPurePath = (path)=>{
}
return path;
}
export const createVoiceMessage = async (path)=>{
export const createVoiceMessage = (path,duration)=>{
return new Promise(async(resolve, reject) => {
const message = await imapi(IMMethods.CreateSoundMessageFromFullPath,{
soundPath:getPurePath(path),
duration:duration
});
return resolve(message);
});
};
export const createFileMessage = async (path)=>{
};
@@ -83,11 +94,26 @@ export const getVideoCover = async (path)=>{
};
export const createVideoMessage = (path)=>{
return new Promise(async(resolve, reject) => {
const realVideoPath = await getPurePath(path);
console.log('处理后的可用路径', realVideoPath);
const info = await getVideoInfo(realVideoPath);
//const cover = await getVideoCover(path);
const res1 = await IMSDK.getVideoCover(path);
//console.log(res1.path);
const videoParams = {
videoPath: realVideoPath,
videoType: "mp4",
duration: info.duration,
snapshotPath: getPurePath(res1.path),
//snapshotPath: getPurePath(cover),
};
console.log('videoParams', videoParams);
const message = await imapi(IMMethods.CreateVideoMessageFromFullPath,videoParams);
return resolve(message);
//不想通过imsdk上传了,想自己上传,结果发现imsdk的上传接口不支持视频,所以只能通过imsdk上传了
console.log('处理前的可用路径', path);
//const realVideoPath = await copyFileToTempPath(path);
const realVideoPath = await getPurePath(path);
//console.log('处理后的可用路径', realVideoPath);
const info = await getVideoInfo(realVideoPath);
console.log('info', info);
const cover = await getVideoCover(realVideoPath);
console.log('cover', cover);
@@ -140,23 +166,28 @@ export const createVideoMessage = (path)=>{
//const cover = await getVideoCover(path);
//const res1 = await IMSDK.getVideoCover(path);
//console.log(res1.path);
const videoParams = {
const videoParams1 = {
videoPath: realVideoPath,
videoType: "mp4",
duration: info.duration,
snapshotPath: getPurePath(res1.path),
//snapshotPath: getPurePath(cover),
};
console.log('videoParams', videoParams);
message = await IMSDK.asyncApi(
console.log('videoParams', videoParams1);
const message1 = await IMSDK.asyncApi(
IMMethods.CreateVideoMessageFromFullPath,
IMSDK.uuid(),
videoParams
);
return resolve(message);
});
};
export const createImageMessage = async (path)=>{
return new Promise(async (resolve, reject) => {
const message = await IMSDK.asyncApi(IMMethods.CreateImageMessageFromFullPath,IMSDK.uuid(),getPurePath(path));
console.log(message);
return resolve(message);
//通过自己上传的方法实现的
const result = await upload(path,{savePath: "msg"});
if(result.code !=0){
uni.$u.toast(result.msg);
@@ -171,23 +202,14 @@ export const createImageMessage = async (path)=>{
url: result.data[0].file_url
};
const message = await IMSDK.asyncApi(IMMethods.CreateImageMessageByURL,IMSDK.uuid(),{
const message1 = await IMSDK.asyncApi(IMMethods.CreateImageMessageByURL,IMSDK.uuid(),{
sourcePicture: picBaseInfo,
bigPicture: picBaseInfo,
snapshotPicture: picBaseInfo,
sourcePath: result.data[0].file_url
});
console.log('message', message);
return resolve(message);
const tempPath = await copyFileToTempPath(path);
console.log(tempPath);
imapi(IMMethods.CreateImageMessageFromFullPath,getPurePath(tempPath)).then(res=>{
console.log(res);
resolve(res);
}).catch(err=>{
console.log(err);
reject(err);
})
console.log('message', message1);
return resolve(message1);
});
}
export const sendMessage = (message, user_id, group_id) => {