Files
dvcp_v2_wxcp_app/src/apps/AppOpenChat/AppOpenChat.vue

61 lines
1.4 KiB
Vue
Raw Normal View History

2022-09-29 09:41:02 +08:00
<template>
<section class="AppOpenChat">
<AiLoading tips="正在处理..."/>
2022-09-29 09:41:02 +08:00
</section>
</template>
<script>
import {mapActions, mapState} from "vuex"
2022-09-29 09:41:02 +08:00
export default {
name: "AppOpenChat",
appName: "创建群聊",
computed: {
...mapState(['user'])
},
2022-09-29 09:41:02 +08:00
data() {
return {
users: {}
}
2022-09-29 09:41:02 +08:00
},
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)
}
}),
])
}
2022-09-29 09:41:02 +08:00
},
created() {
this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm("确定创建省志愿者活动专用群聊?"))
.then(this.getUsers).then(() => {
2022-09-29 09:41:02 +08:00
wx.openEnterpriseChat({
2022-09-29 09:43:56 +08:00
userIds: "18507227517;AiXianLing",
2022-09-29 09:41:02 +08:00
externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ",
groupName: "省志愿者活动专用群",
...this.users,
2022-09-29 09:41:02 +08:00
})
}).catch(() => 0)
}
}
</script>
<style lang="scss" scoped>
.AppOpenChat {
}
</style>