This commit is contained in:
cansnow
2026-01-01 04:15:30 +08:00
parent 09c7889525
commit 78386d4cc1
75 changed files with 1995 additions and 1715 deletions
+218 -229
View File
@@ -1,256 +1,245 @@
<template>
<view class="page_container">
<custom-nav-bar :title="isGroupApplication ? '群通知' : '好友请求'" />
<view class="page_container">
<custom-nav-bar :title="isGroupApplication ? '群通知' : '好友请求'" />
<view class="application_item">
<view class="base_info_row">
<view class="base_info_left" @click="toSourceDetails">
<my-avatar :src="getSourceFaceURL" :desc="getSourceName" />
<view class="base_info_details">
<text class="nickname">{{ getSourceName }}</text>
</view>
</view>
<view class="application_item">
<view class="base_info_row">
<view class="base_info_left" @click="toSourceDetails">
<my-avatar :src="getSourceFaceURL" :desc="getSourceName" />
<view class="base_info_details">
<text class="nickname">{{ getSourceName }}</text>
</view>
</view>
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
</view>
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
</view>
<view class="request_message">
<view v-if="isGroupApplication" class="title">
<text>申请加入 </text>
<text class="group_name">{{ currentApplication.groupName }}</text>
</view>
<text v-else>{{ `${getSourceName}` }}</text>
<text>{{ currentApplication.reqMsg }}</text>
</view>
<view class="request_message">
<view v-if="isGroupApplication" class="title">
<text>申请加入 </text>
<text class="group_name">{{ currentApplication.groupName }}</text>
</view>
<text v-else>{{ `${getSourceName}` }}</text>
<text>{{ currentApplication.reqMsg }}</text>
</view>
</view>
</view>
<view class="action_row">
<u-button
:loading="loadingState.accept"
@click="acceptAplication"
type="primary"
:plain="true"
:text="`通过${isGroupApplication ? '入群' : '好友'}申请`"
></u-button>
</view>
<view class="action_row">
<u-button :loading="loadingState.accept" @click="acceptAplication" type="primary" :plain="true"
:text="`通过${isGroupApplication ? '入群' : '好友'}申请`"></u-button>
</view>
<view class="action_row">
<u-button
:loading="loadingState.refuse"
@click="refuseAplication"
type="primary"
:plain="true"
:text="`拒绝${isGroupApplication ? '入群' : '好友'}申请`"
></u-button>
</view>
</view>
<view class="action_row">
<u-button :loading="loadingState.refuse" @click="refuseAplication" type="primary" :plain="true"
:text="`拒绝${isGroupApplication ? '入群' : '好友'}申请`"></u-button>
</view>
</view>
</template>
<script>
import { mapGetters } from "vuex";
import IMSDK, { GroupJoinSource } from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import MyAvatar from "@/components/MyAvatar/index.vue";
export default {
components: {
CustomNavBar,
MyAvatar,
},
data() {
return {
currentApplication: {},
isOnline: false,
loadingState: {
accept: false,
refuse: false,
},
};
},
computed: {
...mapGetters(["storeSelfInfo"]),
isGroupApplication() {
return this.currentApplication.groupID !== undefined;
},
getSourceID() {
return (
this.currentApplication.fromUserID ?? this.currentApplication.userID
);
},
getSourceName() {
return (
this.currentApplication.fromNickname ?? this.currentApplication.nickname
);
},
getSourceFaceURL() {
return (
this.currentApplication.fromFaceURL ?? this.currentApplication.faceURL
);
},
},
onLoad(options) {
const { application } = options;
this.currentApplication = JSON.parse(application);
},
methods: {
toSourceDetails() {
uni.navigateTo({
url: `/pages/common/userCard/index?sourceID=${this.getSourceID}`,
});
},
acceptAplication() {
this.loadingState.accept = true;
let func;
if (this.isGroupApplication) {
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptGroupApplication,
IMSDK.uuid(),
{
groupID: this.currentApplication.groupID,
fromUserID: this.currentApplication.userID,
handleMsg: "",
},
);
} else {
console.log(this.currentApplication);
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptFriendApplication,
IMSDK.uuid(),
{
toUserID: this.currentApplication.fromUserID,
handleMsg: "",
},
);
}
func
.then(() => {
uni.$u.toast("操作成功");
setTimeout(() => uni.navigateBack(), 500);
})
.catch((e) => {
console.log(e);
uni.$u.toast("操作失败");
})
.finally(() => (this.loadingState.accept = false));
},
refuseAplication() {
this.loadingState.refuse = true;
let func;
if (this.isGroupApplication) {
func = IMSDK.asyncApi(
IMSDK.IMMethods.RefuseGroupApplication,
IMSDK.uuid(),
{
groupID: this.currentApplication.groupID,
fromUserID: this.currentApplication.userID,
handleMsg: "",
},
);
} else {
func = IMSDK.asyncApi(
IMSDK.IMMethods.RefuseFriendApplication,
IMSDK.uuid(),
{
toUserID: this.currentApplication.fromUserID,
handleMsg: "",
},
);
}
func
.then(() => {
uni.$u.toast("操作成功");
setTimeout(() => uni.navigateBack(), 250);
})
.catch(() => uni.$u.toast("操作失败"))
.finally(() => (this.loadingState.refuse = false));
},
},
};
import {mapGetters} from "vuex";
import IMSDK, {GroupJoinSource} from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util/index.js"
export default {
components: {
CustomNavBar,
MyAvatar,
},
data() {
return {
currentApplication: {},
isOnline: false,
loadingState: {
accept: false,
refuse: false,
},
};
},
computed: {
...mapGetters(["storeSelfInfo"]),
isGroupApplication() {
return this.currentApplication.groupID !== undefined;
},
getSourceID() {
return (
this.currentApplication.fromUserID ?? this.currentApplication.userID
);
},
getSourceName() {
return (
this.currentApplication.fromNickname ?? this.currentApplication.nickname
);
},
getSourceFaceURL() {
return (
this.currentApplication.fromFaceURL ?? this.currentApplication.faceURL
);
},
},
onLoad(options) {
const {
application
} = options;
this.currentApplication = util.aesdecode(application);
},
methods: {
toSourceDetails() {
uni.navigateTo({
url: `/pages/common/userCard/index?sourceID=${this.getSourceID}`,
});
},
acceptAplication() {
this.loadingState.accept = true;
let func;
if (this.isGroupApplication) {
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptGroupApplication,
IMSDK.uuid(), {
groupID: this.currentApplication.groupID,
fromUserID: this.currentApplication.userID,
handleMsg: "",
},
);
} else {
console.log(this.currentApplication);
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptFriendApplication,
IMSDK.uuid(), {
toUserID: this.currentApplication.fromUserID,
handleMsg: "",
},
);
}
func
.then(() => {
uni.$u.toast("操作成功");
setTimeout(() => uni.navigateBack(), 500);
})
.catch((e) => {
console.log(e);
uni.$u.toast("操作失败");
})
.finally(() => (this.loadingState.accept = false));
},
refuseAplication() {
this.loadingState.refuse = true;
let func;
if (this.isGroupApplication) {
func = IMSDK.asyncApi(
IMSDK.IMMethods.RefuseGroupApplication,
IMSDK.uuid(), {
groupID: this.currentApplication.groupID,
fromUserID: this.currentApplication.userID,
handleMsg: "",
},
);
} else {
func = IMSDK.asyncApi(
IMSDK.IMMethods.RefuseFriendApplication,
IMSDK.uuid(), {
toUserID: this.currentApplication.fromUserID,
handleMsg: "",
},
);
}
func
.then(() => {
uni.$u.toast("操作成功");
setTimeout(() => uni.navigateBack(), 250);
})
.catch(() => uni.$u.toast("操作失败"))
.finally(() => (this.loadingState.refuse = false));
},
},
};
</script>
<style lang="scss" scoped>
.page_container {
background-color: #f8f8f8;
.page_container {
background-color: #f8f8f8;
.application_item {
padding: 72rpx 44rpx 24rpx;
background-color: #fff;
.application_item {
padding: 72rpx 44rpx 24rpx;
background-color: #fff;
.base_info_row {
@include btwBox();
.base_info_row {
@include btwBox();
.base_info_left {
@include vCenterBox();
}
.base_info_left {
@include vCenterBox();
}
.base_info_details {
margin-left: 24rpx;
.base_info_details {
margin-left: 24rpx;
.nickname {
@include nomalEllipsis();
max-width: 600rpx;
}
.nickname {
@include nomalEllipsis();
max-width: 600rpx;
}
.online_state {
@include vCenterBox();
flex-direction: row;
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
.online_state {
@include vCenterBox();
flex-direction: row;
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
.dot {
background-color: #10cc64;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
margin-right: 12rpx;
}
}
}
}
.dot {
background-color: #10cc64;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
margin-right: 12rpx;
}
}
}
}
.request_message {
background-color: #eee;
margin-top: 48rpx;
padding: 24rpx 36rpx;
border-radius: 12rpx;
font-size: 28rpx;
color: #666;
min-height: 240rpx;
.request_message {
background-color: #eee;
margin-top: 48rpx;
padding: 24rpx 36rpx;
border-radius: 12rpx;
font-size: 28rpx;
color: #666;
min-height: 240rpx;
.title {
margin-bottom: 12rpx;
color: $uni-text-color;
.title {
margin-bottom: 12rpx;
color: $uni-text-color;
.group_name {
@nomalEllipsis();
max-width: 400rpx;
color: $uni-color-primary;
margin-left: 12rpx;
}
}
}
.group_name {
@nomalEllipsis();
max-width: 400rpx;
color: $uni-color-primary;
margin-left: 12rpx;
}
}
}
.join_source {
margin-top: 20rpx;
font-size: 24rpx;
color: #666;
text-align: right;
}
}
.join_source {
margin-top: 20rpx;
font-size: 24rpx;
color: #666;
text-align: right;
}
}
.action_row {
margin-top: 24rpx;
.action_row {
margin-top: 24rpx;
.u-button {
border: none;
}
.u-button {
border: none;
}
&:last-child {
.u-button {
color: #999 !important;
}
}
}
}
</style>
&:last-child {
.u-button {
color: #999 !important;
}
}
}
}
</style>
@@ -28,13 +28,10 @@
</template>
<script>
import {
navigateToDesignatedConversation
} from "@/util/imCommon";
import IMSDK, {
SessionType
} from "openim-uniapp-polyfill";
import {navigateToDesignatedConversation} from "@/util/imCommon";
import IMSDK, {SessionType} from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util/index.js"
export default {
name: "ApplicationItem",
components: {
@@ -97,17 +94,12 @@
methods: {
clickItem() {
if (this.showAccept) {
const s = util.aesencode(this.application);
uni.navigateTo({
url: `/pages/contact/applicationDetails/index?application=${JSON.stringify(
this.application,
)}`,
url: `/pages/contact/applicationDetails/index?application=${s}`,
});
} else {
let sourceID =
this.application.groupID ??
(this.isRecv ?
this.application.fromUserID :
this.application.toUserID);
let sourceID = this.application.groupID ?? (this.isRecv ? this.application.fromUserID : this.application.toUserID);
let cardType = this.isGroupApplication ? "groupCard" : "userCard";
const url = `/pages/common/${cardType}/index?sourceID=${sourceID}`;
uni.navigateTo({
+72 -72
View File
@@ -1,81 +1,81 @@
<template>
<view class="application_list_container">
<custom-nav-bar :title="getTitle" />
<view class="application_list_container">
<custom-nav-bar :title="getTitle" />
<u-list class="application_list">
<u-list-item
v-for="application in getRenderData"
:key="getKey(application)"
>
<application-item :isRecv="isRecv" :application="application" />
</u-list-item>
</u-list>
</view>
<u-list class="application_list">
<u-list-item v-for="application in getRenderData" :key="getKey(application)">
<application-item :isRecv="isRecv" :application="application" />
</u-list-item>
</u-list>
</view>
</template>
<script>
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import ApplicationItem from "../applicationList/ApplicationItem.vue";
export default {
components: {
CustomNavBar,
ApplicationItem,
},
data() {
return {
isGroupApplication: false,
isRecv: false,
};
},
computed: {
getRenderData() {
let getterKey = this.isRecv
? "storeRecvFriendApplications"
: "storeSentFriendApplications";
if (this.isGroupApplication) {
getterKey = this.isRecv
? "storeRecvGroupApplications"
: "storeSentGroupApplications";
}
return [...this.$store.getters[getterKey]].sort((a, b) =>
a.handleResult === 0 ? -1 : 1,
);
},
getKey() {
return (application) => {
if (this.isGroupApplication) {
return this.isRecv
? application.userID + application.groupID
: application.groupID;
}
return application[this.isRecv ? "fromUserID" : "toUserID"];
};
},
getTitle() {
if (!this.isRecv) {
return "我的申请";
}
return this.isGroupApplication ? "群通知" : "好友请求";
},
},
onLoad(options) {
const { isGroupApplication, isRecv } = options;
this.isGroupApplication = JSON.parse(isGroupApplication);
this.isRecv = JSON.parse(isRecv);
},
methods: {},
};
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import ApplicationItem from "../applicationList/ApplicationItem.vue";
export default {
components: {
CustomNavBar,
ApplicationItem,
},
data() {
return {
isGroupApplication: false,
isRecv: false,
};
},
computed: {
getRenderData() {
let getterKey = this.isRecv ?
"storeRecvFriendApplications" :
"storeSentFriendApplications";
if (this.isGroupApplication) {
getterKey = this.isRecv ?
"storeRecvGroupApplications" :
"storeSentGroupApplications";
}
return [...this.$store.getters[getterKey]].sort((a, b) =>
a.handleResult === 0 ? -1 : 1,
);
},
getKey() {
return (application) => {
if (this.isGroupApplication) {
return this.isRecv ?
application.userID + application.groupID :
application.groupID;
}
return application[this.isRecv ? "fromUserID" : "toUserID"];
};
},
getTitle() {
if (!this.isRecv) {
return "我的申请";
}
return this.isGroupApplication ? "群通知" : "好友请求";
},
},
onLoad(options) {
const {
isGroupApplication,
isRecv
} = options;
this.isGroupApplication = JSON.parse(isGroupApplication);
this.isRecv = JSON.parse(isRecv);
},
methods: {},
};
</script>
<style lang="scss" scoped>
.application_list_container {
@include colBox(false);
height: 100vh;
background-color: #f8f8f8;
.application_list_container {
@include colBox(false);
height: 100vh;
background-color: #f8f8f8;
.application_list {
margin-top: 24rpx;
flex: 1;
}
}
</style>
.application_list {
margin-top: 24rpx;
flex: 1;
}
}
</style>
+7 -7
View File
@@ -26,15 +26,15 @@
{
idx: 0,
title: "创建群聊",
desc: "创建群聊,全面使用OpenIM",
desc: "创建群聊",
icon: contact_add_create_group_img,
},
{
idx: 1,
title: "添加群聊",
desc: "向管理员或团队成员询问ID",
icon: rcontact_add_join_group_img,
},
// {
// idx: 1,
// title: "添加群聊",
// desc: "向管理员或团队成员询问ID",
// icon: contact_add_join_group_img,
// },
],
friendActionMenus: [
{
+1 -1
View File
@@ -15,7 +15,7 @@
</view>
<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="新的群组" 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/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>