(category: LoginCategory)
| 32 | 'https://lf1-cdn-tos.bytegoofy.com/goofy/lark/op/h5-js-sdk-1.5.16.js', |
| 33 | ] |
| 34 | export const loadClient = (category: LoginCategory) => { |
| 35 | const type = getQueryString('client') |
| 36 | const corpid = getQueryString('corpid') |
| 37 | if (type && !category[type as keyof LoginCategory]) { |
| 38 | ElMessageBox.confirm(t('login.platform_disable', [t(`user.${type}`)]), { |
| 39 | confirmButtonType: 'danger', |
| 40 | type: 'warning', |
| 41 | showCancelButton: false, |
| 42 | confirmButtonText: t('common.refresh'), |
| 43 | cancelButtonText: t('dataset.cancel'), |
| 44 | autofocus: false, |
| 45 | showClose: false, |
| 46 | }) |
| 47 | .then(() => { |
| 48 | window.location.reload() |
| 49 | }) |
| 50 | .catch(() => {}) |
| 51 | return false |
| 52 | } |
| 53 | if (!type || !flagArray.includes(type) || !category[type as keyof LoginCategory]) { |
| 54 | return false |
| 55 | } |
| 56 | const index = flagArray.indexOf(type) |
| 57 | const jsId = `fit2cloud-dataease-v2-platform-client-${type}` |
| 58 | const awaitMethod = loadScript(urlArray[index], jsId) |
| 59 | awaitMethod |
| 60 | .then(() => { |
| 61 | if (index === 0) { |
| 62 | dingtalkClientRequest(corpid) |
| 63 | } |
| 64 | if (index === 1) { |
| 65 | larkClientRequest() |
| 66 | } |
| 67 | if (index === 2) { |
| 68 | larksuiteClientRequest() |
| 69 | } |
| 70 | }) |
| 71 | .catch(() => { |
| 72 | ElMessage.error('加载失败') |
| 73 | }) |
| 74 | return true |
| 75 | } |
| 76 | |
| 77 | const dingtalkClientRequest = async (id: string | null) => { |
| 78 | if (!id) { |
nothing calls this directly
no test coverage detected