This commit is contained in:
cansnow
2026-01-15 22:50:35 +08:00
parent dd16348558
commit db99bebcb4
26 changed files with 433 additions and 284 deletions
+34 -6
View File
@@ -1,20 +1,29 @@
<script> <script>
import {mapGetters,mapActions} from "vuex"; import {mapGetters,mapActions} from "vuex";
// #ifdef APP
import IMSDK, {IMMethods,MessageType,SessionType,} from "openim-uniapp-polyfill"; import IMSDK, {IMMethods,MessageType,SessionType,} from "openim-uniapp-polyfill";
// #endif
import config from "@/common/config"; import config from "@/common/config";
import {getDbDir,toastWithCallback} from "@/util/common.js"; import {getDbDir,toastWithCallback} from "@/util/common.js";
import {getConversationContent,conversationSort,prepareConversationState} from "@/util/imCommon"; import {getConversationContent,conversationSort,prepareConversationState,updateTabbar} from "@/util/imCommon";
import {PageEvents,UpdateMessageTypes} from "@/constant"; import {PageEvents,UpdateMessageTypes} from "@/constant";
import checkUpgrade from "@/util/app_update.js" import checkUpgrade from "@/util/app_update.js"
export default { export default {
onLaunch: function() { onLaunch: function() {
// #ifndef APP this.$store.dispatch("system/getConfig");
// #ifdef APP
plus.screen.lockOrientation("portrait-primary");
// #endif
// #ifdef H5
//screen.orientation.type = "";
screen.orientation.lock('portrait');
// #endif
// #ifndef MP
console.error( console.error(
`暂时不支持运行到 Web或小程序端,如果需要移动端的 Web 项目,参考 [H5 demo](https://github.com/openimsdk/openim-h5-demo)` `暂时不支持运行到小程序端`
); );
return ; return ;
// #endif // #endif
this.$store.dispatch("system/getConfig");
this.init(); this.init();
}, },
onShow: function() { onShow: function() {
@@ -43,8 +52,26 @@
"storeIsSyncing", "storeIsSyncing",
"storeGroupList", "storeGroupList",
"config", "config",
'storeUnHandleFriendApplicationNum',
'storeUnHandleGroupApplicationNum',
'storeUnReadCount',
'storeCircleUnreadCount'
]), ]),
}, },
watch:{
storeUnReadCount(){
updateTabbar(0);
},
storeUnHandleFriendApplicationNum(){
updateTabbar(1);
},
storeUnHandleGroupApplicationNum(){
updateTabbar(1);
},
storeCircleUnreadCount(){
updateTabbar(2);
}
},
methods: { methods: {
...mapActions("message", ["pushNewMessage", "updateOneMessage"]), ...mapActions("message", ["pushNewMessage", "updateOneMessage"]),
...mapActions("conversation", ["updateCurrentMemberInGroup"]), ...mapActions("conversation", ["updateCurrentMemberInGroup"]),
@@ -74,7 +101,7 @@
// #endif // #endif
}else{ }else{
plus.navigator.closeSplashscreen(); plus.navigator.closeSplashscreen();
uni.$u.route("/pages/common/login/index"); //uni.$u.route("/pages/common/login/index");
} }
}, },
setGlobalIMlistener() { setGlobalIMlistener() {
@@ -231,6 +258,7 @@
} }
}; };
const friendApplicationAccessHandler = ({data}) => { const friendApplicationAccessHandler = ({data}) => {
console.log(data);
const isRecv = data.toUserID === this.storeCurrentUserID; const isRecv = data.toUserID === this.storeCurrentUserID;
if (isRecv) { if (isRecv) {
this.updateRecvFriendApplition({ this.updateRecvFriendApplition({
@@ -509,7 +537,6 @@
url: "/pages/conversation/conversationList/index?isRedirect=true", url: "/pages/conversation/conversationList/index?isRedirect=true",
complete() { complete() {
_this.keppAlive(); _this.keppAlive();
plus.navigator.closeSplashscreen();
_this.checkUpdate(); _this.checkUpdate();
}, },
fail(e){ fail(e){
@@ -573,6 +600,7 @@
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/static/imfont/iconfont.css";
/*每个页面公共css */ /*每个页面公共css */
text,view{ text,view{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
+3 -2
View File
@@ -2,14 +2,15 @@
"name" : "瞬聊", "name" : "瞬聊",
"appid" : "__UNI__E41111F", "appid" : "__UNI__E41111F",
"description" : "一款即时聊天软件", "description" : "一款即时聊天软件",
"versionName" : "3.3.9", "versionName" : "3.4.2",
"versionCode" : 339, "versionCode" : 342,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"bounce" : "none", "bounce" : "none",
"usingComponents" : true, "usingComponents" : true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3, "compilerVersion" : 3,
"orientation" : [ "portrait-primary" ],
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender" : true,
"waiting" : true, "waiting" : true,
+4
View File
@@ -9,5 +9,9 @@
"md5": "^2.3.0", "md5": "^2.3.0",
"openim-uniapp-polyfill": "^1.4.4", "openim-uniapp-polyfill": "^1.4.4",
"uuid": "^9.0.0" "uuid": "^9.0.0"
},
"devDependencies": {
"worker-loader": "^3.0.8",
"worker-plugin": "^5.0.1"
} }
} }
+1
View File
@@ -348,6 +348,7 @@
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
overflow-y: scroll;
.member_list { .member_list {
flex: 1; flex: 1;
+1 -1
View File
@@ -146,7 +146,7 @@ export default {
this.loginInfo.email = "commiu@outlook.com"; this.loginInfo.email = "commiu@outlook.com";
this.loginInfo.password = "qwe123"; this.loginInfo.password = "qwe123";
} }
plus.navigator.closeSplashscreen(); //plus.navigator.closeSplashscreen();
}, },
updateEye() { updateEye() {
this.eying = !this.eying; this.eying = !this.eying;
+4 -2
View File
@@ -108,7 +108,6 @@
const info = util.aesdecode(sourceInfo); const info = util.aesdecode(sourceInfo);
this.sourceID = info.userID; this.sourceID = info.userID;
} }
//console.log(this.storeSelfInfo);
this.getSourceUserInfo(); this.getSourceUserInfo();
}, },
methods: { methods: {
@@ -131,6 +130,7 @@
info = { info = {
...friendInfo ...friendInfo
}; };
console.log(info);
} else { } else {
const { const {
data data
@@ -142,10 +142,11 @@
info = { info = {
...(data[0] ?? {}) ...(data[0] ?? {})
}; };
console.log(info);
} }
this.isLoading = true this.isLoading = true
try { try {
const res = await businessSearchUserInfo(this.sourceID); const res = await businessSearchUserInfo(this.sourceID);console.log(res);
if (res.total > 0) { if (res.total > 0) {
info = { info = {
...info, ...info,
@@ -156,6 +157,7 @@
info = {}; info = {};
} }
this.isLoading = false this.isLoading = false
console.log(info);
this.sourceUserInfo = { this.sourceUserInfo = {
...info, ...info,
}; };
+46 -34
View File
@@ -1,30 +1,16 @@
<template> <template>
<view class="application_list_container"> <view class="application_list_container">
<custom-nav-bar :title="isGroupApplication ? '新的群聊' : '新的好友'" /> <custom-nav-bar :title="isGroupApplication ? '新的群聊' : '新的好友'" />
<view <view class="pane_row" :style="{ transform: `translateX(${isRecv ? '0' : '-100%'})` }">
class="pane_row"
:style="{ transform: `translateX(${isRecv ? '0' : '-100%'})` }"
>
<view class="pane_content"> <view class="pane_content">
<u-list v-if="getRecvRenderData.length > 0" class="application_list"> <u-list v-if="getRecvRenderData.length > 0" class="application_list">
<u-list-item <u-list-item v-for="(application,index) in getRecvRenderData" :key="index">
v-for="application in getRecvRenderData"
:key="
application[!isGroupApplication ? 'fromUserID' : 'userID'] +
application.groupID
"
>
<application-item :isRecv="true" :application="application" /> <application-item :isRecv="true" :application="application" />
</u-list-item> </u-list-item>
</u-list> </u-list>
<u-list <u-list v-else-if="getSendRenderData.length > 0" class="application_list">
v-else-if="getSendRenderData.length > 0" <u-list-item v-for="(application,index1) in getSendRenderData"
class="application_list" :key="index1">
>
<u-list-item
v-for="application in getSendRenderData"
:key="application[!isGroupApplication ? 'toUserID' : 'groupID']"
>
<application-item :application="application" /> <application-item :application="application" />
</u-list-item> </u-list-item>
</u-list> </u-list>
@@ -38,8 +24,12 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import {
import { ContactMenuTypes } from "@/constant"; mapGetters
} from "vuex";
import {
ContactMenuTypes
} from "@/constant";
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import ApplicationItem from "./ApplicationItem.vue"; import ApplicationItem from "./ApplicationItem.vue";
export default { export default {
@@ -62,22 +52,21 @@ export default {
"storeSentGroupApplications", "storeSentGroupApplications",
]), ]),
getRecvRenderData() { getRecvRenderData() {
const tmpList = this.isGroupApplication const tmpList = this.isGroupApplication ?
? this.storeRecvGroupApplications this.storeRecvGroupApplications :
: this.storeRecvFriendApplications; this.storeRecvFriendApplications;
tmpList.sort((a, b) => (a.handleResult === 0 ? -1 : 1)); tmpList.sort((a, b) => (a.handleResult === 0 ? -1 : 1));
return tmpList.slice(0, 4); return tmpList.slice(0, 4);
}, },
getSendRenderData() { getSendRenderData() {
const tmpList = this.isGroupApplication const tmpList = this.isGroupApplication ?
? this.storeSentGroupApplications this.storeSentGroupApplications :
: this.storeSentFriendApplications; this.storeSentFriendApplications;
tmpList.sort((a, b) => (a.handleResult === 0 ? -1 : 1)); tmpList.sort((a, b) => (a.handleResult === 0 ? -1 : 1));
return tmpList.slice(0, 4); return tmpList.slice(0, 4);
}, },
tabList() { tabList() {
return [ return [{
{
name: this.isGroupApplication ? "入群申请" : "好友请求", name: this.isGroupApplication ? "入群申请" : "好友请求",
}, },
{ {
@@ -86,12 +75,32 @@ export default {
]; ];
}, },
}, },
// watch:{
// getRecvRenderData:{
// handler(v){
// console.log(v)
// },
// immediate: true, // 立即执行一次
// deep: true // 开启深度监听
// },
// getSendRenderData:{
// handler(v){
// console.log(v)
// },
// immediate: true, // 立即执行一次
// deep: true // 开启深度监听
// }
// },
onLoad(params) { onLoad(params) {
const { applicationType } = params; const {
applicationType
} = params;
this.isGroupApplication = applicationType === ContactMenuTypes.NewGroup; this.isGroupApplication = applicationType === ContactMenuTypes.NewGroup;
}, },
methods: { methods: {
clickTab({ index }) { clickTab({
index
}) {
this.isRecv = index === 0; this.isRecv = index === 0;
}, },
previewAll() { previewAll() {
@@ -118,11 +127,13 @@ export default {
margin-top: 26rpx; margin-top: 26rpx;
color: #8e9ab0; color: #8e9ab0;
} }
image { image {
width: 237rpx; width: 237rpx;
height: 244rpx; height: 244rpx;
} }
} }
.application_list_container { .application_list_container {
@include colBox(false); @include colBox(false);
height: 100vh; height: 100vh;
@@ -141,15 +152,16 @@ export default {
.pane_row { .pane_row {
display: flex; display: flex;
flex: 1; //flex: 1;
transition: all 0.3s ease 0s !important; transition: all 0.3s ease 0s !important;
background-color: #fff; background-color: #fff;
margin-top: 20rpx; margin-top: 20rpx;
.pane_content { .pane_content {
@include colBox(false); @include colBox(false);
height: 100%; width: 100%;
flex: 0 0 100%; //height: 100%;
//flex: 0 0 100%;
.pane_title { .pane_title {
font-size: 28rpx; font-size: 28rpx;
+25 -7
View File
@@ -14,9 +14,26 @@
<SearchbarPlace @click="toSearch">搜索</SearchbarPlace> <SearchbarPlace @click="toSearch">搜索</SearchbarPlace>
</view> </view>
<uni-list class="contact_menus"> <uni-list class="contact_menus">
<uni-list-item title="新的好友" :showBadge="storeUnHandleFriendApplicationNum>0" :badgeText="storeUnHandleFriendApplicationNum+''" badgeType="error" thumbSize="lg" to="/pages/contact/applicationList/index?applicationType=NewFriend" thumb="/static/images/contact_new_friend.png"></uni-list-item> <uni-list-item title="新的好友"
<!-- <uni-list-item title="新的群组" thumbSize="lg" to="/pages/contact/applicationList/index?applicationType=NewGroup" thumb="/static/images/contact_new_group.png"></uni-list-item> --> :showBadge="storeUnHandleFriendApplicationNum>0"
<uni-list-item title="群聊" thumbSize="lg" to="/pages/contact/groupList/index" thumb="/static/images/contact_my_group.png"></uni-list-item> :badgeText="storeUnHandleFriendApplicationNum+''"
badgeType="error"
thumbSize="lg"
to="/pages/contact/applicationList/index?applicationType=NewFriend"
thumb="/static/images/contact_new_friend.png"></uni-list-item>
<uni-list-item
title="新的群组"
:showBadge="storeUnHandleGroupApplicationNum>0"
:badgeText="storeUnHandleGroupApplicationNum+''"
badgeType="error"
thumbSize="lg"
to="/pages/contact/applicationList/index?applicationType=NewGroup"
thumb="/static/images/contact_new_group.png"></uni-list-item>
<uni-list-item
title="群聊"
thumbSize="lg"
to="/pages/contact/groupList/index"
thumb="/static/images/contact_my_group.png"></uni-list-item>
</uni-list> </uni-list>
<choose-index-list v-if="getIndexData.dataList.length > 0" @itemClick="userClick" :height="`${listHeight}px`" <choose-index-list v-if="getIndexData.dataList.length > 0" @itemClick="userClick" :height="`${listHeight}px`"
@@ -46,7 +63,11 @@
}; };
}, },
computed: { computed: {
...mapGetters(["storeFriendList",'storeUnHandleFriendApplicationNum']), ...mapGetters([
"storeFriendList",
'storeUnHandleFriendApplicationNum',
'storeUnHandleGroupApplicationNum'
]),
getIndexData() { getIndexData() {
return formatChooseData(this.storeFriendList); return formatChooseData(this.storeFriendList);
}, },
@@ -54,9 +75,6 @@
mounted() { mounted() {
this.getListHeight(); this.getListHeight();
}, },
async onShow() {
//await this.getFriendList();
},
methods: { methods: {
...mapActions('contact',['getFriendList']), ...mapActions('contact',['getFriendList']),
toSearch(){ toSearch(){
@@ -5,6 +5,11 @@
<view class="mute_tip" v-else>您被禁言至{{date(storeCurrentMemberInGroup.muteEndTime)}}</view> <view class="mute_tip" v-else>您被禁言至{{date(storeCurrentMemberInGroup.muteEndTime)}}</view>
</view> </view>
</view> </view>
<view v-else-if="!isSingle && !storeCurrentMemberInGroup.userID">
<view class="forbidden_footer">
<view class="mute_tip">您不是群成员</view>
</view>
</view>
<view v-else> <view v-else>
<view class="chat_footer"> <view class="chat_footer">
<!-- 语音信息 --> <!-- 语音信息 -->
@@ -57,7 +62,7 @@
import {getPurePath,html2Text,getVideoCover,getVideoInfo} from "@/util/common"; import {getPurePath,html2Text,getVideoCover,getVideoInfo} from "@/util/common";
import {offlinePushInfo,date} from "@/util/imCommon"; import {offlinePushInfo,date} from "@/util/imCommon";
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant"; import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill"; import IMSDK, {IMMethods,MessageStatus,MessageType,SessionType} from "openim-uniapp-polyfill";
import CustomEditor from "./CustomEditor"; import CustomEditor from "./CustomEditor";
import SimpleEditor from "./SimpleEditor"; import SimpleEditor from "./SimpleEditor";
import ChatingActionBar from "./ChatingActionBar"; import ChatingActionBar from "./ChatingActionBar";
@@ -111,6 +116,11 @@
"storeCurrentUserID", "storeCurrentUserID",
"storeCurrentMemberInGroup" "storeCurrentMemberInGroup"
]), ]),
isSingle() {
return (
this.storeCurrentConversation.conversationType === SessionType.Single
);
},
hasContent() { hasContent() {
return html2Text(this.inputHtml) !== ""; return html2Text(this.inputHtml) !== "";
}, },
@@ -118,6 +128,9 @@
return this.storeCurrentMemberInGroup && this.storeCurrentMemberInGroup?.roleLevel>20; return this.storeCurrentMemberInGroup && this.storeCurrentMemberInGroup?.roleLevel>20;
}, },
isMute(){ isMute(){
if(this.isSingle){
return false;
}
if(this.storeCurrentGroup && this.storeCurrentGroup.status === 3 && !this.isAdminOrOwner){ if(this.storeCurrentGroup && this.storeCurrentGroup.status === 3 && !this.isAdminOrOwner){
return true; return true;
} }
@@ -193,12 +193,7 @@
}, },
methods: { methods: {
viewDetail(){ viewDetail(){
if(this.isSender){ this.$emit('userEvent',{type:"avatarClick"},this.source);
}else{
uni.navigateTo({
url:"/pages/common/userCard/index?sourceID="+this.source.sendID
})
}
}, },
toAnnouncement(){ toAnnouncement(){
uni.navigateTo({ uni.navigateTo({
+20 -1
View File
@@ -26,7 +26,7 @@
import SelectHeader from "./components/SelectHeader"; import SelectHeader from "./components/SelectHeader";
import SelectFooter from "./components/SelectFooter"; import SelectFooter from "./components/SelectFooter";
import {markConversationAsRead} from "@/util/imCommon"; import {markConversationAsRead} from "@/util/imCommon";
import IMSDK, {MessageType,GroupMemberRole} from "openim-uniapp-polyfill"; import IMSDK, {MessageType,GroupMemberRole,SessionType} from "openim-uniapp-polyfill";
import util from "@/util/index.js" import util from "@/util/index.js"
export default { export default {
components: { components: {
@@ -59,6 +59,11 @@
"storeCurrentGroup", "storeCurrentGroup",
"storeCurrentMemberInGroup" "storeCurrentMemberInGroup"
]), ]),
isSingle() {
return (
this.storeCurrentConversation.conversationType === SessionType.Single
);
},
isOwner() { isOwner() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner; return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
}, },
@@ -398,6 +403,20 @@
}) })
return; return;
} }
if (e.type == 'avatarClick'){
if(data.sendID == this.storeCurrentUserID){
return ;
}
if(!_this.isSingle){
if(this.storeCurrentMemberInGroup.roleLevel < 60 && this.storeCurrentGroup.lookMemberInfo!=0){
return ;
}
}
uni.navigateTo({
url:"/pages/common/userCard/index?sourceID="+data.sendID
})
return ;
}
} }
}, },
onBackPress() { onBackPress() {
@@ -16,6 +16,7 @@
</view> </view>
<view class="lastest_msg_wrap"> <view class="lastest_msg_wrap">
<text class="lastest_msg_content">{{ latestMessage }}</text> <text class="lastest_msg_content">{{ latestMessage }}</text>
<uni-icons v-if="source.recvMsgOpt===2" custom-prefix="imfont" type="im-bell-off" size="16" color="#ddd"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
@@ -47,6 +48,7 @@
parsedMessage = JSON.parse(this.source.latestMsg); parsedMessage = JSON.parse(this.source.latestMsg);
} catch (e) {} } catch (e) {}
if (!parsedMessage) return ""; if (!parsedMessage) return "";
//console.log(parsedMessage);
return getConversationContent(parsedMessage); return getConversationContent(parsedMessage);
}, },
latestMessageTime() { latestMessageTime() {
@@ -64,7 +66,7 @@
}, },
methods: { methods: {
clickConversationItem() { clickConversationItem() {
console.log(this.source); //console.log(this.source);
prepareConversationState(this.source); prepareConversationState(this.source);
}, },
longtapConversationItem() { longtapConversationItem() {
@@ -148,6 +150,7 @@
.lastest_msg_wrap { .lastest_msg_wrap {
display: flex; display: flex;
align-items: center;
font-size: 24rpx; font-size: 24rpx;
margin: 10rpx 0; margin: 10rpx 0;
color: #666; color: #666;
+29 -18
View File
@@ -2,13 +2,15 @@
<view class="conversation_container"> <view class="conversation_container">
<chat-header ref="chatHeaderRef" /> <chat-header ref="chatHeaderRef" />
<uni-swipe-action ref="swipe_action"> <uni-swipe-action ref="swipe_action">
<template v-for="item in storeConversationList" >
<uni-swipe-action-item <uni-swipe-action-item
v-if="item.sendID !='system1'"
:right-options="swipe_actions" :right-options="swipe_actions"
@click="actionClick($event,item)" @click="actionClick($event,item)"
v-for="item in storeConversationList"
:key="item.conversationID" > :key="item.conversationID" >
<conversation-item @longtapEvent="showExtendMenu(item)" :source="item"/> <conversation-item @longtapEvent="showExtendMenu(item)" :source="item"/>
</uni-swipe-action-item> </uni-swipe-action-item>
</template>
</uni-swipe-action> </uni-swipe-action>
<view class="loading_wrap" v-if="storeProgress > 0 && storeProgress < 100"> <view class="loading_wrap" v-if="storeProgress > 0 && storeProgress < 100">
<u-loading-icon :vertical="true" :text="storeProgress + '%'"></u-loading-icon> <u-loading-icon :vertical="true" :text="storeProgress + '%'"></u-loading-icon>
@@ -59,7 +61,12 @@
}; };
}, },
computed: { computed: {
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress",'storeCurrentUserID']), ...mapGetters([
"storeConversationList",
"storeIsSyncing",
"storeProgress",
'storeCurrentUserID'
]),
}, },
onReady() { onReady() {
// #ifdef APP // #ifdef APP
@@ -87,33 +94,33 @@
}, },
showExtendMenu(item){ showExtendMenu(item){
const _this = this; const _this = this;
const menu = [item.recvMsgOpt===0 ? '关闭免打扰':'免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除']; const menu = [item.recvMsgOpt===0 ? '免打扰':'关闭免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除'];
uni.showActionSheet({ uni.showActionSheet({
itemList:menu, itemList:menu,
success(e) { success(e) {
switch(menu[e.tapIndex]){ switch(menu[e.tapIndex]){
case '免打扰': case '免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), { _this.setConversation({
conversationID: conversationId, conversationID: item.conversationID,
recvMsgOpt: 2 recvMsgOpt: 2
}) })
break; break;
case '关闭免打扰': case '关闭免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), { _this.setConversation({
conversationID: conversationId, conversationID: item.conversationID,
recvMsgOpt: 0 recvMsgOpt: 0
}) })
break; break;
case '开启阅后即焚': case '开启阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), { _this.setConversation({
conversationID: conversationId, conversationID: item.conversationID,
isPrivateChat: true, isPrivateChat: true,
burnDuration:60 burnDuration:60
}) })
break; break;
case '关闭阅后即焚': case '关闭阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), { _this.setConversation({
conversationID: conversationId, conversationID: item.conversationID,
isPrivateChat: false isPrivateChat: false
}) })
break; break;
@@ -121,10 +128,16 @@
IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID) IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID)
break; break;
case '置顶': case '置顶':
_this.setPinConversation(item.conversationID,true); _this.setConversation({
conversationID: item.conversationID,
isPinned: true
});
break; break;
case '取消置顶': case '取消置顶':
_this.setPinConversation(item.conversationID,false); _this.setConversation({
conversationID: item.conversationID,
isPinned: false
})
break; break;
case '删除': case '删除':
_this.deleteConversation(item.conversationID); _this.deleteConversation(item.conversationID);
@@ -155,11 +168,9 @@
}) })
}, },
setPinConversation(conversationId,status){
IMSDK.asyncApi('setConversation', IMSDK.uuid(), { async setConversation(data){
conversationID: conversationId, await IMSDK.asyncApi('setConversation', IMSDK.uuid(), data);
isPinned: status
})
}, },
onRefresh() { onRefresh() {
+3 -3
View File
@@ -6,8 +6,8 @@
<uni-list-item title="设置管理员" @click="setAdmin" showArrow clickable></uni-list-item> <uni-list-item title="设置管理员" @click="setAdmin" showArrow clickable></uni-list-item>
<uni-list-item title="进群验证" @switchChange="updateGroupInfo('needVerification',storeCurrentGroup.needVerification==1 ? 2: 1)" showSwitch :switchChecked="!(storeCurrentGroup.needVerification != 1)"></uni-list-item> <uni-list-item title="进群验证" @switchChange="updateGroupInfo('needVerification',storeCurrentGroup.needVerification==1 ? 2: 1)" showSwitch :switchChecked="!(storeCurrentGroup.needVerification != 1)"></uni-list-item>
<!-- <uni-list-item title="进群验证" :rightText="verifyTypeText" @click="changeVerify" clickable></uni-list-item> --> <!-- <uni-list-item title="进群验证" :rightText="verifyTypeText" @click="changeVerify" clickable></uni-list-item> -->
<uni-list-item title="允许查看成员资料" @switchChange="updateGroupInfo('lookMemberInfo',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item> <uni-list-item title="允许查看成员资料" @switchChange="updateGroupInfo('lookMemberInfo',storeCurrentGroup.lookMemberInfo == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.lookMemberInfo==0"></uni-list-item>
<uni-list-item title="允许群内添加好友" @switchChange="updateGroupInfo('applyMemberFriend',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item> <!-- <uni-list-item title="允许群内添加好友" @switchChange="updateGroupInfo('applyMemberFriend',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item> -->
<uni-list-item title="全员禁言" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item> <uni-list-item title="全员禁言" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item>
</uni-list> </uni-list>
@@ -42,7 +42,7 @@
}, },
onLoad() { onLoad() {
this.isMute = this.storeCurrentGroup.status == 3; this.isMute = this.storeCurrentGroup.status == 3;
//console.log(this.storeCurrentGroup); console.log(this.storeCurrentGroup);
// IMSDK.asyncApi('getSpecifiedGroupsInfo', IMSDK.uuid(), [this.storeCurrentGroup.groupID]).then(res=>{ // IMSDK.asyncApi('getSpecifiedGroupsInfo', IMSDK.uuid(), [this.storeCurrentGroup.groupID]).then(res=>{
// console.log(res); // console.log(res);
// }).catch(e=>{ // }).catch(e=>{
+20 -9
View File
@@ -53,6 +53,7 @@
<script> <script>
let moreActionArea; let moreActionArea;
import {mapActions,mapGetters} from "vuex";
import {GroupMemberListTypes} from "@/constant"; import {GroupMemberListTypes} from "@/constant";
import IMSDK, {GroupMemberRole} from "openim-uniapp-polyfill"; import IMSDK, {GroupMemberRole} from "openim-uniapp-polyfill";
import UserItem from "@/components/UserItem/index.vue"; import UserItem from "@/components/UserItem/index.vue";
@@ -86,6 +87,11 @@
}; };
}, },
computed: { computed: {
...mapGetters([
'storeCurrentUserID',
'storeCurrentGroup',
"storeCurrentMemberInGroup"
]),
getChoosedData() { getChoosedData() {
const tmpList = [...this.choosedMemberIDList]; const tmpList = [...this.choosedMemberIDList];
return this.groupMemberList.filter( return this.groupMemberList.filter(
@@ -112,13 +118,13 @@
}, },
isOwner() { isOwner() {
return ( return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel === this.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Owner GroupMemberRole.Owner
); );
}, },
isAdmin() { isAdmin() {
return ( return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin
); );
}, },
canCheck() { canCheck() {
@@ -128,17 +134,16 @@
}) => { }) => {
if (this.type === GroupMemberListTypes.Kickout) { if (this.type === GroupMemberListTypes.Kickout) {
return ( return (
(this.isOwner || (this.isOwner || (this.isAdmin && roleLevel !== GroupMemberRole.Owner)) &&
(this.isAdmin && roleLevel !== GroupMemberRole.Owner)) && userID !== this.$store.storeCurrentUserID
userID !== this.$store.getters.storeCurrentUserID
); );
} }
return userID !== this.$store.getters.storeCurrentUserID; return userID !== this.$store.storeCurrentUserID;
}; };
}, },
groupMemberLength() { groupMemberLength() {
return this.$store.getters.storeCurrentGroup?.memberCount ?? 0; return this.storeCurrentGroup?.memberCount ?? 0;
}, },
}, },
@@ -284,10 +289,16 @@
}, },
userClick(member) { userClick(member) {
if (this.type === GroupMemberListTypes.Transfer) { if (this.type === GroupMemberListTypes.Transfer) {
if (member.userID === this.$store.getters.storeCurrentUserID) return; if (member.userID === this.storeCurrentUserID) return;
this.choosedTransferMember = member; this.choosedTransferMember = member;
this.showConfirmModal = true; this.showConfirmModal = true;
} else { } else {
if(member.userID == this.storeCurrentUserID){
return ;
}
if(this.storeCurrentMemberInGroup.roleLevel < 60 && this.storeCurrentGroup.lookMemberInfo!=0){
return ;
}
const s = util.aesencode(member); const s = util.aesencode(member);
uni.$u.route("/pages/common/userCard/index", { uni.$u.route("/pages/common/userCard/index", {
sourceID: member.userID, sourceID: member.userID,
@@ -334,7 +345,7 @@
if(!this.isOwner&&!this.isAdmin){ if(!this.isOwner&&!this.isAdmin){
return ; return ;
} }
if(this.$store.getters.storeCurrentMemberInGroup.roleLevel <= member.roleLevel ){ if(this.storeCurrentMemberInGroup.roleLevel <= member.roleLevel ){
return ; return ;
} }
let itemList = []; let itemList = [];
+10 -16
View File
@@ -76,15 +76,13 @@
<videoPlayer :previewVideoFlag="previewVideoFlag" :previewVideoSrc="previewVideoSrc" @quitPlay="previewVideoFlag=false"></videoPlayer> <videoPlayer :previewVideoFlag="previewVideoFlag" :previewVideoSrc="previewVideoSrc" @quitPlay="previewVideoFlag=false"></videoPlayer>
</view> </view>
<!-- 删除朋友圈确认框 --> <!-- 删除朋友圈确认框 -->
<view v-if="delCircleObj.delCircleModelFlag==true"> <u-modal :show="delCircleObj.delCircleModelFlag"
<u-modal v-model="delCircleObj.delCircleModelFlag" :show-title="false" :showConfirmButton="true" confirmText="删除" confirmColor="#fa3534"
:show-confirm-button="true" confirm-text="删除" confirm-color="#fa3534" :showCancelButton="true" cancelText="取消" cancelColor="#000000"
:show-cancel-button="true" cancel-text="取消" cancel-color="#000000" content="删除该朋友圈?"
content="删除该朋友圈?" :content-style="{color:'#000000',fontSize:'32rpx',fontWeight:'bold'}"
@confirm="confirmDelCircle()" @cancel="cancelDelCircle()"> @confirm="confirmDelCircle()" @cancel="cancelDelCircle()">
</u-modal> </u-modal>
</view> </view>
</view>
</template> </template>
<script> <script>
@@ -130,7 +128,7 @@
//vuex变量 //vuex变量
watch:{ watch:{
storeCircleData:function(val){ storeCircleData:function(val){
console.log("监听到朋友圈内容有变动",val.length); //console.log("监听到朋友圈内容有变动",val.length);
} }
}, },
@@ -303,16 +301,9 @@
let param={ let param={
id:delCircleId id:delCircleId
}; };
deleteCircle(param).then(res => {
if(res.code==200){
that.delCircleObj.delCircleModelFlag=false; that.delCircleObj.delCircleModelFlag=false;
that.delCircleObj.tempDelCircleId=""; this.$store.dispatch('circle/deleteFriendCircleList',param);
that.delCircleObj.tempDelIndex="";
let tempData=that.storeCircleData;
tempData.splice(delIndex,1);
this.$store.commit('circle/SET_LIST',tempData);
}
});
}, },
cancelDelCircle:function(){ cancelDelCircle:function(){
let that=this; let that=this;
@@ -458,6 +449,9 @@
case 'handleComment': case 'handleComment':
this.handleComment(e.comment,e.index); this.handleComment(e.comment,e.index);
break; break;
case 'deleteCircle':
this.deleteCircle(e.item,e.index);
break;
case 'linkToBusinessCard': case 'linkToBusinessCard':
this.linkToBusinessCard(e.userID); this.linkToBusinessCard(e.userID);
break; break;
+1 -1
View File
@@ -10,7 +10,7 @@
<info-item v-if="1==2" @click="goto('/pages/common/article?type=spage&name=cooperation&title=商务合作')" class="check" title="商务合作" /> <info-item v-if="1==2" @click="goto('/pages/common/article?type=spage&name=cooperation&title=商务合作')" class="check" title="商务合作" />
<info-item @click="goto('/pages/common/article?type=spage&name=terms_of_service&title=用户协议')" class="check" title="用户协议" /> <info-item @click="goto('/pages/common/article?type=spage&name=terms_of_service&title=用户协议')" class="check" title="用户协议" />
<info-item @click="goto('/pages/common/article?type=spage&name=privacy_policy&title=隐私政策')" class="check" title="隐私政策" /> <info-item @click="goto('/pages/common/article?type=spage&name=privacy_policy&title=隐私政策')" class="check" title="隐私政策" />
<info-item @click="goto('/pages/common/article?type=spage&name=aboutus&title=关于我们')" class="check" title="关于我们" /> <!-- <info-item @click="goto('/pages/common/article?type=spage&name=aboutus&title=关于我们')" class="check" title="关于我们" /> -->
<info-item @click="clearcache" class="check" title="清除缓存" /> <info-item @click="clearcache" class="check" title="清除缓存" />
<info-item v-if="1==2" @click="show = true" class="check" title="上传调试日志" /> <info-item v-if="1==2" @click="show = true" class="check" title="上传调试日志" />
+25
View File
@@ -0,0 +1,25 @@
@font-face {
font-family: "imfont"; /* Project id 5108944 */
src: url('/static/imfont/iconfont.ttf?t=1768272147036') format('truetype');
}
.imfont {
font-family: "imfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.im-bell_slash:before {
content: "\e7e5";
}
.im-bell-off:before {
content: "\e87f";
}
.im-user-plus:before {
content: "\e9d4";
}
Binary file not shown.
+1
View File
@@ -12,6 +12,7 @@ export default {
storeRecvGroupApplications: (state) => state.contact.recvGroupApplications, storeRecvGroupApplications: (state) => state.contact.recvGroupApplications,
storeSentGroupApplications: (state) => state.contact.sentGroupApplications, storeSentGroupApplications: (state) => state.contact.sentGroupApplications,
storeUnHandleFriendApplicationNum: (state) => state.contact.unHandleFriendApplicationNum, storeUnHandleFriendApplicationNum: (state) => state.contact.unHandleFriendApplicationNum,
storeUnHandleGroupApplicationNum: (state) => state.contact.unHandleGroupApplicationNum,
storeHistoryMessageList: (state) => state.message.historyMessageList, storeHistoryMessageList: (state) => state.message.historyMessageList,
storeHasMoreMessage: (state) => state.message.hasMoreMessage, storeHasMoreMessage: (state) => state.message.hasMoreMessage,
storeCurrentMsg: (state) => state.message.currentMsg, storeCurrentMsg: (state) => state.message.currentMsg,
+11 -10
View File
@@ -11,16 +11,6 @@ const mutations = {
}, },
SET_UNREAD_COUNT(state, count) { SET_UNREAD_COUNT(state, count) {
state.unread_count = count; state.unread_count = count;
if(count<1){
uni.removeTabBarBadge({
index:2
})
}else{
uni.setTabBarBadge({
index:2,
text:count
})
}
}, },
SET_TOP_UNREAD_ITEMS(state, data) { SET_TOP_UNREAD_ITEMS(state, data) {
state.top_unread_items = [...data]; state.top_unread_items = [...data];
@@ -102,6 +92,17 @@ const actions = {
async updateUnreadCount({commit,state},v) { async updateUnreadCount({commit,state},v) {
commit("SET_UNREAD_COUNT", state.unread_count+v); commit("SET_UNREAD_COUNT", state.unread_count+v);
}, },
async deleteFriendCircleList({commit,state},params){
uni.$u.http.post('/friendcircle/delete',params).then(res=>{
var list = state.list.filter(item=>{
return item.id!=params.id;
})
commit("SET_LIST", list);
}).catch(e=>{
console.log(e);
uni.$u.toast(typeof e == Object ? e?.msg : e);
})
}
}; };
export default { export default {
+8 -11
View File
@@ -29,22 +29,14 @@ const mutations = {
state.recvFriendApplications = [...list]; state.recvFriendApplications = [...list];
const count = list.filter((item) => item.handleResult === 0); const count = list.filter((item) => item.handleResult === 0);
state.unHandleFriendApplicationNum = count.length; state.unHandleFriendApplicationNum = count.length;
if(state.unHandleFriendApplicationNum>0){
uni.setTabBarBadge({
index:1,
text:(state.unHandleFriendApplicationNum<100?state.unHandleFriendApplicationNum:'···')+'',
});
}else{
uni.hideTabBarRedDot({
index:1
})
}
}, },
SET_SENT_FRIEND_APPLICATIONS(state, list) { SET_SENT_FRIEND_APPLICATIONS(state, list) {
state.sentFriendApplications = [...list]; state.sentFriendApplications = [...list];
}, },
SET_RECV_GROUP_APPLICATIONS(state, list) { SET_RECV_GROUP_APPLICATIONS(state, list) {
state.recvGroupApplications = [...list]; state.recvGroupApplications = [...list];
const count = list.filter((item) => item.handleResult === 0);
state.unHandleGroupApplicationNum = count.length;
}, },
SET_SENT_GROUP_APPLICATIONS(state, list) { SET_SENT_GROUP_APPLICATIONS(state, list) {
state.sentGroupApplications = [...list]; state.sentGroupApplications = [...list];
@@ -135,7 +127,7 @@ const actions = {
commit("SET_SENT_FRIEND_APPLICATIONS", data); commit("SET_SENT_FRIEND_APPLICATIONS", data);
}); });
}, },
getRecvGroupApplications({ commit }) { getRecvGroupApplications({ commit,state}) {
//#ifndef APP //#ifndef APP
return []; return [];
//#endif //#endif
@@ -244,6 +236,7 @@ const actions = {
commit("SET_RECV_FRIEND_APPLICATIONS", [...tmpList, application]); commit("SET_RECV_FRIEND_APPLICATIONS", [...tmpList, application]);
}, },
updateRecvFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) { updateRecvFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) {
console.log(application);
const tmpList = [...state.recvFriendApplications]; const tmpList = [...state.recvFriendApplications];
const idx = tmpList.findIndex( const idx = tmpList.findIndex(
(item) => item.fromUserID === application.fromUserID, (item) => item.fromUserID === application.fromUserID,
@@ -294,6 +287,10 @@ const actions = {
tmpList.splice(idx, 1); tmpList.splice(idx, 1);
} }
commit("SET_RECV_GROUP_APPLICATIONS", [...tmpList, application]); commit("SET_RECV_GROUP_APPLICATIONS", [...tmpList, application]);
// const newList = state.recvGroupApplications.filter((item)=>{
// item.userID !== application.userID
// });
// commit("SET_RECV_GROUP_APPLICATIONS", [...newList, application]);
}, },
updateRecvGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) { updateRecvGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) {
const tmpList = [...state.recvGroupApplications]; const tmpList = [...state.recvGroupApplications];
-10
View File
@@ -19,16 +19,6 @@ const mutations = {
}; };
}, },
SET_UNREAD_COUNT(state, count) { SET_UNREAD_COUNT(state, count) {
if (count>0) {
uni.setTabBarBadge({
index: 0,
text: count < 99 ? count + "" : "99+",
});
} else {
uni.removeTabBarBadge({
index: 0,
});
}
state.unReadCount = count; state.unReadCount = count;
}, },
SET_CURRENT_GROUP(state, group) { SET_CURRENT_GROUP(state, group) {
+22
View File
@@ -403,3 +403,25 @@ export const getConversationContent = (message) => {
} }
return parseMessageByType(message); return parseMessageByType(message);
}; };
export const updateDot = (index,count) =>{
if(count>0){
uni.setTabBarBadge({
index:index,
text:(count<100?count:'99+')+'',
});
}else{
uni.hideTabBarRedDot({index:index})
}
}
export const updateTabbar = (index)=>{
if(index===0 || index === undefined){
updateDot(0,store.getters.storeUnReadCount);
}
if(index===1 || index === undefined){
updateDot(1,store.getters.storeUnHandleFriendApplicationNum+store.getters.storeUnHandleGroupApplicationNum);
}
if(index===2 || index === undefined){
updateDot(2,store.getters.storeCircleUnreadCount);
}
};
+5 -4
View File
@@ -1,12 +1,13 @@
module.exports = { module.exports = {
// configureWebpack: { configureWebpack: {
// // 开启缓存 // 开启缓存
// cache: true, cache: true,
// // 并行构建 // // 并行构建
// parallel: true, // parallel: true,
// // 关闭sourcemap加速生产构建 // // 关闭sourcemap加速生产构建
// productionSourceMap: false // productionSourceMap: false
// }, },
// 关闭文件hash (开发环境) // 关闭文件hash (开发环境)
filenameHashing: process.env.NODE_ENV !== 'production' filenameHashing: process.env.NODE_ENV !== 'production'
} }