@uxda/appkit 1.2.36 → 1.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appkit.css +144 -0
- package/dist/index.js +641 -212
- package/package.json +1 -1
- package/src/components/dd-notice-bar/index.vue +78 -76
- package/src/components/dd-search/doc.md +34 -0
- package/src/components/dd-search/index.vue +172 -0
- package/src/index.ts +14 -14
- package/src/notice/api/endpoints.ts +17 -0
- package/src/notice/api/index.ts +82 -0
- package/src/notice/components/LoginSetting.vue +116 -0
- package/src/notice/components/NoticeBanner.vue +290 -0
- package/src/notice/components/NoticePopup.vue +156 -0
- package/src/notice/components/NoticeView.vue +134 -0
- package/src/notice/components/index.ts +4 -0
- package/src/notice/components/useNotice.ts +35 -0
- package/src/notice/index.ts +1 -0
- package/src/shared/components/DeviceVersion.vue +67 -67
- package/src/shared/composables/useSafeArea.ts +8 -6
package/package.json
CHANGED
|
@@ -1,76 +1,78 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
text
|
|
4
|
-
style?: {} | string
|
|
5
|
-
showClose?: boolean
|
|
6
|
-
}>()
|
|
7
|
-
|
|
8
|
-
const emit = defineEmits(['close', 'txtClick'])
|
|
9
|
-
function close() {
|
|
10
|
-
emit('close')
|
|
11
|
-
}
|
|
12
|
-
function txtClick() {
|
|
13
|
-
emit('txtClick')
|
|
14
|
-
}
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<div class="dd-notice-bar" :class="{ close: showClose }" :style="style">
|
|
19
|
-
<div class="dd-notice-bar__txt" name="text" @click="txtClick">
|
|
20
|
-
<span v-if="text">{{ text }}</span>
|
|
21
|
-
<slot></slot>
|
|
22
|
-
</div>
|
|
23
|
-
<div v-if="showClose" class="dd-notice-bar__close" @click="close">
|
|
24
|
-
<img
|
|
25
|
-
src="https://cdn.ddjf.com/static/images/wechat-yunservice/close-icon.png"
|
|
26
|
-
class="dd-notice-bar__close-img"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<style lang="scss">
|
|
33
|
-
.dd-notice-bar {
|
|
34
|
-
position: fixed;
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
z-index: 10;
|
|
38
|
-
font-size: 13px;
|
|
39
|
-
color: #ea5959;
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
width: 100%;
|
|
44
|
-
min-height: 30px;
|
|
45
|
-
line-height: 18px;
|
|
46
|
-
padding: 6px 18px;
|
|
47
|
-
background: #ffe8d8;
|
|
48
|
-
box-sizing: border-box;
|
|
49
|
-
&__close {
|
|
50
|
-
width: 22px;
|
|
51
|
-
height: 22px;
|
|
52
|
-
display: flex;
|
|
53
|
-
margin-right: -6px;
|
|
54
|
-
margin-left: 6px;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
align-items: center;
|
|
57
|
-
&-img {
|
|
58
|
-
width: 10px;
|
|
59
|
-
height: 10px;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
&.close {
|
|
63
|
-
justify-content: space-between;
|
|
64
|
-
color: #fb970c;
|
|
65
|
-
background: #fff2d8;
|
|
66
|
-
.dd-notice-bar__txt {
|
|
67
|
-
text-align: left;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
&__txt {
|
|
71
|
-
flex: 1;
|
|
72
|
-
text-align: center;
|
|
73
|
-
opacity: 0.8;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
text?: string
|
|
4
|
+
style?: {} | string
|
|
5
|
+
showClose?: boolean
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(['close', 'txtClick'])
|
|
9
|
+
function close() {
|
|
10
|
+
emit('close')
|
|
11
|
+
}
|
|
12
|
+
function txtClick() {
|
|
13
|
+
emit('txtClick')
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="dd-notice-bar" :class="{ close: showClose }" :style="style">
|
|
19
|
+
<div class="dd-notice-bar__txt" name="text" @click="txtClick">
|
|
20
|
+
<span v-if="text">{{ text }}</span>
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div v-if="showClose" class="dd-notice-bar__close" @click="close">
|
|
24
|
+
<img
|
|
25
|
+
src="https://cdn.ddjf.com/static/images/wechat-yunservice/close-icon.png"
|
|
26
|
+
class="dd-notice-bar__close-img"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style lang="scss">
|
|
33
|
+
.dd-notice-bar {
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
z-index: 10;
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
color: #ea5959;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
width: 100%;
|
|
44
|
+
min-height: 30px;
|
|
45
|
+
line-height: 18px;
|
|
46
|
+
padding: 6px 18px;
|
|
47
|
+
background: #ffe8d8;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
&__close {
|
|
50
|
+
width: 22px;
|
|
51
|
+
height: 22px;
|
|
52
|
+
display: flex;
|
|
53
|
+
margin-right: -6px;
|
|
54
|
+
margin-left: 6px;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
&-img {
|
|
58
|
+
width: 10px;
|
|
59
|
+
height: 10px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
&.close {
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
color: #fb970c;
|
|
65
|
+
background: #fff2d8;
|
|
66
|
+
.dd-notice-bar__txt {
|
|
67
|
+
text-align: left;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
&__txt {
|
|
71
|
+
flex: 1;
|
|
72
|
+
text-align: center;
|
|
73
|
+
opacity: 0.8;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ddSearch 搜索框
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
## 使用
|
|
5
|
+
|
|
6
|
+
``` javascript
|
|
7
|
+
import ddSearch from '~/components/ddSearch/index.vue'
|
|
8
|
+
```
|
|
9
|
+
``` html
|
|
10
|
+
<dd-search
|
|
11
|
+
:bordered="false"
|
|
12
|
+
:inNavbar="true"
|
|
13
|
+
:value="searchStr"
|
|
14
|
+
placeholder="输入客户姓名"
|
|
15
|
+
@search="onSearch"
|
|
16
|
+
@focus="onSearchFocus" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Prop
|
|
20
|
+
|
|
21
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
22
|
+
|-----------|-------------|---------|----------|
|
|
23
|
+
| disabled | 是否禁用 | boolean | false |
|
|
24
|
+
| placeholder | 输入框placeholder | string | '请输入' |
|
|
25
|
+
| value | 绑定值 | string | '' |
|
|
26
|
+
| bordered | 是否显示底部边框 | boolean | true |
|
|
27
|
+
| inNavbar | 是否在导航栏中 | boolean | false |
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
|
|
31
|
+
| 事件名 | 说明 | 回调参数 |
|
|
32
|
+
|----------|----------------|--------------------|
|
|
33
|
+
| search | 点击搜索时 | value, 搜索参数 |
|
|
34
|
+
| focus | 输入框focus | event |
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watchPostEffect } from 'vue'
|
|
3
|
+
|
|
4
|
+
interface SearchType {
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
placeholder?: string
|
|
7
|
+
value?: string
|
|
8
|
+
bordered?: boolean
|
|
9
|
+
inNavbar?: boolean
|
|
10
|
+
focus?: boolean
|
|
11
|
+
}
|
|
12
|
+
const props = withDefaults(defineProps<SearchType>(), {
|
|
13
|
+
disabled: false,
|
|
14
|
+
placeholder: '',
|
|
15
|
+
bordered: true,
|
|
16
|
+
inNavbar: false,
|
|
17
|
+
focus: true,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
watchPostEffect(() => {
|
|
21
|
+
key.value = props.value ?? ''
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits(['search', 'focus', 'clear'])
|
|
25
|
+
|
|
26
|
+
const ph = computed(() => {
|
|
27
|
+
return props.placeholder || '请输入'
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const key = ref('')
|
|
31
|
+
const showClear = computed(() => {
|
|
32
|
+
return !!key.value.trim()
|
|
33
|
+
})
|
|
34
|
+
function onClear() {
|
|
35
|
+
key.value = ''
|
|
36
|
+
emit('clear', '')
|
|
37
|
+
}
|
|
38
|
+
function onConfirm() {
|
|
39
|
+
if (props.disabled) return
|
|
40
|
+
// if (key.value.trim()) {
|
|
41
|
+
key.value = key.value.trim()
|
|
42
|
+
emit('search', key.value)
|
|
43
|
+
// }
|
|
44
|
+
}
|
|
45
|
+
function onFoucs(e) {
|
|
46
|
+
isFoucs.value = true
|
|
47
|
+
emit('focus', e)
|
|
48
|
+
}
|
|
49
|
+
function onBlur() {
|
|
50
|
+
isFoucs.value = false
|
|
51
|
+
}
|
|
52
|
+
const isFoucs = ref(props.focus)
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<div
|
|
57
|
+
class="dd-search"
|
|
58
|
+
:class="{
|
|
59
|
+
disabled: props.disabled,
|
|
60
|
+
bordered: props.bordered,
|
|
61
|
+
inNavbar: props.inNavbar,
|
|
62
|
+
focus: !props.disabled && isFoucs,
|
|
63
|
+
}"
|
|
64
|
+
>
|
|
65
|
+
<div class="dd-search__form">
|
|
66
|
+
<div class="dd-search__prefix">
|
|
67
|
+
<image
|
|
68
|
+
class="full-img"
|
|
69
|
+
src="https://cdn.ddjf.com/static/images/wx-yunservice/search-icon.png"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="dd-search__control">
|
|
73
|
+
<input
|
|
74
|
+
class="dd-search__input"
|
|
75
|
+
type="text"
|
|
76
|
+
:disabled="props.disabled"
|
|
77
|
+
:placeholder="ph"
|
|
78
|
+
v-model="key"
|
|
79
|
+
:focus="props.focus"
|
|
80
|
+
placeholder-class="dd-search__placeholder"
|
|
81
|
+
cursor-spacing="50"
|
|
82
|
+
confirm-type="search"
|
|
83
|
+
@confirm="onConfirm"
|
|
84
|
+
@focus="onFoucs"
|
|
85
|
+
@blur="onBlur"
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="dd-search__suffix" v-show="showClear" @tap="onClear">
|
|
89
|
+
<image
|
|
90
|
+
class="full-img"
|
|
91
|
+
src="https://cdn.ddjf.com/static/images/wx-yunservice/clear-icon.png"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div v-if="!props.inNavbar" class="dd-search__btn" @click.stop="onConfirm">搜索</div>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<style lang="scss">
|
|
100
|
+
.dd-search {
|
|
101
|
+
padding: 8px 12px;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
background: #fefefe;
|
|
105
|
+
&.bordered {
|
|
106
|
+
border-bottom: 1px solid #ddd;
|
|
107
|
+
}
|
|
108
|
+
&.inNavbar {
|
|
109
|
+
padding: 0;
|
|
110
|
+
width: 235px;
|
|
111
|
+
z-index: 10;
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: 40px;
|
|
114
|
+
background: transparent;
|
|
115
|
+
.dd-search__form {
|
|
116
|
+
background: $bg-default;
|
|
117
|
+
border-color: transparent;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
&.focus {
|
|
121
|
+
.dd-search__form {
|
|
122
|
+
border-color: $primary-color;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
&__placeholder {
|
|
126
|
+
color: #b4b4b4;
|
|
127
|
+
}
|
|
128
|
+
&__form {
|
|
129
|
+
flex: 1;
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
height: 36px;
|
|
132
|
+
//border: 1px solid rgba(180, 180, 180, 0.2);
|
|
133
|
+
border-radius: 5px;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
padding: 0 10px;
|
|
137
|
+
background-color: #f1f3f5;
|
|
138
|
+
}
|
|
139
|
+
&__control {
|
|
140
|
+
font-size: 13px;
|
|
141
|
+
flex: 1;
|
|
142
|
+
}
|
|
143
|
+
&__input {
|
|
144
|
+
width: 100%;
|
|
145
|
+
box-sizing: border-box;
|
|
146
|
+
padding: 0 10px;
|
|
147
|
+
caret-color: var(--second-color);
|
|
148
|
+
}
|
|
149
|
+
&__prefix,
|
|
150
|
+
&__suffix {
|
|
151
|
+
width: 15px !important;
|
|
152
|
+
height: 15px !important;
|
|
153
|
+
}
|
|
154
|
+
&__btn {
|
|
155
|
+
height: 33px;
|
|
156
|
+
line-height: 33px;
|
|
157
|
+
padding: 0 10px;
|
|
158
|
+
font-size: var(--primary-size);
|
|
159
|
+
color: var(--second-color);
|
|
160
|
+
}
|
|
161
|
+
&.disabled &__suffix {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
//&.disabled &__btn {
|
|
165
|
+
// display: none;
|
|
166
|
+
//}
|
|
167
|
+
&.disabled &__control {
|
|
168
|
+
flex: 1;
|
|
169
|
+
width: fit-content;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { App } from 'vue'
|
|
2
2
|
import { components as paymentComponents } from './payment/components'
|
|
3
3
|
import { services as paymentServices } from './payment'
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from '@nutui/nutui-taro'
|
|
4
|
+
import // Grid,
|
|
5
|
+
// GridItem,
|
|
6
|
+
// Button,
|
|
7
|
+
// Checkbox,
|
|
8
|
+
// Popup,
|
|
9
|
+
// OverLay,
|
|
10
|
+
// DatePicker,
|
|
11
|
+
// Form,
|
|
12
|
+
// FormItem,
|
|
13
|
+
// Cell,
|
|
14
|
+
// CellGroup,
|
|
15
|
+
// Dialog
|
|
16
|
+
'@nutui/nutui-taro'
|
|
18
17
|
import { type AppKitOptions, useAppKitOptions, DollarApp } from './Appkit'
|
|
19
18
|
import { PaymentParams, RechargeParams } from './payment/types'
|
|
20
19
|
import './main.scss'
|
|
@@ -85,4 +84,5 @@ export * from './payment'
|
|
|
85
84
|
export * from './balance'
|
|
86
85
|
export * from './shared'
|
|
87
86
|
export * from './register'
|
|
87
|
+
export * from './notice'
|
|
88
88
|
export { type AppKitOptions }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HttpEndpoints } from '../../shared/http'
|
|
2
|
+
|
|
3
|
+
const endpointsList: HttpEndpoints = {}
|
|
4
|
+
|
|
5
|
+
const endpoints = Object.fromEntries(
|
|
6
|
+
Object.entries(endpointsList).map(([name, def]) => [name, def.path])
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
const translates = Object.fromEntries(
|
|
10
|
+
Object.entries(endpointsList).map(([, def]) => [def.path, def.translate])
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
const transforms = Object.fromEntries(
|
|
14
|
+
Object.entries(endpointsList).map(([, def]) => [def.path, def.transform])
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export { endpoints, translates, transforms }
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
|
+
import { HttpRequestConfig, PagingData, PagingParams, ResponseRaw, createHttp } from '../../shared'
|
|
3
|
+
import { translates, transforms } from './endpoints'
|
|
4
|
+
import { useAppKitOptions } from '../../Appkit'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 小程序端 Http
|
|
8
|
+
* 使用 Taro.request 实现
|
|
9
|
+
*/
|
|
10
|
+
const vendor = {
|
|
11
|
+
async request<T>(config: HttpRequestConfig) {
|
|
12
|
+
return new Promise<ResponseRaw<T>>((resolve, reject) => {
|
|
13
|
+
Taro.request({
|
|
14
|
+
url: config.url,
|
|
15
|
+
method: config.method,
|
|
16
|
+
header: config.headers,
|
|
17
|
+
data: config.data,
|
|
18
|
+
})
|
|
19
|
+
.then(({ data }) => {
|
|
20
|
+
resolve({
|
|
21
|
+
status: +data.code,
|
|
22
|
+
message: data.msg,
|
|
23
|
+
data: data.result as T,
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
.catch((e: any) => {
|
|
27
|
+
reject(e)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function useHttp() {
|
|
34
|
+
const appkitOptions = useAppKitOptions()
|
|
35
|
+
const headers = {
|
|
36
|
+
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
37
|
+
Appcode: appkitOptions.app(),
|
|
38
|
+
cookie: `tid=${appkitOptions.tenant()}`,
|
|
39
|
+
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 传入配置获取 Http instanse
|
|
43
|
+
*/
|
|
44
|
+
const $http = createHttp({
|
|
45
|
+
vendor,
|
|
46
|
+
baseUrl: appkitOptions.baseUrl(),
|
|
47
|
+
headers,
|
|
48
|
+
interceptors: [
|
|
49
|
+
(raw) => {
|
|
50
|
+
if (raw.status == 401) {
|
|
51
|
+
appkitOptions[401]()
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
return false
|
|
55
|
+
},
|
|
56
|
+
(raw) => {
|
|
57
|
+
if (raw.status > 500 && raw.status != 51014) {
|
|
58
|
+
return true
|
|
59
|
+
}
|
|
60
|
+
return false
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
paging: {
|
|
64
|
+
translate: (params: PagingParams) => ({
|
|
65
|
+
pageNum: params.page,
|
|
66
|
+
pageSize: params.pageSize,
|
|
67
|
+
}),
|
|
68
|
+
transform(data: any): PagingData {
|
|
69
|
+
return {
|
|
70
|
+
totalPages: data.pages,
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
translates,
|
|
75
|
+
transforms,
|
|
76
|
+
})
|
|
77
|
+
return $http
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { useHttp }
|
|
81
|
+
|
|
82
|
+
export * from './endpoints'
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="login-setting" :style="style" v-if="show && showLoginRule">
|
|
3
|
+
<img
|
|
4
|
+
class="login-setting-img"
|
|
5
|
+
src="https://cdn.ddjf.com/static/images/nutshell/empty-permission.png"
|
|
6
|
+
/>
|
|
7
|
+
<div class="login-setting-text">
|
|
8
|
+
仅可在工作日{{ loginRule.startTime }}-{{ loginRule.endTime }}进行业务操作
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { computed, onMounted, ref } from 'vue'
|
|
15
|
+
import { useHttp } from '../api'
|
|
16
|
+
import { useAppKitOptions } from '../../Appkit'
|
|
17
|
+
import { useSafeArea } from '../../shared/composables'
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<{
|
|
21
|
+
app: string
|
|
22
|
+
withTabbar?: boolean
|
|
23
|
+
withNavbar?: boolean
|
|
24
|
+
show?: boolean
|
|
25
|
+
}>(),
|
|
26
|
+
{
|
|
27
|
+
app: '',
|
|
28
|
+
withTabbar: false,
|
|
29
|
+
withNavbar: false,
|
|
30
|
+
show: true,
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const safeArea = useSafeArea()
|
|
35
|
+
const loginRule = ref<any>({})
|
|
36
|
+
const showLoginRule = ref<boolean>(false)
|
|
37
|
+
|
|
38
|
+
const style = computed(() => {
|
|
39
|
+
let str = ''
|
|
40
|
+
if (props.withTabbar) {
|
|
41
|
+
str += `bottom: ${safeArea.menuRect.bottom + 5}px;`
|
|
42
|
+
}
|
|
43
|
+
if (props.withNavbar) {
|
|
44
|
+
str += `top: ${safeArea.nav + safeArea.status + 5}px;`
|
|
45
|
+
}
|
|
46
|
+
return str
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
checkLoginTimeRule()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// 检验登录时间
|
|
54
|
+
async function checkLoginTimeRule() {
|
|
55
|
+
const appkitOptions = useAppKitOptions()
|
|
56
|
+
|
|
57
|
+
const $http = useHttp()
|
|
58
|
+
$http
|
|
59
|
+
.post('/cas/sysUser/checkLoginTimeRule', {
|
|
60
|
+
appCode: props.app || appkitOptions.app(),
|
|
61
|
+
tenantId: appkitOptions.tenant(),
|
|
62
|
+
})
|
|
63
|
+
.then((result: any) => {
|
|
64
|
+
if (result === true) return
|
|
65
|
+
|
|
66
|
+
getLoginRule()
|
|
67
|
+
showLoginRule.value = true
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 查询当前租户登录规则
|
|
72
|
+
async function getLoginRule() {
|
|
73
|
+
const appkitOptions = useAppKitOptions()
|
|
74
|
+
|
|
75
|
+
const $http = useHttp()
|
|
76
|
+
$http
|
|
77
|
+
.get('/cas/sysUser/getLoginRule', {
|
|
78
|
+
appCode: props.app || appkitOptions.app(),
|
|
79
|
+
})
|
|
80
|
+
.then((result) => {
|
|
81
|
+
loginRule.value = result
|
|
82
|
+
|
|
83
|
+
emits('show', { startTime: loginRule.value.startTime, endTime: loginRule.value.endTime })
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 父组件事件
|
|
88
|
+
const emits = defineEmits(['show'])
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style lang="scss">
|
|
92
|
+
.login-setting {
|
|
93
|
+
position: fixed;
|
|
94
|
+
z-index: 4;
|
|
95
|
+
left: 12px;
|
|
96
|
+
top: 10px;
|
|
97
|
+
bottom: 10px;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
width: calc(100% - 24px);
|
|
101
|
+
background: #ffffff;
|
|
102
|
+
border-radius: 5px;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
&-img {
|
|
106
|
+
height: 111px;
|
|
107
|
+
width: 198px;
|
|
108
|
+
}
|
|
109
|
+
&-text {
|
|
110
|
+
margin-top: 10px;
|
|
111
|
+
color: #353535;
|
|
112
|
+
opacity: 0.4;
|
|
113
|
+
font-size: 12px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</style>
|