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", {