-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
82 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import { ElMessageBox, ElMessageBoxOptions } from 'element-plus' | ||
import { useI18n } from '@/hooks/useI18n' | ||
import { ElMessageBox, ElMessageBoxOptions } from 'element-plus'; | ||
import { useI18n } from '@/hooks/useI18n'; | ||
|
||
const { t } = useI18n() | ||
const { t } = useI18n(); | ||
|
||
function createElMessageBox( | ||
message: string, | ||
title: string, | ||
options: ElMessageBoxOptions | ||
) { | ||
console.log(title) | ||
ElMessageBox.confirm(message, title, options) | ||
.then(() => {}) | ||
.catch(() => {}) | ||
function createElMessageBox(message: string, title: string, options: ElMessageBoxOptions) { | ||
console.log(title); | ||
ElMessageBox.confirm(message, title, options) | ||
.then(() => {}) | ||
.catch(() => {}); | ||
} | ||
|
||
function createErrorModal(message: string) { | ||
createElMessageBox(message, t('sys.errorTip'), { | ||
confirmButtonText: t('sys.okText'), | ||
cancelButtonText: 'Cancel', | ||
type: 'error', | ||
}) | ||
createElMessageBox(message, t('sys.errorTip'), { | ||
confirmButtonText: t('sys.okText'), | ||
cancelButtonText: t('sys.closeText'), | ||
type: 'error', | ||
}); | ||
} | ||
|
||
export function useMessage() { | ||
return { | ||
createErrorModal, | ||
} | ||
return { | ||
createErrorModal, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const config = import.meta.globEager('./modules/*.ts'); | ||
|
||
const messages: Recordable = {}; | ||
Object.keys(config).forEach((key) => { | ||
const name: RegExpMatchArray = key.match(/^\.\/([\s\S]+)\/([\s\S]+)\.ts$/) || []; | ||
const valueName = name[2]; | ||
const value = config[key].default || {}; | ||
messages[valueName] = value; | ||
}); | ||
|
||
export const name = 'English'; | ||
|
||
export default messages; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const config = import.meta.globEager('./modules/*.ts'); | ||
|
||
const messages: Recordable = {}; | ||
|
||
Object.keys(config).forEach((key) => { | ||
const name: RegExpMatchArray = key.match(/^\.\/([\s\S]+)\/([\s\S]+)\.ts$/) || []; | ||
const valueName = name[2]; | ||
const value = config[key].default || {}; | ||
messages[valueName] = value; | ||
}); | ||
|
||
export const name = '中文简体'; | ||
|
||
export default messages; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined | ||
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined; | ||
export interface RequestOptions { | ||
// 是否只放回data数据 | ||
isShowData?: boolean | ||
// 网址前缀 留空使用默认 | ||
urlPrefix?: string | ||
// 设置token | ||
specialToken?: string | ||
// 是否开启自定义请求报错提示 | ||
errorMassge?: boolean | ||
// 是否携带token | ||
withToken?: boolean | ||
// 错误消息提示类型 | ||
errorMessageMode?: ErrorMessageMode | ||
// 是否只放回data数据 | ||
isShowData?: boolean; | ||
// 网址前缀 留空使用默认 | ||
urlPrefix?: string; | ||
// 设置token | ||
specialToken?: string; | ||
// 是否开启自定义请求报错提示 | ||
errorMassge?: boolean; | ||
// 是否携带token | ||
withToken?: boolean; | ||
// 错误消息提示类型 | ||
errorMessageMode?: ErrorMessageMode; | ||
} | ||
export interface Result<T = any> { | ||
code: number | ||
message: string | ||
data: T | ||
code: number; | ||
message: string; | ||
data: T; | ||
} |