ErrorToastUtils.ets
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { ToastUtils } from './ToastUtils'
export namespace ErrorToastUtils {
export enum ErrorType {
NET_CORE_NO_NETWORK, //当前无网络,请重试
NET_CORE_WEAK_NETWORK, //当前无网络,请重试
NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试
NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试
NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试
LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络
}
export class ErrorToast {
static showToast(type: ErrorType) {
switch (type) {
case ErrorType.NET_CORE_NO_NETWORK:
ToastUtils.shortToast($r('app.string.net_core_no_network'))
break
case ErrorType.NET_CORE_WEAK_NETWORK:
ToastUtils.shortToast($r('app.string.net_core_no_network'))
break
case ErrorType.NET_CORE_PAGE_ERROR_NETWORK:
ToastUtils.shortToast($r('app.string.net_core_page_error_network'))
break
case ErrorType.NET_CORE_LOAD_ERROR_NETWORK:
ToastUtils.shortToast($r('app.string.net_core_load_fail_network'))
break
case ErrorType.NET_CORE_ENTER_ERROR_NETWORK:
ToastUtils.shortToast($r('app.string.net_core_enter_fail_network'))
break
case ErrorType.LIVE_CORE_NO_NETWORK:
ToastUtils.shortToast($r('app.string.live_core_no_network'))
break
}
}
}
}