mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix: 修复代码生成异常提示
This commit is contained in:
@ -88,7 +88,14 @@ export function useDownload() {
|
||||
Clientid: clientId!
|
||||
}
|
||||
})
|
||||
.then(async response => response.blob())
|
||||
.then(async response => {
|
||||
if (response.headers.get('Content-Type')?.includes('application/json')) {
|
||||
const res = await response.json();
|
||||
const code = res.code as CommonType.ErrorCode;
|
||||
throw new Error(errorCodeRecord[code] || res.msg || errorCodeRecord.default);
|
||||
}
|
||||
return response.blob();
|
||||
})
|
||||
.then(data => downloadByData(data, fileName, 'application/zip'))
|
||||
.catch(err => window.$message?.error(err.message))
|
||||
.finally(() => window.$loading?.endLoading());
|
||||
|
@ -53,6 +53,10 @@ export function useFormRules() {
|
||||
};
|
||||
}
|
||||
|
||||
function createNumberRequiredRule(message: string): App.Global.FormRule {
|
||||
return { ...createRequiredRule(message), type: 'number' };
|
||||
}
|
||||
|
||||
/** create a rule for confirming the password */
|
||||
function createConfirmPwdRule(pwd: string | Ref<string> | ComputedRef<string>) {
|
||||
const confirmPwdRule: App.Global.FormRule[] = [
|
||||
@ -76,7 +80,8 @@ export function useFormRules() {
|
||||
formRules,
|
||||
defaultRequiredRule,
|
||||
createRequiredRule,
|
||||
createConfirmPwdRule
|
||||
createConfirmPwdRule,
|
||||
createNumberRequiredRule
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user