省志愿者demo根据用户自己抓取外部联系人和用户
This commit is contained in:
@@ -1,28 +1,53 @@
|
||||
<template>
|
||||
<section class="AppOpenChat">
|
||||
|
||||
<AiLoading tips="正在处理..."/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapActions} from "vuex"
|
||||
import {mapActions, mapState} from "vuex"
|
||||
|
||||
export default {
|
||||
name: "AppOpenChat",
|
||||
appName: "创建群聊",
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
users: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['injectJWeixin']),
|
||||
getUsers() {
|
||||
return Promise.all([
|
||||
this.$http.post("/app/wxcp/wxuser/list", null, {params: {listType: 0}}).then(res => {
|
||||
if (res?.data) {
|
||||
return this.users.userIds = res.data.records?.map(e => e.id)
|
||||
}
|
||||
}),
|
||||
this.$http.post("/app/wxcp/wxcustomer/list", null, {
|
||||
params: {
|
||||
wxUserId: this.user.wxUserId
|
||||
}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
return this.users.externalUserIds = res.data.records?.map(e => e.id)
|
||||
}
|
||||
}),
|
||||
])
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm("确定创建省志愿者活动专用群聊?"))
|
||||
.then(() => {
|
||||
.then(this.getUsers).then(() => {
|
||||
wx.openEnterpriseChat({
|
||||
userIds: "18507227517;AiXianLing",
|
||||
externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ",
|
||||
groupName: "省志愿者活动专用群"
|
||||
groupName: "省志愿者活动专用群",
|
||||
...this.users,
|
||||
})
|
||||
}).catch(() => 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user