diff --git a/bin/serve.js b/bin/serve.js index b56e9305..13057bf8 100644 --- a/bin/serve.js +++ b/bin/serve.js @@ -13,7 +13,7 @@ const getFileInfo = (app, file) => { } if (/^App/.test(app.name) && app.label) { let {name, label} = app, - path = app.path.replace(/.+[\\\/]([^\\\/]+)[\\\/]([^\\\/]+)$/g, `/apps/$1/$2`) + path = app.path.replace(/.+[\\\/]([^\\\/]+)[\\\/]([^\\\/]+)$/g, `/apps/$1/$2`) apps.list.push({ id: file.replace(/\.\/?(vue)?/g, '').replace(/[\\\/]/g, '_'), name, @@ -28,9 +28,7 @@ const saveApps = app => { if (app.list.length > 0) { axios.post("http://dvcp.sinoecare.net/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => { if (res.data.code == 0) chalkTag.done("产品库目录已同步至后台数据库...") - }).catch(err => { - console.log(err) - }) + }).catch(err => 0) } } diff --git a/src/apps/AppOpenChat/AppOpenChat.vue b/src/apps/AppOpenChat/AppOpenChat.vue index ce6b23fd..7a421a4a 100644 --- a/src/apps/AppOpenChat/AppOpenChat.vue +++ b/src/apps/AppOpenChat/AppOpenChat.vue @@ -38,19 +38,32 @@ export default { } }), ]) - + }, + handleCreateSuccess() { + const {groupName} = this.$route.query + wx.openEnterpriseChat({ + externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ", + groupName, + ...this.users, + success: res => { + if (res?.chatId) { + this.handleCreateQrCode(res.chatId) + } + } + }) + }, + handleCreateQrCode(groupId) { + const {activityType, activityId, groupName} = this.$route.query + this.$http.post("/wxcp/wxgroup/createGroupQrCode", null, { + params: { + groupId, activityType, activityId, groupName + } + }) } }, created() { this.injectJWeixin("openEnterpriseChat").then(() => this.$confirm("确定创建省志愿者活动专用群聊?")) - .then(this.getUsers).then(() => { - console.log(this.users) - wx.openEnterpriseChat({ - externalUserIds: "wmGBFVDgAAj_krfwaThRm-RRAq9rBeaQ", - groupName: "省志愿者活动专用群", - ...this.users, - }) - }).catch(() => 0) + .then(this.getUsers).then(this.handleCreateSuccess).catch(() => 0) } }