好友申请流程优化,群创建简化

This commit is contained in:
2022-02-14 14:23:28 +08:00
parent d8c1ab7090
commit b61d90de4e
10 changed files with 113 additions and 114 deletions

View File

@@ -7,18 +7,27 @@
<view class="name">{{ item.name }}</view>
</view>
</view>
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
@confirm="onCreateGroup">
<view class="slot-content">
<u--input placeholder="群名称" border="surround" focus v-model="groupName"></u--input>
</view>
</u-modal>
</view>
</template>
<script>
import {
getMyGroups
getMyGroups,
createGroup
} from '@/apis/interfaces/im.js'
export default {
data() {
return {
groups: []
groups: [],
createModal: false,
groupName: ''
}
},
computed: {
@@ -29,19 +38,40 @@
}
},
onNavigationBarButtonTap() {
uni.navigateTo({
url: 'pages/im/group/create'
})
this.createModal = true
},
onLoad() {
getMyGroups().then((res) => {
this.groups = res
res.map(item => {
this.$store.dispatch('updateContact', item)
})
})
this.initData()
},
methods: {
initData() {
getMyGroups().then((res) => {
this.groups = res
res.map(item => {
this.$store.dispatch('updateContact', item)
})
})
},
onHideModal() {
this.createModal = false
this.groupName = ''
},
onCreateGroup() {
createGroup({
name: this.groupName
}).then(res => {
uni.showToast({
title: '创建成功'
})
this.initData()
this.onHideModal()
}).catch(err => {
uni.showToast({
icon: 'none',
title: err
})
})
},
toGroup(targetId) {
uni.navigateTo({
url: '/pages/im/group/chat?targetId=' + targetId