同步数据
This commit is contained in:
@@ -491,6 +491,13 @@
|
||||
"navigationBarTitleText": "选择联系人"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/im/group/reviewed",
|
||||
"name": "imGroupInvite",
|
||||
"style": {
|
||||
"navigationBarTitleText": "群聊邀请确认"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/im/group/users",
|
||||
"name": "imGroupUsers",
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
<template>
|
||||
<view class="apply" v-if="loaded">
|
||||
<u-avatar :src="group.cover || require('@/static/user/cover.png')" size="128" shape="square" />
|
||||
<view class="name">
|
||||
{{ group.name }}
|
||||
</view>
|
||||
|
||||
<u-button class="apply-btn" v-if="group.can_join" @click="applyGroup" text="申请加群" :disabled="disabled"
|
||||
color="#34CE98" />
|
||||
<view class="name"> {{ group.name }} </view>
|
||||
<u-button class="apply-btn" v-if="group.can_join" @click="modalShow = true" text="申请加群" :disabled="disabled" color="#34CE98" />
|
||||
<view class="" v-else>
|
||||
<view class="" v-if="group.is_full">群已满员</view>
|
||||
<view class="" v-if="group.deny_apply">禁止申请</view>
|
||||
<u-button class="apply-btn2" v-if="group.state === 'accepted'" color="#34CE98" text="进入群聊"
|
||||
@click="toGroupChat" />
|
||||
<u-button class="apply-btn2" v-if="group.state === 'accepted'" color="#34CE98" text="进入群聊" @click="toGroupChat" />
|
||||
</view>
|
||||
|
||||
<u-modal negativeTop="300" :show="modalShow" title="申请原因" showCancelButton @cancel="onHideModal"
|
||||
@confirm="onJoinGroup">
|
||||
<view class="slot-content">
|
||||
<u--input placeholder="申请原因" border="surround" focus v-model="message" />
|
||||
</view>
|
||||
<u-modal negativeTop="300" :show="modalShow" title="申请原因" showCancelButton @cancel="onHideModal" @confirm="onJoinGroup">
|
||||
<view class="slot-content"> <u--input placeholder="申请原因" border="surround" focus v-model="message" /> </view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
@@ -45,6 +37,7 @@
|
||||
this.targetId = e.targetId
|
||||
// this.targetId = "TG2"
|
||||
joinGroupPre(this.targetId).then(res => {
|
||||
console.log(res, 'res.返回群的基本信息')
|
||||
this.group = res
|
||||
this.loaded = true
|
||||
}).catch(err => {
|
||||
@@ -62,9 +55,6 @@
|
||||
url: '/pages/im/group/chat?targetId=' + this.targetId
|
||||
})
|
||||
},
|
||||
applyGroup() {
|
||||
this.modalShow = true
|
||||
},
|
||||
onHideModal() {
|
||||
this.message = ''
|
||||
this.modalShow = false
|
||||
@@ -118,6 +108,7 @@
|
||||
width: 80%;
|
||||
font-size: $title-size;
|
||||
}
|
||||
|
||||
.apply-btn2 {
|
||||
padding: 0 100rpx;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<u-cell-group class="cells" :border="false" >
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="群公告" :label="announcement" @click="toAnnouncement" />
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="二维码" @click="showGroupQrCode" />
|
||||
<u-cell :border="false" class="u-border-bottom" v-if="group.can_makesure" isLink title="群聊邀请确认" @click="showGroupsSure" />
|
||||
<u-cell :border="false" class="u-border-bottom" title="聊天置顶">
|
||||
<u-switch slot="value" size="20" v-model="isTop" activeColor="#34CE98" @change="setTop" />
|
||||
</u-cell>
|
||||
@@ -105,6 +106,7 @@
|
||||
methods: {
|
||||
initData() {
|
||||
getGroupInfo(this.targetId).then(res => {
|
||||
console.log(res,'群信息。。。。。')
|
||||
this.group = res.group
|
||||
this.groupName = res.group.name
|
||||
this.announcement = res.announcement
|
||||
@@ -150,6 +152,12 @@
|
||||
showGroupQrCode() {
|
||||
this.qrCodeShow = true
|
||||
},
|
||||
// 群聊邀请待确认
|
||||
showGroupsSure(){
|
||||
uni.navigateTo({
|
||||
url:"/pages/im/group/reviewed"
|
||||
})
|
||||
},
|
||||
onGroupName() {
|
||||
this.modalShow = true
|
||||
},
|
||||
|
||||
@@ -2,22 +2,24 @@
|
||||
<view>
|
||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||
<view class="search">
|
||||
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt" :disabled="friends.length>0" disabledColor="#Fff"
|
||||
prefixIconStyle="font-size: 22px;color: #909399" />
|
||||
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt"
|
||||
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" />
|
||||
</view>
|
||||
<block v-if="friends.length > 0">
|
||||
<u-checkbox-group v-model="checkboxValue" placement="column" @change="checkboxChange">
|
||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
||||
<u-index-anchor :text="indexs[fkey]" bgColor="#ededed" height="20" size="12" color="#666"
|
||||
style="padding:10rpx 30rpx" />
|
||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||
@click="toFriend(friendItem.targetId)">
|
||||
<u-avatar class="avatar-img" size="40" shape="square"
|
||||
:src="contact(friendItem.targetId).portraitUrl" />
|
||||
@click="selectFriend(friendItem.targetId)">
|
||||
<u-checkbox :customStyle="{marginBottom: '8px'}" :name="friendItem.targetId" />
|
||||
<u-avatar class="avatar-img" size="40" shape="square" :src="contact(friendItem.targetId).portraitUrl" />
|
||||
<view class="info">
|
||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-index-item>
|
||||
</u-checkbox-group>
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
@@ -41,7 +43,8 @@
|
||||
indexs: [],
|
||||
friends: [],
|
||||
pendingCount: 0,
|
||||
searchTxt: ''
|
||||
searchTxt: '',
|
||||
checkboxValue: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -57,56 +60,33 @@
|
||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||
},
|
||||
methods: {
|
||||
// group事件
|
||||
checkboxChange(n) {
|
||||
console.log('change', n);
|
||||
},
|
||||
getFriendList() {
|
||||
getFriendsLetter().then(res => {
|
||||
console.log(res)
|
||||
this.indexs = res.indexList
|
||||
this.friends = res.itemArr
|
||||
})
|
||||
},
|
||||
checkNewFriendPending() {
|
||||
// 获取是否有新的好友申请
|
||||
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], 1000, 0, (res) => {
|
||||
if (res.code === 0) {
|
||||
this.pendingCount = res.conversations.filter((item) => {
|
||||
return item.objectName == RongIMLib.ObjectName.ContactNotification
|
||||
}).length
|
||||
}
|
||||
})
|
||||
},
|
||||
toGroup() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/group/index',
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
}
|
||||
})
|
||||
},
|
||||
toFriend(targetId) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/im/friends/info?targetId=' + targetId
|
||||
// })
|
||||
console.log('奥克兰打开')
|
||||
},
|
||||
// 新朋友
|
||||
toPending() {
|
||||
if (this.pendingCount > 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/pending'
|
||||
});
|
||||
|
||||
selectFriend(targetId) {
|
||||
console.log(targetId,typeof targetId)
|
||||
let arr = this.checkboxValue
|
||||
let index = arr.findIndex(item => item === targetId)
|
||||
if(index>0){
|
||||
console.log('选择了再次点击清除数据le')
|
||||
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: ` 暂无好友申请 ~ `,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
console.log('没有选择过,添加数据')
|
||||
|
||||
}
|
||||
|
||||
console.log(this.checkboxValue,index)
|
||||
console.log('奥克兰打开',targetId)
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/search'
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
47
pages/im/group/reviewed.vue
Normal file
47
pages/im/group/reviewed.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<!-- 群聊邀请确认列表页面 -->
|
||||
<template>
|
||||
<view class="reviewed">
|
||||
<view class="reviewed-item">
|
||||
<u-icon name="plus-people-fill" color="#fff" class="add-icon" />
|
||||
{{`' 艾米的猫儿洛基 '想邀请 1位朋友加入群聊`}}
|
||||
<view class="sure"> 去确认 </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
indexs: [],
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.reviewed{
|
||||
.reviewed-item{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
.add-icon{
|
||||
background-color: $main-color;
|
||||
padding: 10rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user