恢复视频的发布

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
+44 -32
View File
@@ -1,21 +1,27 @@
<template> <template>
<view class="contact_choose_container"> <view class="contact_choose_container">
<custom-nav-bar title="联系人"> <uni-nav-bar
<view slot="more" style="margin-right: 10rpx;"> left-icon="back"
<u-button type="primary" @click="confirm" :disabled="!isConfirmEnable">确定</u-button> @clickLeft="uni.$u.route({type:'back'})"
</view> statusBar
</custom-nav-bar> 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"> <view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" /> <u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
</view> </view>
<view class="tab_container"> <view class="tab_container">
<template v-if="activeTab === 0"> <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"> <view class="tab_pane">
<template v-for="cell in conversationList"> <template v-for="cell in conversationList">
<template v-if="cell.groupID"> <template v-if="cell.groupID && type!='Invite'">
<user-item <user-item
v-if="allowGroup" v-if="allowGroup"
@itemClick="updateCheckedUserOrGroup" @itemClick="updateCheckedUserOrGroup"
@@ -25,7 +31,7 @@
:checkVisible="muitple" :checkVisible="muitple"
:item="cell" :key="cell.groupID" /> :item="cell" :key="cell.groupID" />
</template> </template>
<template v-if="cell.userID"> <template v-if="cell.userID && !cell.userID.startsWith('system')">
<user-item <user-item
@itemClick="updateCheckedUserOrGroup" @itemClick="updateCheckedUserOrGroup"
@updateCheck="updateCheckedUserOrGroup" @updateCheck="updateCheckedUserOrGroup"
@@ -54,23 +60,19 @@
</template> </template>
<script> <script>
import {mapGetters} from "vuex"; import { mapGetters } from "vuex";
import {ContactChooseTypes} from "@/constant"; import {ContactChooseTypes} from "@/constant";
import {formatChooseData,toastWithCallback} from "@/util/common"; import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill"
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import UserItem from "@/components/UserItem/index.vue"; import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue"; import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue"; import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
import SettingItem from "@/components/SettingItem/index.vue";
export default { export default {
components: { components: {
CustomNavBar,
UserItem, UserItem,
ChooseIndexList, ChooseIndexList,
ChooseIndexFooter, ChooseIndexFooter
SettingItem,
}, },
data() { data() {
return { return {
@@ -94,18 +96,23 @@
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(["storeCurrentUserID","storeFriendList","storeConversationList",'storeCurrentConversation']),
"storeFriendList",
"storeCurrentConversation",
"storeCurrentUserID",
"storeConversationList",
]),
getChooseData() { 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) { if (this.keyword) {
return { return {
indexList: ["#"], indexList: ["#"],
dataList: [ dataList: [
this.storeFriendList.filter( list.filter(
(friend) => (friend) =>
friend.nickname.includes(this.keyword) || friend.nickname.includes(this.keyword) ||
friend.remark.includes(this.keyword) friend.remark.includes(this.keyword)
@@ -113,12 +120,20 @@
], ],
}; };
} }
return formatChooseData(this.storeFriendList); return formatChooseData(list);
}, },
conversationList(){ conversationList(){
const _this = this; const _this = this;
let list = [...this.storeConversationList]; 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){ if(this.keyword){
list = list.filter((item)=>{ list = list.filter((item)=>{
return item.showName.indexOf(_this.kw)>-1 || item.userID.indexOf(_this.kw)>-1 || item.groupID.indexOf(_this.kw)>-1 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) { onLoad(options) {
const {groupID,type,checkedUserIDList,muitple} = options; const {groupID,type,checkedUserIDList,muitple,allowType} = options;
this.type = type; this.type = type;
if(allowType){
this.allowGroup = allowType === 'All';
}
this.groupID = groupID; this.groupID = groupID;
if(muitple){ if(muitple){
this.muitple = muitple; this.muitple = muitple;
} }
//this.muitple = true;
this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : []; 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) { if (this.type === ContactChooseTypes.Invite) {
this.allowGroup = false; this.allowGroup = false;
this.checkDisabledUser(); this.checkDisabledUser();
@@ -299,7 +312,7 @@
} }
.contact_choose_container { .contact_choose_container {
height: 100vh; min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -311,7 +324,6 @@
.tab_container { .tab_container {
@include colBox(false); @include colBox(false);
flex: 1; flex: 1;
overflow: hidden;
.setting_item { .setting_item {
padding: 32rpx 36rpx; padding: 32rpx 36rpx;
@@ -1,10 +1,14 @@
<template> <template>
<view class="contact_choose_container"> <view class="contact_choose_container">
<custom-nav-bar title="群成员"> <uni-nav-bar
<view slot="more" style="margin-right: 10rpx;"> left-icon="back"
<u-button type="primary" @click="confirm" :disabled="!isConfirmEnable">确定</u-button> @clickLeft="uni.$u.route({type:'back'})"
</view> statusBar
</custom-nav-bar> 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"> <view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" /> <u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
@@ -25,16 +29,13 @@
</template> </template>
<script> <script>
import {mapGetters} from "vuex";
import {formatChooseData,toastWithCallback} from "@/util/common"; import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill"
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import UserItem from "@/components/UserItem/index.vue"; import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue"; import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
export default { export default {
components: { components: {
CustomNavBar,
UserItem, UserItem,
ChooseIndexList ChooseIndexList
}, },
+54 -20
View File
@@ -1,6 +1,11 @@
<template> <template>
<view class="contact_choose_container"> <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"> <view class="search_bar_wrap">
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" /> <u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
@@ -8,14 +13,17 @@
<view class="tab_container"> <view class="tab_container">
<template v-if="activeTab === 0"> <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"> <view class="tab_pane">
<user-item <user-item
@updateCheck="updateCheckedUser" @updateCheck="updateCheckedUser"
:checked="checkedUserIDList.includes(cell.userID)" :checked="checkedUserIDList.includes(cell.userID)"
:disabled="disabledUserIDList.includes(cell.userID)" :disabled="disabledUserIDList.includes(cell.userID)"
:checkVisible="true" :checkVisible="true"
v-for="cell in storeConversationList" :item="cell" :key="cell.userID" /> v-for="cell in conversationList" :item="cell" :key="cell.userID" />
</view> </view>
</template> </template>
@@ -33,23 +41,19 @@
</template> </template>
<script> <script>
import {mapGetters} from "vuex"; import { mapGetters } from "vuex";
import {ContactChooseTypes} from "@/constant"; import {ContactChooseTypes} from "@/constant";
import {formatChooseData,toastWithCallback} from "@/util/common"; import {formatChooseData,toastWithCallback} from "@/util/common";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill"
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import UserItem from "@/components/UserItem/index.vue"; import UserItem from "@/components/UserItem/index.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue"; import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue"; import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
import SettingItem from "@/components/SettingItem/index.vue";
export default { export default {
components: { components: {
CustomNavBar,
UserItem, UserItem,
ChooseIndexList, ChooseIndexList,
ChooseIndexFooter, ChooseIndexFooter
SettingItem,
}, },
data() { data() {
return { return {
@@ -70,18 +74,42 @@
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(["storeFriendList","storeConversationList",'storeCurrentConversation',"storeCurrentUserID"]),
"storeFriendList",
"storeCurrentConversation", conversationList(){
"storeCurrentUserID", const _this = this;
"storeConversationList", 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() { 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) { if (this.keyword) {
return { return {
indexList: ["#"], indexList: ["#"],
dataList: [ dataList: [
this.storeFriendList.filter( list.filter(
(friend) => (friend) =>
friend.nickname.includes(this.keyword) || friend.nickname.includes(this.keyword) ||
friend.remark.includes(this.keyword) friend.remark.includes(this.keyword)
@@ -89,7 +117,7 @@
], ],
}; };
} }
return formatChooseData(this.storeFriendList); return formatChooseData(list);
}, },
getCheckedInfo() { getCheckedInfo() {
const tmpUserIDList = [...this.checkedUserIDList]; const tmpUserIDList = [...this.checkedUserIDList];
@@ -106,10 +134,16 @@
}, },
}, },
onLoad(options) { onLoad(options) {
const {groupID,type,checkedUserIDList,limit} = options; //cardInfo
//console.log(this.storeFriendList); const {groupID,type,checkedUserIDList,muitple,allowType,limit} = options;
this.type = type; this.type = type;
if(allowType){
this.allowGroup = allowType === 'All';
}
this.groupID = groupID; this.groupID = groupID;
if(muitple){
this.muitple = muitple;
}
this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : []; this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : [];
if (this.type === ContactChooseTypes.Invite) { if (this.type === ContactChooseTypes.Invite) {
this.checkDisabledUser(); this.checkDisabledUser();
+1 -1
View File
@@ -84,7 +84,7 @@ export default {
(member) => member.userID, (member) => member.userID,
); );
uni.navigateTo({ 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() { complateCreate() {
+3 -3
View File
@@ -130,7 +130,7 @@
info = { info = {
...friendInfo ...friendInfo
}; };
console.log(info); //console.log(info);
} else { } else {
const { const {
data data
@@ -142,7 +142,7 @@
info = { info = {
...(data[0] ?? {}) ...(data[0] ?? {})
}; };
console.log(info); //console.log(info);
} }
this.isLoading = true this.isLoading = true
try { try {
@@ -157,7 +157,7 @@
info = {}; info = {};
} }
this.isLoading = false this.isLoading = false
console.log(info); //console.log(info);
this.sourceUserInfo = { this.sourceUserInfo = {
...info, ...info,
}; };
+6 -1
View File
@@ -75,7 +75,12 @@
}, },
confirmRemove() { confirmRemove() {
IMSDK.asyncApi(IMSDK.IMMethods.DeleteFriend,IMSDK.uuid(),this.sourceInfo.userID,) IMSDK.asyncApi(IMSDK.IMMethods.DeleteFriend,IMSDK.uuid(),this.sourceInfo.userID,)
.then(() => this.showToast("操作成功")) .then(() => {
this.showToast("操作成功");
uni.navigateBack({
delta: 2,
})
})
.catch(() => this.showToast("操作失败")) .catch(() => this.showToast("操作失败"))
.finally(() => (this.showConfirm = false)); .finally(() => (this.showConfirm = false));
}, },
@@ -180,9 +180,9 @@
this.$refs.customEditor.clear(); this.$refs.customEditor.clear();
} }
let method = IMMethods.SendMessage; let method = IMMethods.SendMessage;
if([MessageType.PictureMessage,MessageType.VoiceMessage,MessageType.VideoMessage,MessageType.FileMessage].includes(message.contentType)){ // if([MessageType.PictureMessage,MessageType.VoiceMessage,MessageType.VideoMessage,MessageType.FileMessage].includes(message.contentType)){
method = IMMethods.SendMessageNotOss; // method = IMMethods.SendMessageNotOss;
} // }
this.$emit("scrollToBottom"); this.$emit("scrollToBottom");
IMSDK.asyncApi(method, IMSDK.uuid(), { IMSDK.asyncApi(method, IMSDK.uuid(), {
recvID: user_id, recvID: user_id,
@@ -271,16 +271,8 @@
}, },
async sendVoiceMessage(audio){ async sendVoiceMessage(audio){
const _this = this; const _this = this;
const message = await IMSDK.asyncApi( const message = await IM.createVoiceMessage(audio.tempFilePath,audio.contentDuration);
IMMethods.CreateSoundMessageFromFullPath,
IMSDK.uuid(),
{
soundPath:getPurePath(audio.tempFilePath),
duration:audio.contentDuration
}
);
_this.sendMessage(message,_this.storeCurrentConversation.userID,_this.storeCurrentConversation.groupID); _this.sendMessage(message,_this.storeCurrentConversation.userID,_this.storeCurrentConversation.groupID);
}, },
// from comp // from comp
sendMediaMesage(paths) { sendMediaMesage(paths) {
@@ -290,8 +282,10 @@
try { try {
let message = null; let message = null;
if(item.search('.mp4')>0){ if(item.search('.mp4')>0){
console.log('1');
message = await IM.createVideoMessage(item); message = await IM.createVideoMessage(item);
}else{ }else{
console.log('2');
message = await IM.createImageMessage(item); message = await IM.createImageMessage(item);
} }
console.log(message); console.log(message);
@@ -335,7 +329,7 @@
const _this = this; const _this = this;
if(e.type=="atevent" && this.storeCurrentConversation.groupID){ if(e.type=="atevent" && this.storeCurrentConversation.groupID){
uni.navigateTo({ 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: { events: {
onSelectedConfirm(userList) { onSelectedConfirm(userList) {
userList.forEach((user)=>{ userList.forEach((user)=>{
@@ -398,8 +392,7 @@
//crop:null, //crop:null,
editable:true, editable:true,
filename:"_doc/", filename:"_doc/",
//filter:"none",//image,none,video filter:"none",//image,none,video
filter:"image",
maximum:9, maximum:9,
multiple:true, multiple:true,
permissionAlert:true, permissionAlert:true,
@@ -51,11 +51,6 @@
return 120 * aspectRatio; return 120 * aspectRatio;
} }
}, },
watch: {
src(newVal, oldVal) {
console.log(newVal,oldVal);
}
},
created() { created() {
this.init(); this.init();
}, },
@@ -63,18 +58,38 @@
async init(){ async init(){
const self = this; const self = this;
let url = ""; let url = "";
const pictureElem = this.message.pictureElem;
// 如果有远程 snapshotUrl,则下载到 coverCachePath // 如果有远程 snapshotUrl,则下载到 coverCachePath
//const snapshotUrl = (this.message.pictureElem.snapshotPicture?.url ?? this.message.pictureElem.sourcePath ); let snapshotUrl = pictureElem?.sourcePath;
const snapshotUrl = this.message.pictureElem.sourcePicture?.url; if(snapshotUrl && await util.fileExsit(snapshotUrl)){
self.src = snapshotUrl;
return ;
}
snapshotUrl = (pictureElem?.sourcePicture.url ?? pictureElem.bigPicture?.url);
if(!snapshotUrl){ if(!snapshotUrl){
console.log(this.message); console.log(this.message);
return; return;
} }
//console.log(snapshotUrl); console.log(snapshotUrl);
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{ util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
self.coverDownloading = false; self.coverDownloading = false;
self.src = fn; 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() { clickMediaItem() {
@@ -162,7 +162,7 @@
}, },
deleteConversation(conversationID){ deleteConversation(conversationID){
IMSDK.asyncApi(IMSDK.IMMethods.DeleteConversationAndDeleteAllMsg, IMSDK.uuid(), conversationID).then(res=>{ this.$store.dispatch('conversation/deleteConversation',conversationID).then(res=>{
console.log('删除成功'); console.log('删除成功');
}).catch(e=>{ }).catch(e=>{
@@ -85,7 +85,7 @@
}, },
inviteMember() { inviteMember() {
uni.navigateTo({ 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() { removeMember() {
+2 -2
View File
@@ -30,15 +30,15 @@
<u-loading-icon></u-loading-icon> <u-loading-icon></u-loading-icon>
</view> </view>
</u-list> </u-list>
<template v-if="showCheck" >
<choose-index-footer <choose-index-footer
v-if="showCheck"
:comfirmLoading="comfirmLoading" :comfirmLoading="comfirmLoading"
@removeItem="updateCheck" @removeItem="updateCheck"
@confirm="confirm" @confirm="confirm"
:choosedData="getChoosedData" :choosedData="getChoosedData"
:isRemove="isRemove" :isRemove="isRemove"
:maxLength="groupMemberLength" /> :maxLength="groupMemberLength" />
</template>
<u-modal <u-modal
:show="showConfirmModal" :show="showConfirmModal"
@@ -76,7 +76,7 @@
}, },
inviteMember() { inviteMember() {
uni.navigateTo({ 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() { kickMember() {
+1 -1
View File
@@ -245,7 +245,7 @@
showTypeSheet() { showTypeSheet() {
const _this = this; const _this = this;
uni.showActionSheet({ uni.showActionSheet({
itemList:['文字','照片'/*,'视频'*/], itemList:['文字','照片','视频'],
success: function (res) { success: function (res) {
//toChooseRelease //toChooseRelease
if([1,2].includes(res.tapIndex)){ if([1,2].includes(res.tapIndex)){
+2 -2
View File
@@ -22,9 +22,9 @@
<u-gap :height="10"></u-gap> <u-gap :height="10"></u-gap>
<uni-list> <uni-list>
<uni-list-item title="扫一扫" thumb="/static/images/find/03.png" :thumbSize="thumbSize" @click="scan" clickable showArrow></uni-list-item> <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/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="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-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> </uni-list>
+1 -1
View File
@@ -85,7 +85,7 @@
let system = uni.getSystemInfoSync(); let system = uni.getSystemInfoSync();
const _this = this; const _this = this;
plus.runtime.getProperty(plus.runtime.appid,(inf) => { plus.runtime.getProperty(plus.runtime.appid,(inf) => {
console.log(inf); //console.log(inf);
_this.appversion = inf.version _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: { methods: {
...util, ...util,
copy() { copy() {
+1 -1
View File
@@ -31,7 +31,7 @@ const actions = {
}, },
async getFriendCircleInfo({ commit, state}) { async getFriendCircleInfo({ commit, state}) {
uni.$u.http.get('/friendcircle/info').then(data=>{ uni.$u.http.get('/friendcircle/info').then(data=>{
console.log("获取朋友圈信息",data); //console.log("获取朋友圈信息",data);
commit("SET_UNREAD_COUNT", data.unread_count); commit("SET_UNREAD_COUNT", data.unread_count);
commit("SET_TOP_UNREAD_ITEMS", data.top_unread_items); commit("SET_TOP_UNREAD_ITEMS", data.top_unread_items);
commit("SET_SETTINGS", data.settings); commit("SET_SETTINGS", data.settings);
+8 -5
View File
@@ -1,8 +1,6 @@
import { import {v4 as uuidv4} from "uuid";
v4 as uuidv4
} from "uuid";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill";
import conversation from "./conversation";
const state = { const state = {
friendList: [], friendList: [],
blackList: [], blackList: [],
@@ -160,7 +158,7 @@ const actions = {
commit("SET_FRIEND_LIST", [...tmpList, friendInfo]); commit("SET_FRIEND_LIST", [...tmpList, friendInfo]);
} }
}, },
updateFriendInfo({commit,state}, { friendInfo,isRemove = false}) { updateFriendInfo({commit,state,dispatch }, { friendInfo,isRemove = false}) {
const tmpList = [...state.friendList]; const tmpList = [...state.friendList];
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID); const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
@@ -174,6 +172,11 @@ const actions = {
} }
commit("SET_FRIEND_LIST", tmpList); 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) { pushNewBlack({ commit, state}, blackInfo) {
const tmpList = [...state.blackList]; const tmpList = [...state.blackList];
+15 -3
View File
@@ -103,13 +103,25 @@ const actions = {
commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo); commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo);
} }
}, },
resetConversationState({ resetConversationState({commit}) {
commit
}) {
commit("SET_CURRENT_MEMBER_IN_GROUP", {}); commit("SET_CURRENT_MEMBER_IN_GROUP", {});
commit("SET_CURRENT_GROUP", {}); commit("SET_CURRENT_GROUP", {});
commit("SET_CURRENT_CONVERSATION", {}); 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 { export default {
+1 -1
View File
@@ -81,7 +81,7 @@ const actions = {
resetMessageState({commit}) { resetMessageState({commit}) {
commit("SET_HISTORY_MESSAGE_LIST", []); commit("SET_HISTORY_MESSAGE_LIST", []);
commit("SET_HAS_MORE_MESSAGE", true); commit("SET_HAS_MORE_MESSAGE", true);
}, }
}; };
export default { export default {
+2 -2
View File
@@ -38,7 +38,7 @@ const mutations = {
}; };
const actions = { const actions = {
async getSelfInfo({ commit }) { async getSelfInfo({commit}) {
//#ifndef APP //#ifndef APP
return []; return [];
//#endif //#endif
@@ -57,7 +57,7 @@ const actions = {
uni.$u.toast("获取个人信息失败"); uni.$u.toast("获取个人信息失败");
} }
}, },
async updateBusinessInfo({ commit, state }) { async updateBusinessInfo({commit,state}) {
try { try {
const res = await businessGetUserInfo(state.selfInfo.userID); const res = await businessGetUserInfo(state.selfInfo.userID);
const businessData = res.data[0] ?? {}; const businessData = res.data[0] ?? {};
+40 -18
View File
@@ -7,12 +7,16 @@ import {getVideoInfo} from "@/util/common";
import {downloadFile} from "@/uni_modules/network-manage"; import {downloadFile} from "@/uni_modules/network-manage";
// #endif // #endif
export const imapi = (method,data)=>{ export const imapi = (method,data)=>{
console.log(method);
console.log(data);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
IMSDK.asyncApi(method,IMSDK.uuid(),data) IMSDK.asyncApi(method,IMSDK.uuid(),data)
.then(res=>{ .then(res=>{
console.log(res);
return resolve(res); return resolve(res);
}) })
.catch(e=>{ .catch(e=>{
console.log(e);
return reject(e); return reject(e);
}) })
}); });
@@ -64,7 +68,14 @@ export const getPurePath = (path)=>{
} }
return 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)=>{ export const createFileMessage = async (path)=>{
}; };
@@ -83,11 +94,26 @@ export const getVideoCover = async (path)=>{
}; };
export const createVideoMessage = (path)=>{ export const createVideoMessage = (path)=>{
return new Promise(async(resolve, reject) => { 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); console.log('处理前的可用路径', path);
//const realVideoPath = await copyFileToTempPath(path); //const realVideoPath = await copyFileToTempPath(path);
const realVideoPath = await getPurePath(path);
//console.log('处理后的可用路径', realVideoPath); //console.log('处理后的可用路径', realVideoPath);
const info = await getVideoInfo(realVideoPath);
console.log('info', info); console.log('info', info);
const cover = await getVideoCover(realVideoPath); const cover = await getVideoCover(realVideoPath);
console.log('cover', cover); console.log('cover', cover);
@@ -140,23 +166,28 @@ export const createVideoMessage = (path)=>{
//const cover = await getVideoCover(path); //const cover = await getVideoCover(path);
//const res1 = await IMSDK.getVideoCover(path); //const res1 = await IMSDK.getVideoCover(path);
//console.log(res1.path); //console.log(res1.path);
const videoParams = { const videoParams1 = {
videoPath: realVideoPath, videoPath: realVideoPath,
videoType: "mp4", videoType: "mp4",
duration: info.duration, duration: info.duration,
snapshotPath: getPurePath(res1.path), snapshotPath: getPurePath(res1.path),
//snapshotPath: getPurePath(cover), //snapshotPath: getPurePath(cover),
}; };
console.log('videoParams', videoParams); console.log('videoParams', videoParams1);
message = await IMSDK.asyncApi( const message1 = await IMSDK.asyncApi(
IMMethods.CreateVideoMessageFromFullPath, IMMethods.CreateVideoMessageFromFullPath,
IMSDK.uuid(), IMSDK.uuid(),
videoParams videoParams
); );
return resolve(message);
}); });
}; };
export const createImageMessage = async (path)=>{ export const createImageMessage = async (path)=>{
return new Promise(async (resolve, reject) => { 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"}); const result = await upload(path,{savePath: "msg"});
if(result.code !=0){ if(result.code !=0){
uni.$u.toast(result.msg); uni.$u.toast(result.msg);
@@ -171,23 +202,14 @@ export const createImageMessage = async (path)=>{
url: result.data[0].file_url 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, sourcePicture: picBaseInfo,
bigPicture: picBaseInfo, bigPicture: picBaseInfo,
snapshotPicture: picBaseInfo, snapshotPicture: picBaseInfo,
sourcePath: result.data[0].file_url sourcePath: result.data[0].file_url
}); });
console.log('message', message); console.log('message', message1);
return resolve(message); return resolve(message1);
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);
})
}); });
} }
export const sendMessage = (message, user_id, group_id) => { export const sendMessage = (message, user_id, group_id) => {