From 968015c43d615511d52a0d0f7adf99a6adc28e97 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 28 Jul 2022 11:00:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/modules.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/common/modules.js b/src/common/modules.js index c7ecb0f1..16e48452 100644 --- a/src/common/modules.js +++ b/src/common/modules.js @@ -267,14 +267,15 @@ export const wxwork = { sdk?.invoke(op?.[0], op?.[1], op?.[2]) }, 500) }, - previewFile({dispatch}, op) { + previewFile({dispatch, state}, op) { if (window.navigator.userAgent.indexOf("Windows NT") > -1) { uni.showToast({ title: "企业微信暂不支持PC端的预览文件!", icon: 'none' }) } else { - dispatch("injectJWeixin", "previewFile").then(() => { + const {corpId, suiteId} = state.config + dispatch('agentSign', {corpId, suiteId}).then(() => dispatch("injectJWeixin", "previewFile")).then(() => { setTimeout(() => { let sdk = typeof wx?.invoke == 'function' ? wx : jWeixin sdk?.invoke('previewFile', {...op}, res => { @@ -284,17 +285,19 @@ export const wxwork = { }) } }, - closeAgent({dispatch}) { - dispatch("injectJWeixin", "closeWindow").then(() => { + closeAgent({dispatch, state}) { + const {corpId, suiteId} = state.config + dispatch('agentSign', {corpId, suiteId}).then(() => dispatch("injectJWeixin", "closeWindow")).then(() => { setTimeout(() => { let sdk = typeof wx?.closeWindow == 'function' ? wx : jWeixin sdk?.closeWindow() }, 500) }) }, - selectEnterpriseContact({dispatch}, params) { + selectEnterpriseContact({dispatch, state}, params) { + const {corpId, suiteId} = state.config return new Promise((resolve, reject) => { - dispatch("injectJWeixin", "selectEnterpriseContact").then(() => { + dispatch('agentSign', {corpId, suiteId}).then(() => dispatch("injectJWeixin", "selectEnterpriseContact")).then(() => { setTimeout(() => { let sdk = typeof wx?.invoke == 'function' ? wx : jWeixin sdk?.invoke("selectEnterpriseContact", { @@ -316,9 +319,10 @@ export const wxwork = { }) }) }, - selectPrivilegedContact({dispatch}, params) { + selectPrivilegedContact({dispatch, state}, params) { + const {corpId, suiteId} = state.config return new Promise((resolve, reject) => { - dispatch("injectJWeixin", "selectPrivilegedContact").then(() => { + dispatch('agentSign', {corpId, suiteId}).then(() => dispatch("injectJWeixin", "selectPrivilegedContact")).then(() => { setTimeout(() => { let sdk = typeof wx?.invoke == 'function' ? wx : jWeixin sdk?.invoke("selectPrivilegedContact", {