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
|
| var SESSION_SUFFIX = "diniu_app_"
| export function showModal(message, title = '提示', iscancel = true) {
| return new Promise((resolve) => {
| uni.showModal({
| title: title,
| content: message,
| showCancel: iscancel,
| success: function(res) {
| if (res.confirm) {
| resolve(true)
| } else if (res.cancel) {
| resolve(false)
| }
| }
| });
| })
| }
|
| export function showToast(title, icon) {
| uni.showToast({
| title: title,
| icon: icon ? icon : 'none'
| })
| }
| export function showLoading(title) {
|
|
| uni.showLoading({
| title: title,
| mask: true
| })
|
| }
|
| export function hideLoading() {
|
| uni.hideLoading()
| }
|
| let session = {
| setValue(key, value) {
| let suffixStr = SESSION_SUFFIX
| if (value == null) {
| uni.removeStorageSync(suffixStr + key)
| } else {
| uni.setStorageSync(suffixStr + key, value);
| }
| },
|
| getValue(key) {
| let suffixStr = SESSION_SUFFIX
| return uni.getStorageSync(suffixStr + key) || null;
| },
|
| clearValue(key) {
| let suffixStr = SESSION_SUFFIX
| return uni.removeStorageSync(suffixStr + key);
| },
| }
| export {
| session
| }
|
|