'a'
mh-two-thousand-and-two
2024-04-12 44d2c92345cd156a59fc327b3060292a282d2893
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import {
  capitalize
} from 'uni-shared'
 
function showWindow (type, show) {
  const api = show ? 'show' : 'hide' + capitalize(type) + 'Window'
  const app = getApp()
  if (app) {
    const msg = app.$children[0].$refs.layout.showWindow(type, show)
    if (msg) {
      return {
        errMsg: `${api}:fail ${msg}`
      }
    }
    return {}
  }
  return {
    errMsg: `${api}:fail app not ready`
  }
}
 
export function showTopWindow () {
  return showWindow('top', true)
}
 
export function hideTopWindow () {
  return showWindow('top', false)
}
 
export function showLeftWindow () {
  return showWindow('left', true)
}
 
export function hideLeftWindow () {
  return showWindow('left', false)
}
export function showRightWindow () {
  return showWindow('right', true)
}
 
export function hideRightWindow () {
  return showWindow('right', false)
}
 
function getWindowStyle (type) {
  const api = 'get' + capitalize(type) + 'WindowStyle'
  const app = getApp()
  if (!app) {
    return {
      errMsg: `${api}:fail app not ready`
    }
  }
  const msg = app.$children[0].$refs.layout.getWindowStyle(type)
  if (typeof msg === 'string' && msg.indexOf('Window not found') !== -1) {
    return {
      errMsg: `${api}:fail ${msg}`
    }
  }
  return msg
}
 
export function getTopWindowStyle (style) {
  return getWindowStyle('top')
}
export function getLeftWindowStyle (style) {
  return getWindowStyle('left')
}
export function getRightWindowStyle (style) {
  return getWindowStyle('right')
}
 
function setWindowStyle (type, style) {
  const api = 'set' + capitalize(type) + 'WindowStyle'
  const app = getApp()
  if (!app) {
    return {
      errMsg: `${api}:fail app not ready`
    }
  }
  const msg = app.$children[0].$refs.layout.setWindowStyle(type, style)
  if (msg) {
    return {
      errMsg: `${api}:fail ${msg}`
    }
  }
  return {}
}
 
export function setTopWindowStyle (style) {
  return setWindowStyle('top', style)
}
export function setLeftWindowStyle (style) {
  return setWindowStyle('left', style)
}
export function setRightWindowStyle (style) {
  return setWindowStyle('right', style)
}