省志愿者demo根据用户自己抓取外部联系人和用户调试成功

This commit is contained in:
aixianling
2022-09-29 11:34:32 +08:00
parent f6d9af9a85
commit 2f22373341

View File

@@ -22,18 +22,18 @@ export default {
...mapActions(['injectJWeixin']), ...mapActions(['injectJWeixin']),
getUsers() { getUsers() {
return Promise.all([ return Promise.all([
this.$http.post("/app/wxcp/wxuser/list", null, {params: {listType: 0}}).then(res => { // this.$http.post("/app/wxcp/wxuser/list", null, {params: {listType: 0}}).then(res => {
if (res?.data) { // if (res?.data) {
return this.users.userIds = res.data.records?.map(e => e.id) // return this.users.userIds = res.data.records?.map(e => e.id).join(";")
} // }
}), // }),
this.$http.post("/app/wxcp/wxcustomer/list", null, { this.$http.post("/app/wxcp/wxcustomer/list", null, {
params: { params: {
wxUserId: this.user.wxUserId wxUserId: this.user.wxUserId
} }
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
return this.users.externalUserIds = res.data.records?.map(e => e.id) return this.users.externalUserIds = res.data.records?.filter(e => e.type == 1)?.map(e => e.id).join(";")
} }
}), }),
]) ])
@@ -43,8 +43,8 @@ export default {
created() { created() {
this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm("确定创建省志愿者活动专用群聊?")) this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm("确定创建省志愿者活动专用群聊?"))
.then(this.getUsers).then(() => { .then(this.getUsers).then(() => {
console.log(this.users)
wx.openEnterpriseChat({ wx.openEnterpriseChat({
userIds: "18507227517;AiXianLing",
externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ", externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ",
groupName: "省志愿者活动专用群", groupName: "省志愿者活动专用群",
...this.users, ...this.users,