Files
zyt/TUICallKit-Vue3/TUIKit/states/TUICallService/CallService/UIKitModal.ts
T
2026-03-11 09:49:47 +08:00

46 lines
1.0 KiB
TypeScript

import { UIKitModal } from '../../../components/UIKitModal'
const MINI_MODAL_ERROR_CODES = [
-1001,
-1002,
101002,
];
const MINI_MODAL_ERROR_MAP = {
'-1001': {
id: 10001,
content: '您的应用还未开通音视频通话能力'
},
'-1002': {
id: 10002,
content: '您暂不支持使用该能力,请前往购买页购买开通'
},
'101002': {
id: 10014,
content: '发起通话失败,用户 ID 无效,请确认该用户已注册'
}
}
export function handleModalError(error) {
if (!error || !error?.code) {
return;
}
handleMiniModalError(error);
}
function handleMiniModalError(error) {
if (!MINI_MODAL_ERROR_CODES.includes(error.code)) {
return;
}
const errorInfo = MINI_MODAL_ERROR_MAP[error.code.toString()];
if (errorInfo) {
UIKitModal.openModal({
id: errorInfo.id,
content: errorInfo.content,
title: '错误',
type: 'error'
});
}
}