| 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 | | /** |  |  * 弹出系统内置的toast |  |  */ |  | function toast(title, mask = false, cb = null, icon = 'none', duration = 1500) { |  |   uni.showToast({ |  |     title: title, |  |     icon: icon, |  |     mask: mask, |  |     duration: duration, |  |     success: () => { |  |       setTimeout(() => { |  |         cb && cb() |  |       }, duration) |  |     } |  |   }) |  | } |  |   |  | /** |  |  * 弹出内置的加载框 |  |  */ |  | function loading(title) { |  |   uni.showLoading({ |  |     title: title, |  |     mask: true |  |   }) |  | } |  |   |  | /** |  |  * 弹出系统内置的modal |  |  */ |  | function modal(title, |  |   content, |  |   confirmCb, |  |   showCancel = false, |  |   cancelCb = null, |  |   confirmText = "确定", |  |   cancelText = "取消") { |  |   uni.showModal({ |  |     title: title, |  |     content: content, |  |     showCancel: showCancel, |  |     cancelText: cancelText, |  |     confirmText: confirmText, |  |     success: (res) => { |  |       if (res.cancel) { |  |         cancelCb && cancelCb() |  |       } else if (res.confirm) { |  |         confirmCb && confirmCb() |  |       } |  |     } |  |   }) |  | } |  |   |  | /** |  |  * 关闭系统内置toast |  |  */ |  | function closeToast() { |  |   uni.hideToast() |  | } |  |   |  | /** |  |  * 关闭系统内置的加载框 |  |  */ |  | function closeLoading() { |  |   uni.hideLoading() |  | } |  |   |  | export default { |  |   toast, |  |   loading, |  |   modal, |  |   closeToast, |  |   closeLoading |  | } | 
 |