@kengic/uni 0.3.2-beta.10

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.
Files changed (166) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
@@ -0,0 +1,517 @@
1
+ <template>
2
+ <view class="uni-stat__select">
3
+ <span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span>
4
+ <view class="uni-stat-box" :class="{'uni-stat__actived': current}">
5
+ <view class="uni-select" :class="{'uni-select--disabled':disabled}">
6
+ <view class="uni-select__input-box" @click="toggleSelector">
7
+ <view v-if="current" class="uni-select__input-text">{{current}}</view>
8
+ <view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
9
+ <view v-if="current && clear && !disabled" @click.stop="clearVal" >
10
+ <uni-icons type="clear" color="#c0c4cc" size="24"/>
11
+ </view>
12
+ <view v-else>
13
+ <uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
14
+ </view>
15
+ </view>
16
+ <view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
17
+ <view class="uni-select__selector" v-if="showSelector">
18
+ <view class="uni-popper__arrow"></view>
19
+ <scroll-view scroll-y="true" class="uni-select__selector-scroll">
20
+ <view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
21
+ <text>{{emptyTips}}</text>
22
+ </view>
23
+ <view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
24
+ @click="change(item)">
25
+ <text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
26
+ </view>
27
+ </scroll-view>
28
+ </view>
29
+ </view>
30
+ </view>
31
+ </view>
32
+ </template>
33
+
34
+ <script>
35
+ /**
36
+ * DataChecklist 数据选择器
37
+ * @description 通过数据渲染的下拉框组件
38
+ * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
39
+ * @property {String} value 默认值
40
+ * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
41
+ * @property {Boolean} clear 是否可以清空已选项
42
+ * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
43
+ * @property {String} label 左侧标题
44
+ * @property {String} placeholder 输入框的提示文字
45
+ * @property {Boolean} disabled 是否禁用
46
+ * @event {Function} change 选中发生变化触发
47
+ */
48
+
49
+ export default {
50
+ name: "uni-data-select",
51
+ mixins: [uniCloud.mixinDatacom || {}],
52
+ props: {
53
+ localdata: {
54
+ type: Array,
55
+ default () {
56
+ return []
57
+ }
58
+ },
59
+ value: {
60
+ type: [String, Number],
61
+ default: ''
62
+ },
63
+ modelValue: {
64
+ type: [String, Number],
65
+ default: ''
66
+ },
67
+ label: {
68
+ type: String,
69
+ default: ''
70
+ },
71
+ placeholder: {
72
+ type: String,
73
+ default: '请选择'
74
+ },
75
+ emptyTips: {
76
+ type: String,
77
+ default: '无选项'
78
+ },
79
+ clear: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ defItem: {
84
+ type: Number,
85
+ default: 0
86
+ },
87
+ disabled: {
88
+ type: Boolean,
89
+ default: false
90
+ },
91
+ // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
92
+ format: {
93
+ type: String,
94
+ default: ''
95
+ },
96
+ },
97
+ data() {
98
+ return {
99
+ showSelector: false,
100
+ current: '',
101
+ mixinDatacomResData: [],
102
+ apps: [],
103
+ channels: [],
104
+ cacheKey: "uni-data-select-lastSelectedValue",
105
+ };
106
+ },
107
+ created() {
108
+ this.debounceGet = this.debounce(() => {
109
+ this.query();
110
+ }, 300);
111
+ if (this.collection && !this.localdata.length) {
112
+ this.debounceGet();
113
+ }
114
+ },
115
+ computed: {
116
+ typePlaceholder() {
117
+ const text = {
118
+ 'opendb-stat-app-versions': '版本',
119
+ 'opendb-app-channels': '渠道',
120
+ 'opendb-app-list': '应用'
121
+ }
122
+ const common = this.placeholder
123
+ const placeholder = text[this.collection]
124
+ return placeholder ?
125
+ common + placeholder :
126
+ common
127
+ },
128
+ valueCom(){
129
+ // #ifdef VUE3
130
+ return this.modelValue;
131
+ // #endif
132
+ // #ifndef VUE3
133
+ return this.value;
134
+ // #endif
135
+ }
136
+ },
137
+ watch: {
138
+ localdata: {
139
+ immediate: true,
140
+ handler(val, old) {
141
+ if (Array.isArray(val) && old !== val) {
142
+ this.mixinDatacomResData = val
143
+ }
144
+ }
145
+ },
146
+ valueCom(val, old) {
147
+ this.initDefVal()
148
+ },
149
+ mixinDatacomResData: {
150
+ immediate: true,
151
+ handler(val) {
152
+ if (val.length) {
153
+ this.initDefVal()
154
+ }
155
+ }
156
+ }
157
+ },
158
+ methods: {
159
+ debounce(fn, time = 100){
160
+ let timer = null
161
+ return function(...args) {
162
+ if (timer) clearTimeout(timer)
163
+ timer = setTimeout(() => {
164
+ fn.apply(this, args)
165
+ }, time)
166
+ }
167
+ },
168
+ // 执行数据库查询
169
+ query(){
170
+ this.mixinDatacomEasyGet();
171
+ },
172
+ // 监听查询条件变更事件
173
+ onMixinDatacomPropsChange(){
174
+ if (this.collection) {
175
+ this.debounceGet();
176
+ }
177
+ },
178
+ initDefVal() {
179
+ let defValue = ''
180
+ if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
181
+ defValue = this.valueCom
182
+ } else {
183
+ let strogeValue
184
+ if (this.collection) {
185
+ strogeValue = this.getCache()
186
+ }
187
+ if (strogeValue || strogeValue === 0) {
188
+ defValue = strogeValue
189
+ } else {
190
+ let defItem = ''
191
+ if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
192
+ defItem = this.mixinDatacomResData[this.defItem - 1].value
193
+ }
194
+ defValue = defItem
195
+ }
196
+ if (defValue || defValue === 0) {
197
+ this.emit(defValue)
198
+ }
199
+ }
200
+ const def = this.mixinDatacomResData.find(item => item.value === defValue)
201
+ this.current = def ? this.formatItemName(def) : ''
202
+ },
203
+
204
+ /**
205
+ * @param {[String, Number]} value
206
+ * 判断用户给的 value 是否同时为禁用状态
207
+ */
208
+ isDisabled(value) {
209
+ let isDisabled = false;
210
+
211
+ this.mixinDatacomResData.forEach(item => {
212
+ if (item.value === value) {
213
+ isDisabled = item.disable
214
+ }
215
+ })
216
+
217
+ return isDisabled;
218
+ },
219
+
220
+ clearVal() {
221
+ this.emit('')
222
+ if (this.collection) {
223
+ this.removeCache()
224
+ }
225
+ },
226
+ change(item) {
227
+ if (!item.disable) {
228
+ this.showSelector = false
229
+ this.current = this.formatItemName(item)
230
+ this.emit(item.value)
231
+ }
232
+ },
233
+ emit(val) {
234
+ this.$emit('input', val)
235
+ this.$emit('update:modelValue', val)
236
+ this.$emit('change', val)
237
+ if (this.collection) {
238
+ this.setCache(val);
239
+ }
240
+ },
241
+ toggleSelector() {
242
+ if (this.disabled) {
243
+ return
244
+ }
245
+
246
+ this.showSelector = !this.showSelector
247
+ },
248
+ formatItemName(item) {
249
+ let {
250
+ text,
251
+ value,
252
+ channel_code
253
+ } = item
254
+ channel_code = channel_code ? `(${channel_code})` : ''
255
+
256
+ if (this.format) {
257
+ // 格式化输出
258
+ let str = "";
259
+ str = this.format;
260
+ for (let key in item) {
261
+ str = str.replace(new RegExp(`{${key}}`,"g"),item[key]);
262
+ }
263
+ return str;
264
+ } else {
265
+ return this.collection.indexOf('app-list') > 0 ?
266
+ `${text}(${value})` :
267
+ (
268
+ text ?
269
+ text :
270
+ `未命名${channel_code}`
271
+ )
272
+ }
273
+ },
274
+ // 获取当前加载的数据
275
+ getLoadData(){
276
+ return this.mixinDatacomResData;
277
+ },
278
+ // 获取当前缓存key
279
+ getCurrentCacheKey(){
280
+ return this.collection;
281
+ },
282
+ // 获取缓存
283
+ getCache(name=this.getCurrentCacheKey()){
284
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
285
+ return cacheData[name];
286
+ },
287
+ // 设置缓存
288
+ setCache(value, name=this.getCurrentCacheKey()){
289
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
290
+ cacheData[name] = value;
291
+ uni.setStorageSync(this.cacheKey, cacheData);
292
+ },
293
+ // 删除缓存
294
+ removeCache(name=this.getCurrentCacheKey()){
295
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
296
+ delete cacheData[name];
297
+ uni.setStorageSync(this.cacheKey, cacheData);
298
+ },
299
+ }
300
+ }
301
+ </script>
302
+
303
+ <style lang="scss">
304
+ $uni-base-color: #6a6a6a !default;
305
+ $uni-main-color: #333 !default;
306
+ $uni-secondary-color: #909399 !default;
307
+ $uni-border-3: #e5e5e5;
308
+
309
+
310
+ /* #ifndef APP-NVUE */
311
+ @media screen and (max-width: 500px) {
312
+ .hide-on-phone {
313
+ display: none;
314
+ }
315
+ }
316
+
317
+ /* #endif */
318
+ .uni-stat__select {
319
+ display: flex;
320
+ align-items: center;
321
+ // padding: 15px;
322
+ /* #ifdef H5 */
323
+ cursor: pointer;
324
+ /* #endif */
325
+ width: 100%;
326
+ flex: 1;
327
+ box-sizing: border-box;
328
+ }
329
+
330
+ .uni-stat-box {
331
+ width: 100%;
332
+ flex: 1;
333
+ }
334
+
335
+ .uni-stat__actived {
336
+ width: 100%;
337
+ flex: 1;
338
+ // outline: 1px solid #2979ff;
339
+ }
340
+
341
+ .uni-label-text {
342
+ font-size: 14px;
343
+ font-weight: bold;
344
+ color: $uni-base-color;
345
+ margin: auto 0;
346
+ margin-right: 5px;
347
+ }
348
+
349
+ .uni-select {
350
+ font-size: 14px;
351
+ border: 1px solid $uni-border-3;
352
+ box-sizing: border-box;
353
+ border-radius: 4px;
354
+ padding: 0 5px;
355
+ padding-left: 10px;
356
+ position: relative;
357
+ /* #ifndef APP-NVUE */
358
+ display: flex;
359
+ user-select: none;
360
+ /* #endif */
361
+ flex-direction: row;
362
+ align-items: center;
363
+ border-bottom: solid 1px $uni-border-3;
364
+ width: 100%;
365
+ flex: 1;
366
+ height: 35px;
367
+
368
+ &--disabled {
369
+ background-color: #f5f7fa;
370
+ cursor: not-allowed;
371
+ }
372
+ }
373
+
374
+ .uni-select__label {
375
+ font-size: 16px;
376
+ // line-height: 22px;
377
+ height: 35px;
378
+ padding-right: 10px;
379
+ color: $uni-secondary-color;
380
+ }
381
+
382
+ .uni-select__input-box {
383
+ height: 35px;
384
+ position: relative;
385
+ /* #ifndef APP-NVUE */
386
+ display: flex;
387
+ /* #endif */
388
+ flex: 1;
389
+ flex-direction: row;
390
+ align-items: center;
391
+ }
392
+
393
+ .uni-select__input {
394
+ flex: 1;
395
+ font-size: 14px;
396
+ height: 22px;
397
+ line-height: 22px;
398
+ }
399
+
400
+ .uni-select__input-plac {
401
+ font-size: 14px;
402
+ color: $uni-secondary-color;
403
+ }
404
+
405
+ .uni-select__selector {
406
+ /* #ifndef APP-NVUE */
407
+ box-sizing: border-box;
408
+ /* #endif */
409
+ position: absolute;
410
+ top: calc(100% + 12px);
411
+ left: 0;
412
+ width: 100%;
413
+ background-color: #FFFFFF;
414
+ border: 1px solid #EBEEF5;
415
+ border-radius: 6px;
416
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
417
+ z-index: 3;
418
+ padding: 4px 0;
419
+ }
420
+
421
+ .uni-select__selector-scroll {
422
+ /* #ifndef APP-NVUE */
423
+ max-height: 200px;
424
+ box-sizing: border-box;
425
+ /* #endif */
426
+ }
427
+
428
+ /* #ifdef H5 */
429
+ @media (min-width: 768px) {
430
+ .uni-select__selector-scroll {
431
+ max-height: 600px;
432
+ }
433
+ }
434
+ /* #endif */
435
+
436
+ .uni-select__selector-empty,
437
+ .uni-select__selector-item {
438
+ /* #ifndef APP-NVUE */
439
+ display: flex;
440
+ cursor: pointer;
441
+ /* #endif */
442
+ line-height: 35px;
443
+ font-size: 14px;
444
+ text-align: center;
445
+ /* border-bottom: solid 1px $uni-border-3; */
446
+ padding: 0px 10px;
447
+ }
448
+
449
+ .uni-select__selector-item:hover {
450
+ background-color: #f9f9f9;
451
+ }
452
+
453
+ .uni-select__selector-empty:last-child,
454
+ .uni-select__selector-item:last-child {
455
+ /* #ifndef APP-NVUE */
456
+ border-bottom: none;
457
+ /* #endif */
458
+ }
459
+
460
+ .uni-select__selector__disabled {
461
+ opacity: 0.4;
462
+ cursor: default;
463
+ }
464
+
465
+ /* picker 弹出层通用的指示小三角 */
466
+ .uni-popper__arrow,
467
+ .uni-popper__arrow::after {
468
+ position: absolute;
469
+ display: block;
470
+ width: 0;
471
+ height: 0;
472
+ border-color: transparent;
473
+ border-style: solid;
474
+ border-width: 6px;
475
+ }
476
+
477
+ .uni-popper__arrow {
478
+ filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
479
+ top: -6px;
480
+ left: 10%;
481
+ margin-right: 3px;
482
+ border-top-width: 0;
483
+ border-bottom-color: #EBEEF5;
484
+ }
485
+
486
+ .uni-popper__arrow::after {
487
+ content: " ";
488
+ top: 1px;
489
+ margin-left: -6px;
490
+ border-top-width: 0;
491
+ border-bottom-color: #fff;
492
+ }
493
+
494
+ .uni-select__input-text {
495
+ // width: 280px;
496
+ width: 100%;
497
+ color: $uni-main-color;
498
+ white-space: nowrap;
499
+ text-overflow: ellipsis;
500
+ -o-text-overflow: ellipsis;
501
+ overflow: hidden;
502
+ }
503
+
504
+ .uni-select__input-placeholder {
505
+ color: $uni-base-color;
506
+ font-size: 12px;
507
+ }
508
+
509
+ .uni-select--mask {
510
+ position: fixed;
511
+ top: 0;
512
+ bottom: 0;
513
+ right: 0;
514
+ left: 0;
515
+ z-index: 2;
516
+ }
517
+ </style>
@@ -0,0 +1,200 @@
1
+ // yyyy-MM-dd hh:mm:ss.SSS 所有支持的类型
2
+ function pad(str, length = 2) {
3
+ str += ''
4
+ while (str.length < length) {
5
+ str = '0' + str
6
+ }
7
+ return str.slice(-length)
8
+ }
9
+
10
+ const parser = {
11
+ yyyy: (dateObj) => {
12
+ return pad(dateObj.year, 4)
13
+ },
14
+ yy: (dateObj) => {
15
+ return pad(dateObj.year)
16
+ },
17
+ MM: (dateObj) => {
18
+ return pad(dateObj.month)
19
+ },
20
+ M: (dateObj) => {
21
+ return dateObj.month
22
+ },
23
+ dd: (dateObj) => {
24
+ return pad(dateObj.day)
25
+ },
26
+ d: (dateObj) => {
27
+ return dateObj.day
28
+ },
29
+ hh: (dateObj) => {
30
+ return pad(dateObj.hour)
31
+ },
32
+ h: (dateObj) => {
33
+ return dateObj.hour
34
+ },
35
+ mm: (dateObj) => {
36
+ return pad(dateObj.minute)
37
+ },
38
+ m: (dateObj) => {
39
+ return dateObj.minute
40
+ },
41
+ ss: (dateObj) => {
42
+ return pad(dateObj.second)
43
+ },
44
+ s: (dateObj) => {
45
+ return dateObj.second
46
+ },
47
+ SSS: (dateObj) => {
48
+ return pad(dateObj.millisecond, 3)
49
+ },
50
+ S: (dateObj) => {
51
+ return dateObj.millisecond
52
+ },
53
+ }
54
+
55
+ // 这都n年了iOS依然不认识2020-12-12,需要转换为2020/12/12
56
+ function getDate(time) {
57
+ if (time instanceof Date) {
58
+ return time
59
+ }
60
+ switch (typeof time) {
61
+ case 'string':
62
+ {
63
+ // 2020-12-12T12:12:12.000Z、2020-12-12T12:12:12.000
64
+ if (time.indexOf('T') > -1) {
65
+ return new Date(time)
66
+ }
67
+ return new Date(time.replace(/-/g, '/'))
68
+ }
69
+ default:
70
+ return new Date(time)
71
+ }
72
+ }
73
+
74
+ export function formatDate(date, format = 'yyyy/MM/dd hh:mm:ss') {
75
+ if (!date && date !== 0) {
76
+ return ''
77
+ }
78
+ date = getDate(date)
79
+ const dateObj = {
80
+ year: date.getFullYear(),
81
+ month: date.getMonth() + 1,
82
+ day: date.getDate(),
83
+ hour: date.getHours(),
84
+ minute: date.getMinutes(),
85
+ second: date.getSeconds(),
86
+ millisecond: date.getMilliseconds()
87
+ }
88
+ const tokenRegExp = /yyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S/
89
+ let flag = true
90
+ let result = format
91
+ while (flag) {
92
+ flag = false
93
+ result = result.replace(tokenRegExp, function(matched) {
94
+ flag = true
95
+ return parser[matched](dateObj)
96
+ })
97
+ }
98
+ return result
99
+ }
100
+
101
+ export function friendlyDate(time, {
102
+ locale = 'zh',
103
+ threshold = [60000, 3600000],
104
+ format = 'yyyy/MM/dd hh:mm:ss'
105
+ }) {
106
+ if (time === '-') {
107
+ return time
108
+ }
109
+ if (!time && time !== 0) {
110
+ return ''
111
+ }
112
+ const localeText = {
113
+ zh: {
114
+ year: '年',
115
+ month: '月',
116
+ day: '天',
117
+ hour: '小时',
118
+ minute: '分钟',
119
+ second: '秒',
120
+ ago: '前',
121
+ later: '后',
122
+ justNow: '刚刚',
123
+ soon: '马上',
124
+ template: '{num}{unit}{suffix}'
125
+ },
126
+ en: {
127
+ year: 'year',
128
+ month: 'month',
129
+ day: 'day',
130
+ hour: 'hour',
131
+ minute: 'minute',
132
+ second: 'second',
133
+ ago: 'ago',
134
+ later: 'later',
135
+ justNow: 'just now',
136
+ soon: 'soon',
137
+ template: '{num} {unit} {suffix}'
138
+ }
139
+ }
140
+ const text = localeText[locale] || localeText.zh
141
+ let date = getDate(time)
142
+ let ms = date.getTime() - Date.now()
143
+ let absMs = Math.abs(ms)
144
+ if (absMs < threshold[0]) {
145
+ return ms < 0 ? text.justNow : text.soon
146
+ }
147
+ if (absMs >= threshold[1]) {
148
+ return formatDate(date, format)
149
+ }
150
+ let num
151
+ let unit
152
+ let suffix = text.later
153
+ if (ms < 0) {
154
+ suffix = text.ago
155
+ ms = -ms
156
+ }
157
+ const seconds = Math.floor((ms) / 1000)
158
+ const minutes = Math.floor(seconds / 60)
159
+ const hours = Math.floor(minutes / 60)
160
+ const days = Math.floor(hours / 24)
161
+ const months = Math.floor(days / 30)
162
+ const years = Math.floor(months / 12)
163
+ switch (true) {
164
+ case years > 0:
165
+ num = years
166
+ unit = text.year
167
+ break
168
+ case months > 0:
169
+ num = months
170
+ unit = text.month
171
+ break
172
+ case days > 0:
173
+ num = days
174
+ unit = text.day
175
+ break
176
+ case hours > 0:
177
+ num = hours
178
+ unit = text.hour
179
+ break
180
+ case minutes > 0:
181
+ num = minutes
182
+ unit = text.minute
183
+ break
184
+ default:
185
+ num = seconds
186
+ unit = text.second
187
+ break
188
+ }
189
+
190
+ if (locale === 'en') {
191
+ if (num === 1) {
192
+ num = 'a'
193
+ } else {
194
+ unit += 's'
195
+ }
196
+ }
197
+
198
+ return text.template.replace(/{\s*num\s*}/g, num + '').replace(/{\s*unit\s*}/g, unit).replace(/{\s*suffix\s*}/g,
199
+ suffix)
200
+ }