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
@@ -251,12 +251,15 @@
const realVideoPath = await getPurePath(item);
console.log('处理后的可用路径', realVideoPath);
const info = await getVideoInfo(realVideoPath);
const cover = await getVideoCover(item);
//const cover = await getVideoCover(item);
const res1 = await IMSDK.getVideoCover(item);
//console.log(res1.path);
const videoParams = {
videoPath: realVideoPath,
videoType: "mp4",
duration: info.duration,
snapshotPath: getPurePath(cover),
snapshotPath: getPurePath(res1.path),
//snapshotPath: getPurePath(cover),
};
console.log('videoParams', videoParams);
message = await IMSDK.asyncApi(
@@ -271,7 +274,7 @@
getPurePath(item)
);
}
console.log(message);
//console.log(message);
if(message){
_this.sendMessage(message,_this.storeCurrentConversation.userID,_this.storeCurrentConversation.groupID);
}
@@ -416,10 +419,16 @@
return ;
}
if(e.source == "album"){
// IMSDK.pickFile().then(res=>{
// console.log(res);
// }).catch(e=>{
// console.log(e);
// });
// return;
plus.gallery.pick(({files})=>{
_this.sendMediaMesage(files);
}, (error )=>{
reject(error);
console.log(error);
}, {
animation:true,
confirmText:"确定",
@@ -23,12 +23,8 @@
</template>
<script>
import {
mapGetters
} from "vuex";
import {
SessionType
} from "openim-uniapp-polyfill";
import {mapGetters} from "vuex";
import {SessionType} from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
export default {
@@ -21,8 +21,9 @@
src="/static/images/sync_error.png">
</u--image>
<u--text class="address" :style="{
width:selfWidth+'px'
}" :lines="1" :size="20" :text="desc"></u--text>
width:selfWidth+'px',
paddingTop:'5px'
}" :lines="1" :size="16" :text="desc"></u--text>
</view>
</template>
@@ -38,7 +39,6 @@
data() {
return {
selfWidth:200,
loadingWidth: "200px",
src:"",
coverDownloading:false,
coverDownloadProgress:"",
@@ -48,12 +48,13 @@
};
},
created() {
this.selfWidth = uni.$u.getPx('400rpx');
let loc = this.message.locationElem;
this.desc = loc.description;
this.apisrc = "http://api.tianditu.gov.cn/staticimage?"
+"center="+loc.longitude+","+loc.latitude
+"&width=400"
+"&height=300"
+"&height=250"
+"&zoom=10"
+"&markers="+loc.longitude+","+loc.latitude
+"&tk=5255a4be64441ba9fa2ebe605ca472bf";
@@ -94,7 +95,6 @@
})
},
onLoaded() {
this.loadingWidth = "auto";
},
},
@@ -104,7 +104,6 @@
<style lang="scss" scoped>
.location_message_container{
.address{
margin-top: 20rpx;
}
}
</style>
@@ -0,0 +1,44 @@
<template>
<view class="text_message_container bg_container" v-if="notification.contentType == 101">
<u-parse :content="getContent" :previewImg="false" :showImgMenu="false" selectable></u-parse>
</view>
</template>
<script>
import {parseBr} from "@/util/common";
export default {
name: "NotificationRender",
components: {
},
props: {
message: Object,
conversationID:String,
isSender:Boolean
},
computed:{
notification(){
const body = JSON.parse(this.message.notificationElem.detail);
body.data = JSON.parse(body.data);
return body.data;
},
getContent() {
return parseBr(this.notification.textElem?.content);
}
},
data() {
return {
content:"",
};
},
mounted() {
},
methods: {
onMessageEvent(e){
this.$emit('onMessageEvent',e);
}
},
};
</script>
<style lang="scss" scoped></style>
@@ -54,7 +54,7 @@
"videoType": "mp4",
"videoSize": 3751005,
"duration": 44,
"snapshotPath": "/storage/emulated/0/Android/data/hk.huisheng.im/apps/__UNI__CA458BA/doc/video_cover_2ea1c8ec.jpg",
"snapshotPath": "/storage/emulated/0/Android/data/hk.huisheng.im/apps/__UNI__E41111F/doc/video_cover_2ea1c8ec.jpg",
"snapshotSize": 36974,
"snapshotUrl": "http://www.axzc.xyz/object/100003/msg_videoSnapshot_d9a596f3e665e84559821a8aa5fb9f16.jpg",
"snapshotWidth": 1087,
@@ -116,8 +116,11 @@
},
methods: {
async init(){
const snapshotUrl = this.message?.videoElem?.snapshotUrl;
const self = this;
console.log(this.message?.videoElem);
const snapshotUrl = this.message?.videoElem?.snapshotPath || this.message?.videoElem?.snapshotUrl;
self.coverDownloading = true;
console.log(snapshotUrl);
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
self.coverDownloading = false;
self.src = fn;
@@ -57,6 +57,7 @@
import MarkdownMessageRender from "./MarkdownMessageRender";
import StreamMessageRender from "./StreamMessageRender";
import OANotificationRender from "./OANotificationRender";
import NotificationRender from "./NotificationRender";
import ErrorMessageRender from "./ErrorMessageRender";
import {noticeMessageTypes} from "@/constant";
@@ -82,6 +83,7 @@
MarkdownMessageRender,
StreamMessageRender,
OANotificationRender,
NotificationRender,
ErrorMessageRender
},
props: {
@@ -173,7 +175,8 @@
['type_'+MessageType.FaceMessage] : "FaceMessageRender",
['type_'+MessageType.MarkdownMessage] : "MarkdownMessageRender",
['type_'+MessageType.StreamMessage] : "StreamMessageRender",
['type_'+MessageType.OANotification] : "OANotificationRender"
['type_'+MessageType.OANotification] : "OANotificationRender",
'type_2001' : "NotificationRender"
};
this.component = MsgType2Components['type_'+this.source.contentType] || "ErrorMessageRender";
this.$emit('userEvent',{type:"messageItemRender"},this.source.clientMsgID);
@@ -103,19 +103,20 @@
flex:1;
.details {
@include colBox(true);
display: flex;
flex-direction: column;
justify-content: space-around;
flex:1;
margin-left: 24rpx;
height: 46px;
color: $uni-text-color;
padding-bottom:20rpx;
color: $u-main-color;
.title{
@include btwBox();
.conversation_name {
@include nomalEllipsis();
max-width: 40vw;
font-size: 32rpx;
font-weight: 500;
font-weight: 400;
}
.right_desc {
+1 -7
View File
@@ -14,13 +14,7 @@
<script>
import {mapGetters} from "vuex";
import IMSDK, {
GroupMemberRole,
GroupStatus,
GroupVerificationType,
IMMethods,
MessageReceiveOptType,
} from "openim-uniapp-polyfill";
import IMSDK, {GroupMemberRole,GroupStatus,GroupVerificationType,IMMethods,MessageReceiveOptType,} from "openim-uniapp-polyfill";
import {GroupMemberListTypes} from "@/constant";
export default {
data() {
+265 -295
View File
@@ -1,314 +1,284 @@
<template>
<view @click="pageClick" class="group_members_container">
<group-member-list-header
ref="navHeaderRef"
:checkVisible.sync="showCheck"
:isTransfer="isTransfer"
:isNomal="!isOwner && !isAdmin"
:groupID="groupID"
@removeMember="showMemberCheck"
/>
<view @click="pageClick" class="group_members_container">
<group-member-list-header ref="navHeaderRef" :checkVisible.sync="showCheck" :isTransfer="isTransfer"
:isNomal="!isOwner && !isAdmin" :groupID="groupID" @removeMember="showMemberCheck" />
<view class="search_bar_wrap">
<u-search
disabled
class="search_bar"
shape="square"
placeholder="搜索"
:showAction="false"
v-model="keyword"
/>
</view>
<view class="search_bar_wrap">
<u-search disabled class="search_bar" shape="square" placeholder="搜索" :showAction="false"
v-model="keyword" />
</view>
<u-list
class="member_list"
@scrolltolower="loadMore"
lowerThreshold="100"
height="1"
>
<u-list-item v-for="member in groupMemberList" :key="member.userID">
<user-item
@itemClick="userClick"
@updateCheck="updateCheck"
:checked="isChecked(member.userID)"
:checkVisible="showCheck"
:disabled="!canCheck(member) && showCheck"
:item="member"
/>
</u-list-item>
<view
v-show="loadState.loading"
class="member_loading"
>
<u-loading-icon></u-loading-icon>
</view>
</u-list>
<u-list class="member_list" @scrolltolower="loadMore" lowerThreshold="100" height="1">
<u-list-item v-for="member in groupMemberList" :key="member.userID">
<user-item @itemClick="userClick" @updateCheck="updateCheck" :checked="isChecked(member.userID)"
:checkVisible="showCheck" :disabled="!canCheck(member) && showCheck" :item="member" />
</u-list-item>
<view v-show="loadState.loading" class="member_loading">
<u-loading-icon></u-loading-icon>
</view>
</u-list>
<choose-index-footer
v-if="showCheck"
:comfirmLoading="comfirmLoading"
@removeItem="updateCheck"
@confirm="confirm"
:choosedData="getChoosedData"
:isRemove="isRemove"
:maxLength="groupMemberLength"
/>
<choose-index-footer v-if="showCheck" :comfirmLoading="comfirmLoading" @removeItem="updateCheck"
@confirm="confirm" :choosedData="getChoosedData" :isRemove="isRemove" :maxLength="groupMemberLength" />
<u-modal
:show="showConfirmModal"
asyncClose
showCancelButton
@confirm="modalConfirm"
@cancel="() => (showConfirmModal = false)"
:content="
<u-modal :show="showConfirmModal" asyncClose showCancelButton @confirm="modalConfirm"
@cancel="() => (showConfirmModal = false)" :content="
isRemove
? '确定移除已选群成员?'
: `确定要把群主转移给${choosedTransferMember.nickname}吗?`
"
/>
<u-toast ref="uToast"></u-toast>
</view>
" />
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
let moreActionArea;
import { GroupMemberListTypes } from "@/constant";
import IMSDK, { GroupMemberRole } from "openim-uniapp-polyfill";
import UserItem from "@/components/UserItem/index.vue";
import GroupMemberListHeader from "./components/GroupMemberListHeader.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
export default {
components: {
GroupMemberListHeader,
ChooseIndexFooter,
UserItem,
},
data() {
return {
showCheck: false,
groupID: "",
keyword: "",
showConfirmModal: false,
comfirmLoading: false,
groupMemberList: [],
choosedMemberIDList: [],
choosedTransferMember: {},
type: GroupMemberListTypes.Preview,
isRightKick: true,
loadState: {
hasMore: true,
loading: false,
},
};
},
computed: {
getChoosedData() {
const tmpList = [...this.choosedMemberIDList];
return this.groupMemberList.filter(
(member) => {
const idx = tmpList.findIndex((item) => item === member.userID);
if (idx > -1) {
tmpList.splice(idx, 1);
}
return idx > -1;
},
);
},
isRemove() {
return this.type === GroupMemberListTypes.Kickout;
},
isTransfer() {
return this.type === GroupMemberListTypes.Transfer;
},
isChecked() {
return (userID) => this.choosedMemberIDList.includes(userID);
},
isOwner() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Owner
);
},
isAdmin() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Admin
);
},
canCheck() {
return ({ roleLevel, userID }) => {
if (this.type === GroupMemberListTypes.Kickout) {
return (
(this.isOwner ||
(this.isAdmin && roleLevel !== GroupMemberRole.Owner)) &&
userID !== this.$store.getters.storeCurrentUserID
);
}
let moreActionArea;
import {GroupMemberListTypes} from "@/constant";
import IMSDK, {GroupMemberRole} from "openim-uniapp-polyfill";
import UserItem from "@/components/UserItem/index.vue";
import GroupMemberListHeader from "./components/GroupMemberListHeader.vue";
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
import util from "@/util/index.js"
export default {
components: {
GroupMemberListHeader,
ChooseIndexFooter,
UserItem,
},
data() {
return {
showCheck: false,
groupID: "",
keyword: "",
showConfirmModal: false,
comfirmLoading: false,
groupMemberList: [],
choosedMemberIDList: [],
choosedTransferMember: {},
type: GroupMemberListTypes.Preview,
isRightKick: true,
loadState: {
hasMore: true,
loading: false,
},
};
},
computed: {
getChoosedData() {
const tmpList = [...this.choosedMemberIDList];
return this.groupMemberList.filter(
(member) => {
const idx = tmpList.findIndex((item) => item === member.userID);
if (idx > -1) {
tmpList.splice(idx, 1);
}
return idx > -1;
},
);
},
isRemove() {
return this.type === GroupMemberListTypes.Kickout;
},
isTransfer() {
return this.type === GroupMemberListTypes.Transfer;
},
isChecked() {
return (userID) => this.choosedMemberIDList.includes(userID);
},
isOwner() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Owner
);
},
isAdmin() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Admin
);
},
canCheck() {
return ({
roleLevel,
userID
}) => {
if (this.type === GroupMemberListTypes.Kickout) {
return (
(this.isOwner ||
(this.isAdmin && roleLevel !== GroupMemberRole.Owner)) &&
userID !== this.$store.getters.storeCurrentUserID
);
}
return userID !== this.$store.getters.storeCurrentUserID;
};
},
groupMemberLength() {
return this.$store.getters.storeCurrentGroup?.memberCount ?? 0;
},
},
onLoad(options) {
const { groupID, type } = options;
this.loadMemberList(groupID);
this.type = type;
this.groupID = groupID;
this.isRightKick = type === GroupMemberListTypes.Kickout;
if (
this.isRightKick
) {
this.showCheck = true;
}
},
methods: {
async pageClick(e) {
if (!moreActionArea) {
moreActionArea = await this.getEl(".more_container");
}
if (!moreActionArea) return;
if (
e.target.y < moreActionArea.top ||
e.target.y > moreActionArea.bottom ||
e.target.x < moreActionArea.left
) {
this.$refs.navHeaderRef.checkMenu();
}
},
confirm() {
this.showConfirmModal = true;
},
modalConfirm() {
let func = () => {};
if (this.type === GroupMemberListTypes.Kickout) {
func = IMSDK.asyncApi(IMSDK.IMMethods.KickGroupMember, IMSDK.uuid(), {
groupID: this.getChoosedData[0].groupID,
reason: "",
userIDList: this.getChoosedData.map((member) => member.userID),
});
} else {
func = IMSDK.asyncApi(
IMSDK.IMMethods.TransferGroupOwner,
IMSDK.uuid(),
{
groupID: this.choosedTransferMember.groupID,
newOwnerUserID: this.choosedTransferMember.userID,
},
);
}
func
.then(() => this.showToast("操作成功", () => uni.navigateBack()))
.catch(() => this.showToast("操作失败"))
.finally(() => (this.showConfirmModal = false));
},
updateChoosedData(userID) {
if (this.choosedMemberIDList.includes(userID)) {
const idx = this.choosedMemberIDList.findIndex(
(item) => item === userID,
);
const tmpArr = [...this.choosedMemberIDList];
tmpArr.splice(idx, 1);
this.choosedMemberIDList = tmpArr;
} else {
this.choosedMemberIDList = [...this.choosedMemberIDList, userID];
}
console.log(this.choosedMemberIDList);
},
userClick(member) {
if (this.type === GroupMemberListTypes.Transfer) {
if (member.userID === this.$store.getters.storeCurrentUserID) return;
this.choosedTransferMember = member;
this.showConfirmModal = true;
} else {
uni.$u.route("/pages/common/userCard/index", {
sourceID: member.userID,
memberInfo: JSON.stringify(member),
});
}
},
updateCheck(member) {
this.updateChoosedData(member.userID);
},
showMemberCheck() {
this.type = GroupMemberListTypes.Kickout;
this.showCheck = true;
},
loadMore() {
const stateKey = "loadState";
const methodKey = "loadMemberList";
if (this[stateKey].hasMore && !this[stateKey].loading) {
this[methodKey]();
}
},
loadMemberList(groupID) {
this.loadState.loading = true;
IMSDK.asyncApi(IMSDK.IMMethods.GetGroupMemberList, IMSDK.uuid(), {
groupID: groupID ?? this.groupID,
filter: 0,
offset: this.groupMemberList.length,
count: 500,
})
.then(({ data }) => {
this.groupMemberList = [...this.groupMemberList, ...data];
this.loadState.hasMore = data.length === 500;
})
.finally(() => (this.loadState.loading = false));
},
showToast(message, complete = null) {
this.$refs.uToast.show({
message,
complete,
});
},
getEl(el) {
return new Promise((resolve) => {
const query = uni.createSelectorQuery().in(this);
query
.select(el)
.boundingClientRect((data) => {
// 存在data,且存在宽和高,视为渲染完毕
resolve(data);
})
.exec();
});
},
},
onBackPress(options) {
if (this.showCheck && this.isRightKick) {
this.showCheck = false;
this.type = GroupMemberListTypes.Preview;
return true;
}
return false;
},
};
return userID !== this.$store.getters.storeCurrentUserID;
};
},
groupMemberLength() {
return this.$store.getters.storeCurrentGroup?.memberCount ?? 0;
},
},
onLoad(options) {
const {
groupID,
type
} = options;
this.loadMemberList(groupID);
this.type = type;
this.groupID = groupID;
this.isRightKick = type === GroupMemberListTypes.Kickout;
if (
this.isRightKick
) {
this.showCheck = true;
}
},
methods: {
async pageClick(e) {
if (!moreActionArea) {
moreActionArea = await this.getEl(".more_container");
}
if (!moreActionArea) return;
if (
e.target.y < moreActionArea.top ||
e.target.y > moreActionArea.bottom ||
e.target.x < moreActionArea.left
) {
this.$refs.navHeaderRef.checkMenu();
}
},
confirm() {
this.showConfirmModal = true;
},
modalConfirm() {
let func = () => {};
if (this.type === GroupMemberListTypes.Kickout) {
func = IMSDK.asyncApi(IMSDK.IMMethods.KickGroupMember, IMSDK.uuid(), {
groupID: this.getChoosedData[0].groupID,
reason: "",
userIDList: this.getChoosedData.map((member) => member.userID),
});
} else {
func = IMSDK.asyncApi(
IMSDK.IMMethods.TransferGroupOwner,
IMSDK.uuid(), {
groupID: this.choosedTransferMember.groupID,
newOwnerUserID: this.choosedTransferMember.userID,
},
);
}
func
.then(() => this.showToast("操作成功", () => uni.navigateBack()))
.catch(() => this.showToast("操作失败"))
.finally(() => (this.showConfirmModal = false));
},
updateChoosedData(userID) {
if (this.choosedMemberIDList.includes(userID)) {
const idx = this.choosedMemberIDList.findIndex(
(item) => item === userID,
);
const tmpArr = [...this.choosedMemberIDList];
tmpArr.splice(idx, 1);
this.choosedMemberIDList = tmpArr;
} else {
this.choosedMemberIDList = [...this.choosedMemberIDList, userID];
}
console.log(this.choosedMemberIDList);
},
userClick(member) {
if (this.type === GroupMemberListTypes.Transfer) {
if (member.userID === this.$store.getters.storeCurrentUserID) return;
this.choosedTransferMember = member;
this.showConfirmModal = true;
} else {
const s = util.aesencode(member);
uni.$u.route("/pages/common/userCard/index", {
sourceID: member.userID,
memberInfo: s,
});
}
},
updateCheck(member) {
this.updateChoosedData(member.userID);
},
showMemberCheck() {
this.type = GroupMemberListTypes.Kickout;
this.showCheck = true;
},
loadMore() {
const stateKey = "loadState";
const methodKey = "loadMemberList";
if (this[stateKey].hasMore && !this[stateKey].loading) {
this[methodKey]();
}
},
loadMemberList(groupID) {
this.loadState.loading = true;
IMSDK.asyncApi(IMSDK.IMMethods.GetGroupMemberList, IMSDK.uuid(), {
groupID: groupID ?? this.groupID,
filter: 0,
offset: this.groupMemberList.length,
count: 500,
})
.then(({
data
}) => {
this.groupMemberList = [...this.groupMemberList, ...data];
this.loadState.hasMore = data.length === 500;
})
.finally(() => (this.loadState.loading = false));
},
showToast(message, complete = null) {
this.$refs.uToast.show({
message,
complete,
});
},
getEl(el) {
return new Promise((resolve) => {
const query = uni.createSelectorQuery().in(this);
query
.select(el)
.boundingClientRect((data) => {
// 存在data,且存在宽和高,视为渲染完毕
resolve(data);
})
.exec();
});
},
},
onBackPress(options) {
if (this.showCheck && this.isRightKick) {
this.showCheck = false;
this.type = GroupMemberListTypes.Preview;
return true;
}
return false;
},
};
</script>
<style lang="scss" scoped>
.group_members_container {
@include colBox(false);
height: 100vh;
overflow: hidden;
.group_members_container {
@include colBox(false);
height: 100vh;
overflow: hidden;
.search_bar_wrap {
height: 34px;
padding: 12px 22px;
}
.search_bar_wrap {
height: 34px;
padding: 12px 22px;
}
.at_all_btn {
font-weight: 500;
padding: 24rpx 44rpx;
}
.at_all_btn {
font-weight: 500;
padding: 24rpx 44rpx;
}
::v-deep.u-popup {
flex: none;
}
::v-deep.u-popup {
flex: none;
}
.member_list {
flex: 1;
}
}
</style>
.member_list {
flex: 1;
}
}
</style>
+7 -12
View File
@@ -62,18 +62,13 @@
<script>
import {mapGetters} from "vuex";
import {GroupMemberListTypes} from "@/constant";
import IMSDK, {
GroupMemberRole,
GroupStatus,
GroupVerificationType,
IMMethods,
MessageReceiveOptType,
} from "openim-uniapp-polyfill";
import IMSDK, {GroupMemberRole,GroupStatus,GroupVerificationType,IMMethods,MessageReceiveOptType,} from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import MyAvatar from "@/components/MyAvatar/index.vue";
import SettingItem from "@/components/SettingItem/index.vue";
import GroupMemberRow from "./components/GroupMemberRow.vue";
import {getPurePath} from "@/util/common";
import util from "@/util/index.js"
const ConfirmTypes = {
Dismiss: "Dismiss",
@@ -193,13 +188,13 @@
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
},
getGroupQrcdeUrl(){
const info = {
const info = util.aesencode({
code : this.storeCurrentConversation.groupID,
showName: `${this.storeCurrentConversation.showName}(${this.storeCurrentGroup.memberCount})`,
faceURL : this.storeCurrentConversation.faceURL,
type : "group",
};
return `/pages/common/userOrGroupQrCode?sourceInfo=${JSON.stringify(info,)}`;
});
return `/pages/common/userOrGroupQrCode?sourceInfo=${s}`;
},
getGroupVerStr() {
if (
@@ -251,9 +246,9 @@
if (!this.isAdmin && !this.isOwner) {
return;
}
const s = util.aesencode(this.storeCurrentGroup);
uni.navigateTo({
url: `/pages/conversation/updateGroupOrNickname/index?sourceInfo=${JSON.stringify(this.storeCurrentGroup,)}`,
url: `/pages/conversation/updateGroupOrNickname/index?sourceInfo=${s}`,
});
},
copyGroupID() {
@@ -1,92 +1,89 @@
<template>
<view class="page_container">
<custom-nav-bar :title="getTitle">
<view class="nav_right_action" slot="more">
<u-button type="primary" v-show="!updateLoading" @click="comfirmUpdate">保存</u-button>
<u-loading-icon v-show="updateLoading" />
</view>
</custom-nav-bar>
<view class="page_container">
<custom-nav-bar :title="getTitle">
<view class="nav_right_action" slot="more">
<u-button type="primary" v-show="!updateLoading" @click="comfirmUpdate">保存</u-button>
<u-loading-icon v-show="updateLoading" />
</view>
</custom-nav-bar>
<view class="content_row">
<u-input
v-model="content"
disabledColor="transparent"
maxlength="16"
placeholder="请输入内容"
clearable
>
</u-input>
</view>
</view>
<view class="content_row">
<u-input v-model="content" disabledColor="transparent" maxlength="16" placeholder="请输入内容" clearable>
</u-input>
</view>
</view>
</template>
<script>
import IMSDK 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 {
sourceInfo: {},
content: "",
updateLoading: false,
};
},
computed: {
getTitle() {
return "修改群聊名称";
},
getSubTitle() {
return "修改群名称后,将在群内通知其他成员";
},
},
onLoad(options) {
const { sourceInfo } = options;
this.sourceInfo = JSON.parse(sourceInfo);
this.content = this.sourceInfo.groupName;
},
methods: {
comfirmUpdate() {
this.updateLoading = true;
IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
groupID: this.sourceInfo.groupID,
groupName: this.content,
})
.then(() => {
uni.$u.toast("修改成功");
setTimeout(() => uni.navigateBack(), 250);
})
.catch(() => uni.$u.toast("修改失败"))
.finally(() => (this.updateLoading = false));
},
},
};
import IMSDK 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 {
sourceInfo: {},
content: "",
updateLoading: false,
};
},
computed: {
getTitle() {
return "修改群聊名称";
},
getSubTitle() {
return "修改群名称后,将在群内通知其他成员";
},
},
onLoad(options) {
const {
sourceInfo
} = options;
this.sourceInfo = util.aesdecode(sourceInfo);
this.content = this.sourceInfo.groupName;
},
methods: {
comfirmUpdate() {
this.updateLoading = true;
IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
groupID: this.sourceInfo.groupID,
groupName: this.content,
})
.then(() => {
uni.$u.toast("修改成功");
setTimeout(() => uni.navigateBack(), 250);
})
.catch(() => uni.$u.toast("修改失败"))
.finally(() => (this.updateLoading = false));
},
},
};
</script>
<style lang="scss" scoped>
.page_container {
@include colBox(false);
height: 100vh;
.page_container {
@include colBox(false);
height: 100vh;
.nav_right_action {
margin-right: 36rpx;
}
.nav_right_action {
margin-right: 36rpx;
}
.content_row {
margin-top: 96rpx;
margin: 72rpx 44rpx 0;
.content_row {
margin-top: 96rpx;
margin: 72rpx 44rpx 0;
.u-input {
background-color: #e8eaef;
}
.u-input {
background-color: #e8eaef;
}
.u-button {
height: 60rpx;
}
}
}
</style>
.u-button {
height: 60rpx;
}
}
}
</style>