Files
im/pages/conversation/groupSettings/announcement.vue
T

80 lines
1.6 KiB
Vue
Raw Normal View History

2025-12-05 16:10:52 +08:00
<template>
2026-01-09 20:22:25 +08:00
<view>
2025-12-05 16:10:52 +08:00
<u-navbar
title="群公告"
placeholder
2026-01-09 20:22:25 +08:00
:autoBack="true"
2025-12-05 16:10:52 +08:00
>
<view class="u-nav-slot" slot="right" v-if="isOwner || isAdmin">
2026-01-09 20:22:25 +08:00
<u-button type="primary" size="mini" @click="save">保存</u-button>
2025-12-05 16:10:52 +08:00
</view>
</u-navbar>
2026-01-09 20:22:25 +08:00
<u-parse v-if="!isOwner && !isAdmin" :content="announcement"></u-parse>
<u--textarea v-else
count
confirmType="done"
focus
autoHeight
height="500"
maxlength="-1"
border="none"
:adjustPosition="false"
class="textarea"
placeholder="暂无公告"
v-model="announcement"
>
</u--textarea>
2025-12-05 16:10:52 +08:00
</view>
</template>
<script>
import {mapGetters} from "vuex";
import IMSDK,{GroupMemberRole,} from "openim-uniapp-polyfill";
export default {
computed: {
...mapGetters([
"storeCurrentConversation",
"storeCurrentMemberInGroup",
"storeCurrentGroup",
]),
isOwner() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
},
isAdmin() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
},
},
data() {
return {
announcement:"",
}
},
onLoad() {
2026-01-09 20:22:25 +08:00
this.announcement = this.storeCurrentGroup.notification;
2025-12-05 16:10:52 +08:00
},
methods: {
back(){
uni.navigateBack();
},
save(){
2026-01-09 20:22:25 +08:00
if(!this.isOwner && !this.isAdmin){
2025-12-05 16:10:52 +08:00
return ;
}
IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
groupID: this.storeCurrentGroup.groupID,
notification: this.announcement
}).then(res=>{
console.log(res);
uni.navigateBack();
}).catch(e=>{
console.log(e);
})
}
}
}
</script>
2026-01-09 20:22:25 +08:00
<style scoped lang="scss">
.textarea{
}
2025-12-05 16:10:52 +08:00
</style>