2022-09-29 09:41:02 +08:00
|
|
|
<template>
|
|
|
|
|
<section class="AppOpenChat">
|
2022-09-29 10:39:41 +08:00
|
|
|
<AiLoading tips="正在处理..."/>
|
2022-09-29 09:41:02 +08:00
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-09-29 10:39:41 +08:00
|
|
|
import {mapActions, mapState} from "vuex"
|
2022-09-29 09:41:02 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "AppOpenChat",
|
|
|
|
|
appName: "创建群聊",
|
2022-09-29 10:39:41 +08:00
|
|
|
computed: {
|
|
|
|
|
...mapState(['user'])
|
|
|
|
|
},
|
2022-09-29 09:41:02 +08:00
|
|
|
data() {
|
2022-09-29 10:39:41 +08:00
|
|
|
return {
|
|
|
|
|
users: {}
|
|
|
|
|
}
|
2022-09-29 09:41:02 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2022-11-22 19:16:02 +08:00
|
|
|
...mapActions(['injectJWeixin', 'getAccount']),
|
2022-09-29 10:39:41 +08:00
|
|
|
getUsers() {
|
|
|
|
|
return Promise.all([
|
2022-09-29 11:34:32 +08:00
|
|
|
// 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).join(";")
|
|
|
|
|
// }
|
|
|
|
|
// }),
|
2022-09-29 10:39:41 +08:00
|
|
|
this.$http.post("/app/wxcp/wxcustomer/list", null, {
|
|
|
|
|
params: {
|
|
|
|
|
wxUserId: this.user.wxUserId
|
|
|
|
|
}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res?.data) {
|
2022-09-29 11:34:32 +08:00
|
|
|
return this.users.externalUserIds = res.data.records?.filter(e => e.type == 1)?.map(e => e.id).join(";")
|
2022-09-29 10:39:41 +08:00
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
])
|
2022-11-22 10:29:49 +08:00
|
|
|
},
|
|
|
|
|
handleCreateSuccess() {
|
|
|
|
|
const {groupName} = this.$route.query
|
2022-09-29 09:41:02 +08:00
|
|
|
wx.openEnterpriseChat({
|
|
|
|
|
externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ",
|
2022-11-22 10:29:49 +08:00
|
|
|
groupName,
|
2022-09-29 10:39:41 +08:00
|
|
|
...this.users,
|
2022-11-22 10:29:49 +08:00
|
|
|
success: res => {
|
|
|
|
|
if (res?.chatId) {
|
|
|
|
|
this.handleCreateQrCode(res.chatId)
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-29 09:41:02 +08:00
|
|
|
})
|
2022-11-22 10:29:49 +08:00
|
|
|
},
|
|
|
|
|
handleCreateQrCode(groupId) {
|
|
|
|
|
const {activityType, activityId, groupName} = this.$route.query
|
2022-11-23 18:16:08 +08:00
|
|
|
this.$http.post("/api/wxcp/wxgroup/createGroupQrCode", null, {
|
2022-11-22 10:29:49 +08:00
|
|
|
params: {
|
|
|
|
|
groupId, activityType, activityId, groupName
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
2022-11-22 18:51:33 +08:00
|
|
|
this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm(`确定创建${this.$route.query.groupName}?`))
|
2022-11-22 19:16:02 +08:00
|
|
|
.then(this.getAccount).then(this.getUsers).then(this.handleCreateSuccess).catch(() => 0)
|
2022-09-29 09:41:02 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.AppOpenChat {
|
|
|
|
|
}
|
|
|
|
|
</style>
|