appUtil.js
1.91 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function loadingBlock(status) {
if (status) {
document.querySelector('.error-block').style.display = 'none'
document.querySelector('.toast-loading').classList.remove('active')
document.querySelector('.skeleton-loading').classList.remove('active')
} else {
document.querySelector('.toast-loading').classList.add('active')
document.querySelector('.skeleton-loading').classList.add('active')
}
}
function appBlock(status) {
if (status) {
loadingBlock(false)
document.querySelector('.error-block').style.display = 'none'
document.querySelector('#app').classList.remove('fixed')
} else {
document.querySelector('#app').classList.add('fixed')
}
}
function errorBlock(img, str, retry) {
if (!document.querySelector('#app').classList.contains('fixed')) {
return
}
errorStatus = true
loadingBlock(false)
appBlock(false)
mobileApp(false)
if (retry) {
document.querySelector('.error-block-retry-btn').style.display = 'block'
if (window.config.VUE_BASE_NODE === 'dev') {
document.querySelector('.error-block-reload-btn').style.display = 'block'
}
} else {
document.querySelector('.error-block-retry-btn').style.display = 'none'
}
document.querySelector('.error-block').style.display = 'block'
document.querySelector('.error-block-image img').setAttribute('src', img)
document.querySelector('.error-block-description-title').innerText = str
changeContentHtmlHeight({ type: 'error' })
}
function mobileLoadingBlock(status) {
if (status) {
document.querySelector('.app-skeleton-loading').classList.remove('none')
} else {
document.querySelector('.app-skeleton-loading').classList.add('none')
}
}
function mobileApp(status) {
if (status) {
document.querySelector('.gx-mobile').classList.remove('fixed')
document.querySelector('.gx-mobile').classList.add('active')
} else {
document.querySelector('.gx-mobile').classList.add('fixed')
}
}