@alu008/test_yuanqikaixiang 1.0.0
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/App.vue +294 -0
- package/Local/en.json +3 -0
- package/Local/indian.json +3 -0
- package/Local/zh-Hans.json +3 -0
- package/Local/zh-Hant.json +3 -0
- package/README.md +1 -0
- package/androidPrivacy.json +28 -0
- package/components/ball/ball.vue +230 -0
- package/components/cardDetails/cardDetails.vue +273 -0
- package/components/confirmModal/confirmModal.vue +125 -0
- package/components/fillInfo/fillInfo.vue +255 -0
- package/components/header/header.vue +92 -0
- package/components/selectAddress/selectAddress.vue +156 -0
- package/components/signDetail/signDetail.vue +33 -0
- package/components/skeleton/skeleton.vue +62 -0
- package/index.html +20 -0
- package/index.template.html +35 -0
- package/jsconfig.json +9 -0
- package/main.js +48 -0
- package/manifest.json +159 -0
- package/package.json +14 -0
- package/pages/index/index.vue +5421 -0
- package/pages.json +173 -0
- package/project.config.json +25 -0
- package/project.private.config.json +14 -0
- package/static/fonts/Alibaba-PuHuiTi-Bold.ttf +0 -0
- package/static/fonts/Alibaba-PuHuiTi-Medium.ttf +0 -0
- package/static/fonts/Alibaba-PuHuiTi-Regular.ttf +0 -0
- package/static/fonts/fxlh.ttf +0 -0
- package/static/img/R.png +0 -0
- package/static/img/SR.png +0 -0
- package/static/img/SSR.png +0 -0
- package/static/img/bottomBgc1.png +0 -0
- package/static/img/centerBgc.png +0 -0
- package/static/img/goldBgc.png +0 -0
- package/static/img/goldText.png +0 -0
- package/static/img/home/calendar/bgc0.png +0 -0
- package/static/img/home/calendar/bgc1.png +0 -0
- package/static/img/home/calendar/bgc2.png +0 -0
- package/static/img/home/calendar/bgc3.png +0 -0
- package/static/img/home/calendar/progress0.png +0 -0
- package/static/img/home/calendar/progress1.png +0 -0
- package/static/img/home/calendar/progress2.png +0 -0
- package/static/img/home/calendar/progress3.png +0 -0
- package/static/img/kuang.gif +0 -0
- package/static/img/luckyBgc.png +0 -0
- package/static/img/lucyText.png +0 -0
- package/static/img/top_Bgc.png +0 -0
- package/subpackages/article/article.vue +64 -0
- package/subpackages/confirmSendLogistics/confirmSendLogistics.vue +1035 -0
- package/subpackages/coupon/coupon.vue +276 -0
- package/subpackages/fragment/fragment.vue +1592 -0
- package/subpackages/myAddress/myAddress.vue +656 -0
- package/subpackages/myCards/myCards.vue +1250 -0
- package/subpackages/myOrder/myOrder.vue +779 -0
- package/subpackages/myOrderDetail/myOrderDetail.vue +659 -0
- package/subpackages/poster/poster.vue +130 -0
- package/subpackages/selectCoupon/selectCoupon.vue +251 -0
- package/subpackages/sendLogistics/sendLogistics.vue +1097 -0
- package/subpackages/vote/vote.vue +877 -0
- package/uni.promisify.adaptor.js +10 -0
- package/uni.scss +114 -0
- package/uni_modules/qf-image-cropper/changelog.md +72 -0
- package/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.render.js +855 -0
- package/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue +749 -0
- package/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.wxs +727 -0
- package/uni_modules/qf-image-cropper/package.json +81 -0
- package/uni_modules/qf-image-cropper/readme.md +97 -0
- package/uni_modules/uni-data-select/changelog.md +51 -0
- package/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue +837 -0
- package/uni_modules/uni-data-select/package.json +106 -0
- package/uni_modules/uni-data-select/readme.md +8 -0
- package/uni_modules/uni-icons/changelog.md +44 -0
- package/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue +91 -0
- package/uni_modules/uni-icons/components/uni-icons/uni-icons.vue +110 -0
- package/uni_modules/uni-icons/components/uni-icons/uniicons.css +664 -0
- package/uni_modules/uni-icons/components/uni-icons/uniicons.ttf +0 -0
- package/uni_modules/uni-icons/components/uni-icons/uniicons_file.ts +664 -0
- package/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js +649 -0
- package/uni_modules/uni-icons/package.json +111 -0
- package/uni_modules/uni-icons/readme.md +8 -0
- package/uni_modules/uni-load-more/changelog.md +23 -0
- package/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json +5 -0
- package/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js +8 -0
- package/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json +5 -0
- package/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json +5 -0
- package/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue +404 -0
- package/uni_modules/uni-load-more/package.json +105 -0
- package/uni_modules/uni-load-more/readme.md +14 -0
- package/uni_modules/uni-scss/changelog.md +8 -0
- package/uni_modules/uni-scss/index.scss +1 -0
- package/uni_modules/uni-scss/package.json +82 -0
- package/uni_modules/uni-scss/readme.md +4 -0
- package/uni_modules/uni-scss/styles/index.scss +7 -0
- package/uni_modules/uni-scss/styles/setting/_border.scss +3 -0
- package/uni_modules/uni-scss/styles/setting/_color.scss +66 -0
- package/uni_modules/uni-scss/styles/setting/_radius.scss +55 -0
- package/uni_modules/uni-scss/styles/setting/_space.scss +56 -0
- package/uni_modules/uni-scss/styles/setting/_styles.scss +167 -0
- package/uni_modules/uni-scss/styles/setting/_text.scss +24 -0
- package/uni_modules/uni-scss/styles/setting/_variables.scss +146 -0
- package/uni_modules/uni-scss/styles/tools/functions.scss +19 -0
- package/uni_modules/uni-scss/theme.scss +31 -0
- package/uni_modules/uni-scss/variables.scss +62 -0
- package/utils/addressData.js +6042 -0
- package/utils/api.js +160 -0
- package/utils/fetch.js +548 -0
- package/utils/index.js +994 -0
- package/utils/navigator.js +17 -0
- package/utils/request.js +162 -0
|
@@ -0,0 +1,837 @@
|
|
|
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, 'uni-select--wrap': shouldWrap , 'border-default': mode == 'default','border-bottom': mode == 'underline'}">
|
|
6
|
+
<view class="uni-select__input-box" @click="toggleSelector" :class="{'uni-select__input-box--wrap': shouldWrap}">
|
|
7
|
+
<view v-if="slotSelected" class="slot-content padding-top-bottom" :class="{'uni-select__input-text--wrap': shouldWrap}">
|
|
8
|
+
<slot name="selected" :selectedItems="getSelectedItems()"></slot>
|
|
9
|
+
</view>
|
|
10
|
+
<template v-else>
|
|
11
|
+
<view v-if="textShow" class="uni-select__input-text" :class="{'uni-select__input-text--wrap': shouldWrap}">
|
|
12
|
+
<view class="padding-top-bottom" :class="'align-'+align">{{textShow}}</view>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-else class="uni-select__input-text uni-select__input-placeholder" :class="'align-'+align">{{typePlaceholder}}</view>
|
|
15
|
+
</template>
|
|
16
|
+
<view key="clear-button" v-if="!hideRight && shouldShowClear && clear && !disabled" @click.stop="clearVal">
|
|
17
|
+
<uni-icons type="clear" color="#c0c4cc" size="24" />
|
|
18
|
+
</view>
|
|
19
|
+
<view key="arrow-button" v-else-if="!hideRight">
|
|
20
|
+
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
|
24
|
+
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
|
|
25
|
+
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
|
|
26
|
+
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
|
|
27
|
+
<template v-if="slotEmpty && mixinDatacomResData.length === 0">
|
|
28
|
+
<view class="uni-select__selector-empty">
|
|
29
|
+
<slot name="empty" :empty="emptyTips"></slot>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
<template v-else>
|
|
33
|
+
<view v-if="mixinDatacomResData.length === 0" class="uni-select__selector-empty">
|
|
34
|
+
<text>{{emptyTips}}</text>
|
|
35
|
+
</view>
|
|
36
|
+
</template>
|
|
37
|
+
<template v-if="slotOption">
|
|
38
|
+
<view v-for="(itemData,index) in mixinDatacomResData" :key="index" @click="change(itemData)">
|
|
39
|
+
<slot name="option" :item="itemData" :itemSelected="multiple? getCurrentValues().includes(itemData.value):getCurrentValues() == itemData.value"></slot>
|
|
40
|
+
</view>
|
|
41
|
+
</template>
|
|
42
|
+
<template v-else>
|
|
43
|
+
<view v-if="!multiple && mixinDatacomResData.length > 0" class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
|
|
44
|
+
@click="change(item)">
|
|
45
|
+
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
|
|
46
|
+
</view>
|
|
47
|
+
<view v-if="multiple && mixinDatacomResData.length > 0" >
|
|
48
|
+
<checkbox-group @change="checkBoxChange">
|
|
49
|
+
<label class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index" >
|
|
50
|
+
<checkbox :value="index+''" :checked="getCurrentValues().includes(item.value)" :disabled="item.disable"></checkbox>
|
|
51
|
+
<view :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</view>
|
|
52
|
+
</label>
|
|
53
|
+
</checkbox-group>
|
|
54
|
+
</view>
|
|
55
|
+
</template>
|
|
56
|
+
</scroll-view>
|
|
57
|
+
</view>
|
|
58
|
+
</view>
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script>
|
|
64
|
+
/**
|
|
65
|
+
* DataChecklist 数据选择器
|
|
66
|
+
* @description 通过数据渲染的下拉框组件
|
|
67
|
+
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
|
|
68
|
+
* @property {String|Array} value 默认值,多选时为数组
|
|
69
|
+
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
|
|
70
|
+
* @property {Boolean} clear 是否可以清空已选项
|
|
71
|
+
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
|
72
|
+
* @property {String} label 左侧标题
|
|
73
|
+
* @property {String} placeholder 输入框的提示文字
|
|
74
|
+
* @property {Boolean} disabled 是否禁用
|
|
75
|
+
* @property {Boolean} multiple 是否多选模式
|
|
76
|
+
* @property {Boolean} wrap 是否允许选中文本换行显示
|
|
77
|
+
* @property {String} placement 弹出位置
|
|
78
|
+
* @value top 顶部弹出
|
|
79
|
+
* @value bottom 底部弹出(default)
|
|
80
|
+
* @property {String} align 选择文字的位置
|
|
81
|
+
* @value left 显示左侧
|
|
82
|
+
* @value center 显示中间
|
|
83
|
+
* @value right 显示 右侧
|
|
84
|
+
* @property {Boolean} hideRight 是否隐藏右侧按钮
|
|
85
|
+
* @property {String} mode 边框样式
|
|
86
|
+
* @value default 四周边框
|
|
87
|
+
* @value underline 下边框
|
|
88
|
+
* @value none 无边框
|
|
89
|
+
* @event {Function} change 选中发生变化触发
|
|
90
|
+
* @event {Function} open 选择框开启时触发
|
|
91
|
+
* @event {Function} close 选择框关闭时触发
|
|
92
|
+
* @event {Function} clear 点击清除按钮之后触发
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export default {
|
|
96
|
+
name: "uni-data-select",
|
|
97
|
+
mixins: [uniCloud.mixinDatacom || {}],
|
|
98
|
+
emits: [
|
|
99
|
+
'open',
|
|
100
|
+
'close',
|
|
101
|
+
'update:modelValue',
|
|
102
|
+
'input',
|
|
103
|
+
'clear',
|
|
104
|
+
'change'
|
|
105
|
+
],
|
|
106
|
+
model: {
|
|
107
|
+
prop: 'modelValue',
|
|
108
|
+
event: 'update:modelValue'
|
|
109
|
+
},
|
|
110
|
+
options: {
|
|
111
|
+
// #ifdef MP-TOUTIAO
|
|
112
|
+
virtualHost: false,
|
|
113
|
+
// #endif
|
|
114
|
+
// #ifndef MP-TOUTIAO
|
|
115
|
+
virtualHost: true
|
|
116
|
+
// #endif
|
|
117
|
+
},
|
|
118
|
+
props: {
|
|
119
|
+
localdata: {
|
|
120
|
+
type: Array,
|
|
121
|
+
default () {
|
|
122
|
+
return []
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
value: {
|
|
126
|
+
type: [String, Number, Array],
|
|
127
|
+
default: ''
|
|
128
|
+
},
|
|
129
|
+
modelValue: {
|
|
130
|
+
type: [String, Number, Array],
|
|
131
|
+
default: ''
|
|
132
|
+
},
|
|
133
|
+
label: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: ''
|
|
136
|
+
},
|
|
137
|
+
placeholder: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: '请选择'
|
|
140
|
+
},
|
|
141
|
+
emptyTips: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: '无选项'
|
|
144
|
+
},
|
|
145
|
+
clear: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: true
|
|
148
|
+
},
|
|
149
|
+
defItem: {
|
|
150
|
+
type: Number,
|
|
151
|
+
default: 0
|
|
152
|
+
},
|
|
153
|
+
disabled: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: false
|
|
156
|
+
},
|
|
157
|
+
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
|
|
158
|
+
format: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: ''
|
|
161
|
+
},
|
|
162
|
+
placement: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: 'bottom'
|
|
165
|
+
},
|
|
166
|
+
multiple: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: false
|
|
169
|
+
},
|
|
170
|
+
wrap: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: false
|
|
173
|
+
},
|
|
174
|
+
align:{
|
|
175
|
+
type: String,
|
|
176
|
+
default: "left"
|
|
177
|
+
},
|
|
178
|
+
hideRight: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: false
|
|
181
|
+
},
|
|
182
|
+
mode:{
|
|
183
|
+
type: String,
|
|
184
|
+
default: 'default'
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
data() {
|
|
188
|
+
return {
|
|
189
|
+
showSelector: false,
|
|
190
|
+
current: '',
|
|
191
|
+
mixinDatacomResData: [],
|
|
192
|
+
apps: [],
|
|
193
|
+
channels: [],
|
|
194
|
+
cacheKey: "uni-data-select-lastSelectedValue",
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
created() {
|
|
198
|
+
this.debounceGet = this.debounce(() => {
|
|
199
|
+
this.query();
|
|
200
|
+
}, 300);
|
|
201
|
+
if (this.collection && !this.localdata.length) {
|
|
202
|
+
this.debounceGet();
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
computed: {
|
|
206
|
+
typePlaceholder() {
|
|
207
|
+
const text = {
|
|
208
|
+
'opendb-stat-app-versions': '版本',
|
|
209
|
+
'opendb-app-channels': '渠道',
|
|
210
|
+
'opendb-app-list': '应用'
|
|
211
|
+
}
|
|
212
|
+
const common = this.placeholder
|
|
213
|
+
const placeholder = text[this.collection]
|
|
214
|
+
return placeholder ?
|
|
215
|
+
common + placeholder :
|
|
216
|
+
common
|
|
217
|
+
},
|
|
218
|
+
valueCom() {
|
|
219
|
+
if (this.value === '') return this.modelValue
|
|
220
|
+
if (this.modelValue === '') return this.value
|
|
221
|
+
return this.value
|
|
222
|
+
},
|
|
223
|
+
textShow() {
|
|
224
|
+
// 长文本显示
|
|
225
|
+
if (this.multiple) {
|
|
226
|
+
const currentValues = this.getCurrentValues();
|
|
227
|
+
if (Array.isArray(currentValues) && currentValues.length > 0) {
|
|
228
|
+
const selectedItems = this.mixinDatacomResData.filter(item => currentValues.includes(item.value));
|
|
229
|
+
return selectedItems.map(item => this.formatItemName(item)).join(', ');
|
|
230
|
+
} else {
|
|
231
|
+
return ''; // 空数组时返回空字符串,显示占位符
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
return this.current;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
shouldShowClear() {
|
|
238
|
+
if (this.multiple) {
|
|
239
|
+
const currentValues = this.getCurrentValues();
|
|
240
|
+
return Array.isArray(currentValues) && currentValues.length > 0;
|
|
241
|
+
} else {
|
|
242
|
+
return !!this.current;
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
shouldWrap() {
|
|
246
|
+
// 只有在多选模式、开启换行、且有内容时才应用换行样式
|
|
247
|
+
return this.multiple && this.wrap && !!this.textShow;
|
|
248
|
+
},
|
|
249
|
+
getOffsetByPlacement() {
|
|
250
|
+
switch (this.placement) {
|
|
251
|
+
case 'top':
|
|
252
|
+
return "bottom:calc(100% + 12px);";
|
|
253
|
+
case 'bottom':
|
|
254
|
+
return "top:calc(100% + 12px);";
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
slotSelected(){
|
|
258
|
+
// #ifdef VUE2
|
|
259
|
+
return this.$scopedSlots ? this.$scopedSlots.selected : false
|
|
260
|
+
// #endif
|
|
261
|
+
// #ifdef VUE3
|
|
262
|
+
return this.$slots ? this.$slots.selected : false
|
|
263
|
+
// #endif
|
|
264
|
+
},
|
|
265
|
+
slotEmpty(){
|
|
266
|
+
// #ifdef VUE2
|
|
267
|
+
return this.$scopedSlots ? this.$scopedSlots.empty : false
|
|
268
|
+
// #endif
|
|
269
|
+
// #ifdef VUE3
|
|
270
|
+
return this.$slots ? this.$slots.empty : false
|
|
271
|
+
// #endif
|
|
272
|
+
},
|
|
273
|
+
slotOption(){
|
|
274
|
+
// #ifdef VUE2
|
|
275
|
+
return this.$scopedSlots ? this.$scopedSlots.option : false
|
|
276
|
+
// #endif
|
|
277
|
+
// #ifdef VUE3
|
|
278
|
+
return this.$slots ? this.$slots.option : false
|
|
279
|
+
// #endif
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
watch: {
|
|
283
|
+
showSelector:{
|
|
284
|
+
handler(val,old){
|
|
285
|
+
val ? this.$emit('open') : this.$emit('close')
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
localdata: {
|
|
289
|
+
immediate: true,
|
|
290
|
+
handler(val, old) {
|
|
291
|
+
if (Array.isArray(val) && old !== val) {
|
|
292
|
+
this.mixinDatacomResData = val
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
valueCom(val, old) {
|
|
297
|
+
this.initDefVal()
|
|
298
|
+
},
|
|
299
|
+
mixinDatacomResData: {
|
|
300
|
+
immediate: true,
|
|
301
|
+
handler(val) {
|
|
302
|
+
if (val.length) {
|
|
303
|
+
this.initDefVal()
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
methods: {
|
|
309
|
+
getSelectedItems() {
|
|
310
|
+
const currentValues = this.getCurrentValues();
|
|
311
|
+
let _minxData = this.mixinDatacomResData
|
|
312
|
+
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
|
313
|
+
_minxData = JSON.parse(JSON.stringify(this.mixinDatacomResData))
|
|
314
|
+
// #endif
|
|
315
|
+
if (this.multiple) {
|
|
316
|
+
return _minxData.filter(item => currentValues.includes(item.value)) || [];
|
|
317
|
+
} else {
|
|
318
|
+
return _minxData.filter(item => item.value === currentValues) || [];
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
debounce(fn, time = 100) {
|
|
322
|
+
let timer = null
|
|
323
|
+
return function(...args) {
|
|
324
|
+
if (timer) clearTimeout(timer)
|
|
325
|
+
timer = setTimeout(() => {
|
|
326
|
+
fn.apply(this, args)
|
|
327
|
+
}, time)
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
// 检查项目是否已选中
|
|
331
|
+
isSelected(item) {
|
|
332
|
+
if (this.multiple) {
|
|
333
|
+
const currentValues = this.getCurrentValues();
|
|
334
|
+
return Array.isArray(currentValues) && currentValues.includes(item.value);
|
|
335
|
+
} else {
|
|
336
|
+
return this.getCurrentValues() === item.value;
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
// 获取当前选中的值
|
|
340
|
+
getCurrentValues() {
|
|
341
|
+
if (this.multiple) {
|
|
342
|
+
return Array.isArray(this.valueCom) ? this.valueCom : (this.valueCom ? [this.valueCom] : []);
|
|
343
|
+
} else {
|
|
344
|
+
return this.valueCom;
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
// 执行数据库查询
|
|
348
|
+
query() {
|
|
349
|
+
this.mixinDatacomEasyGet();
|
|
350
|
+
},
|
|
351
|
+
// 监听查询条件变更事件
|
|
352
|
+
onMixinDatacomPropsChange() {
|
|
353
|
+
if (this.collection) {
|
|
354
|
+
this.debounceGet();
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
initDefVal() {
|
|
358
|
+
let defValue = this.multiple ? [] : ''
|
|
359
|
+
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
|
360
|
+
defValue = this.valueCom
|
|
361
|
+
} else {
|
|
362
|
+
let strogeValue
|
|
363
|
+
if (this.collection) {
|
|
364
|
+
strogeValue = this.getCache()
|
|
365
|
+
}
|
|
366
|
+
if (strogeValue || strogeValue === 0) {
|
|
367
|
+
defValue = strogeValue
|
|
368
|
+
} else {
|
|
369
|
+
let defItem = this.multiple ? [] : ''
|
|
370
|
+
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
|
371
|
+
defItem = this.multiple ? [this.mixinDatacomResData[this.defItem - 1].value] : this.mixinDatacomResData[this.defItem - 1].value
|
|
372
|
+
}
|
|
373
|
+
defValue = defItem
|
|
374
|
+
}
|
|
375
|
+
if (defValue || defValue === 0 || (this.multiple && Array.isArray(defValue) && defValue.length > 0)) {
|
|
376
|
+
this.emit(defValue)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (this.multiple) {
|
|
381
|
+
const selectedValues = Array.isArray(defValue) ? defValue : (defValue ? [defValue] : []);
|
|
382
|
+
const selectedItems = this.mixinDatacomResData.filter(item => selectedValues.includes(item.value));
|
|
383
|
+
this.current = selectedItems.map(item => this.formatItemName(item));
|
|
384
|
+
} else {
|
|
385
|
+
const def = this.mixinDatacomResData.find(item => item.value === defValue)
|
|
386
|
+
this.current = def ? this.formatItemName(def) : ''
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param {[String, Number, Array]} value
|
|
392
|
+
* 判断用户给的 value 是否同时为禁用状态
|
|
393
|
+
*/
|
|
394
|
+
isDisabled(value) {
|
|
395
|
+
if (Array.isArray(value)) {
|
|
396
|
+
// 对于数组,如果任意一个值被禁用,则认为整体被禁用
|
|
397
|
+
return value.some(val => {
|
|
398
|
+
return this.mixinDatacomResData.some(item => item.value === val && item.disable);
|
|
399
|
+
});
|
|
400
|
+
} else {
|
|
401
|
+
let isDisabled = false;
|
|
402
|
+
this.mixinDatacomResData.forEach(item => {
|
|
403
|
+
if (item.value === value) {
|
|
404
|
+
isDisabled = item.disable
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
return isDisabled;
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
clearVal() {
|
|
411
|
+
const emptyValue = this.multiple ? [] : '';
|
|
412
|
+
this.emit(emptyValue)
|
|
413
|
+
this.current = this.multiple ? [] : ''
|
|
414
|
+
if (this.collection) {
|
|
415
|
+
this.removeCache()
|
|
416
|
+
}
|
|
417
|
+
this.$emit('clear')
|
|
418
|
+
},
|
|
419
|
+
checkBoxChange(res){
|
|
420
|
+
let range = res.detail.value
|
|
421
|
+
|
|
422
|
+
let currentValues = range && range.length > 0? range.map((item)=>{
|
|
423
|
+
const index = parseInt(item, 10);
|
|
424
|
+
|
|
425
|
+
if (isNaN(index)) {
|
|
426
|
+
console.error(`无效索引: ${item}`);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (index < 0 || index >= this.mixinDatacomResData.length) {
|
|
430
|
+
console.error(`索引越界: ${index}`);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return this.mixinDatacomResData[index].value;
|
|
434
|
+
}) : []
|
|
435
|
+
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
|
|
436
|
+
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
|
|
437
|
+
|
|
438
|
+
this.emit(currentValues);
|
|
439
|
+
},
|
|
440
|
+
change(item) {
|
|
441
|
+
if (!item.disable) {
|
|
442
|
+
if (this.multiple) {
|
|
443
|
+
// 多选模式
|
|
444
|
+
let currentValues = this.getCurrentValues();
|
|
445
|
+
if (!Array.isArray(currentValues)) {
|
|
446
|
+
currentValues = currentValues ? [currentValues] : [];
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const itemValue = item.value;
|
|
450
|
+
const index = currentValues.indexOf(itemValue);
|
|
451
|
+
|
|
452
|
+
if (index > -1) {
|
|
453
|
+
currentValues.splice(index, 1);
|
|
454
|
+
} else {
|
|
455
|
+
currentValues.push(itemValue);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
|
|
459
|
+
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
|
|
460
|
+
|
|
461
|
+
this.emit(currentValues);
|
|
462
|
+
} else {
|
|
463
|
+
// 单选模式
|
|
464
|
+
this.showSelector = false
|
|
465
|
+
this.current = this.formatItemName(item)
|
|
466
|
+
this.emit(item.value)
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
emit(val) {
|
|
471
|
+
this.$emit('input', val)
|
|
472
|
+
this.$emit('update:modelValue', val)
|
|
473
|
+
this.$emit('change', val)
|
|
474
|
+
if (this.collection) {
|
|
475
|
+
this.setCache(val);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
toggleSelector() {
|
|
479
|
+
if (this.disabled) {
|
|
480
|
+
return
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
this.showSelector = !this.showSelector
|
|
484
|
+
},
|
|
485
|
+
formatItemName(item) {
|
|
486
|
+
let {
|
|
487
|
+
text,
|
|
488
|
+
value,
|
|
489
|
+
channel_code
|
|
490
|
+
} = item
|
|
491
|
+
channel_code = channel_code ? `(${channel_code})` : ''
|
|
492
|
+
|
|
493
|
+
if (this.format) {
|
|
494
|
+
// 格式化输出
|
|
495
|
+
let str = "";
|
|
496
|
+
str = this.format;
|
|
497
|
+
for (let key in item) {
|
|
498
|
+
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
|
|
499
|
+
}
|
|
500
|
+
return str;
|
|
501
|
+
} else {
|
|
502
|
+
return this.collection.indexOf('app-list') > 0 ?
|
|
503
|
+
`${text}(${value})` :
|
|
504
|
+
(
|
|
505
|
+
text ?
|
|
506
|
+
text :
|
|
507
|
+
`未命名${channel_code}`
|
|
508
|
+
)
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
// 获取当前加载的数据
|
|
512
|
+
getLoadData() {
|
|
513
|
+
return this.mixinDatacomResData;
|
|
514
|
+
},
|
|
515
|
+
// 获取当前缓存key
|
|
516
|
+
getCurrentCacheKey() {
|
|
517
|
+
return this.collection;
|
|
518
|
+
},
|
|
519
|
+
// 获取缓存
|
|
520
|
+
getCache(name = this.getCurrentCacheKey()) {
|
|
521
|
+
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
522
|
+
return cacheData[name];
|
|
523
|
+
},
|
|
524
|
+
// 设置缓存
|
|
525
|
+
setCache(value, name = this.getCurrentCacheKey()) {
|
|
526
|
+
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
527
|
+
cacheData[name] = value;
|
|
528
|
+
uni.setStorageSync(this.cacheKey, cacheData);
|
|
529
|
+
},
|
|
530
|
+
// 删除缓存
|
|
531
|
+
removeCache(name = this.getCurrentCacheKey()) {
|
|
532
|
+
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
533
|
+
delete cacheData[name];
|
|
534
|
+
uni.setStorageSync(this.cacheKey, cacheData);
|
|
535
|
+
},
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
</script>
|
|
539
|
+
|
|
540
|
+
<style lang="scss">
|
|
541
|
+
$uni-base-color: #6a6a6a !default;
|
|
542
|
+
$uni-main-color: #333 !default;
|
|
543
|
+
$uni-secondary-color: #909399 !default;
|
|
544
|
+
$uni-border-3: #e5e5e5;
|
|
545
|
+
$uni-primary: #2979ff !default;
|
|
546
|
+
$uni-success: #4cd964 !default;
|
|
547
|
+
$uni-warning: #f0ad4e !default;
|
|
548
|
+
$uni-error: #dd524d !default;
|
|
549
|
+
$uni-info: #909399 !default;
|
|
550
|
+
|
|
551
|
+
/* #ifndef APP-NVUE */
|
|
552
|
+
@media screen and (max-width: 500px) {
|
|
553
|
+
.hide-on-phone {
|
|
554
|
+
display: none;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/* #endif */
|
|
559
|
+
.uni-stat__select {
|
|
560
|
+
display: flex;
|
|
561
|
+
align-items: center;
|
|
562
|
+
// padding: 15px;
|
|
563
|
+
/* #ifdef H5 */
|
|
564
|
+
cursor: pointer;
|
|
565
|
+
/* #endif */
|
|
566
|
+
width: 100%;
|
|
567
|
+
flex: 1;
|
|
568
|
+
box-sizing: border-box;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.uni-stat-box {
|
|
572
|
+
background-color: #fff;
|
|
573
|
+
width: 100%;
|
|
574
|
+
flex: 1;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.uni-stat__actived {
|
|
578
|
+
width: 100%;
|
|
579
|
+
flex: 1;
|
|
580
|
+
// outline: 1px solid #2979ff;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.uni-label-text {
|
|
584
|
+
font-size: 14px;
|
|
585
|
+
font-weight: bold;
|
|
586
|
+
color: $uni-base-color;
|
|
587
|
+
margin: auto 0;
|
|
588
|
+
margin-right: 5px;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.border-bottom {
|
|
592
|
+
border-bottom: solid 1px $uni-border-3;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.border-default {
|
|
596
|
+
border: 1px solid $uni-border-3;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.uni-select {
|
|
600
|
+
font-size: 14px;
|
|
601
|
+
box-sizing: border-box;
|
|
602
|
+
border-radius: 4px;
|
|
603
|
+
padding: 0 5px;
|
|
604
|
+
padding-left: 10px;
|
|
605
|
+
position: relative;
|
|
606
|
+
/* #ifndef APP-NVUE */
|
|
607
|
+
display: flex;
|
|
608
|
+
user-select: none;
|
|
609
|
+
/* #endif */
|
|
610
|
+
flex-direction: row;
|
|
611
|
+
align-items: center;
|
|
612
|
+
width: 100%;
|
|
613
|
+
flex: 1;
|
|
614
|
+
min-height: 35px;
|
|
615
|
+
|
|
616
|
+
&--disabled {
|
|
617
|
+
background-color: #f5f7fa;
|
|
618
|
+
cursor: not-allowed;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
&--wrap {
|
|
622
|
+
height: auto;
|
|
623
|
+
min-height: 35px;
|
|
624
|
+
// align-items: flex-start;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.uni-select__label {
|
|
629
|
+
font-size: 16px;
|
|
630
|
+
// line-height: 22px;
|
|
631
|
+
height: 35px;
|
|
632
|
+
padding-right: 10px;
|
|
633
|
+
color: $uni-secondary-color;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.uni-select__input-box {
|
|
637
|
+
// height: 35px;
|
|
638
|
+
width: 0px;
|
|
639
|
+
position: relative;
|
|
640
|
+
/* #ifndef APP-NVUE */
|
|
641
|
+
display: flex;
|
|
642
|
+
/* #endif */
|
|
643
|
+
flex: 1;
|
|
644
|
+
flex-direction: row;
|
|
645
|
+
align-items: center;
|
|
646
|
+
|
|
647
|
+
&--wrap {
|
|
648
|
+
.uni-select__input-text {
|
|
649
|
+
margin-right: 8px;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.padding-top-bottom {
|
|
654
|
+
padding-top: 5px;
|
|
655
|
+
padding-bottom: 5px;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.slot-content {
|
|
659
|
+
width: 100%;
|
|
660
|
+
display: flex;
|
|
661
|
+
flex-direction: row;
|
|
662
|
+
flex-wrap: wrap;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.uni-select__input {
|
|
667
|
+
flex: 1;
|
|
668
|
+
font-size: 14px;
|
|
669
|
+
height: 22px;
|
|
670
|
+
line-height: 22px;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.uni-select__input-plac {
|
|
674
|
+
font-size: 14px;
|
|
675
|
+
color: $uni-secondary-color;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.uni-select__selector {
|
|
679
|
+
/* #ifndef APP-NVUE */
|
|
680
|
+
box-sizing: border-box;
|
|
681
|
+
/* #endif */
|
|
682
|
+
position: absolute;
|
|
683
|
+
left: 0;
|
|
684
|
+
width: 100%;
|
|
685
|
+
background-color: #FFFFFF;
|
|
686
|
+
border: 1px solid #EBEEF5;
|
|
687
|
+
border-radius: 6px;
|
|
688
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
689
|
+
z-index: 3;
|
|
690
|
+
padding: 4px 0;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.uni-select__selector-scroll {
|
|
694
|
+
/* #ifndef APP-NVUE */
|
|
695
|
+
max-height: 200px;
|
|
696
|
+
box-sizing: border-box;
|
|
697
|
+
/* #endif */
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/* #ifdef H5 */
|
|
701
|
+
@media (min-width: 768px) {
|
|
702
|
+
.uni-select__selector-scroll {
|
|
703
|
+
max-height: 600px;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/* #endif */
|
|
708
|
+
|
|
709
|
+
.uni-select__selector-empty,
|
|
710
|
+
.uni-select__selector-item {
|
|
711
|
+
/* #ifndef APP-NVUE */
|
|
712
|
+
display: flex;
|
|
713
|
+
cursor: pointer;
|
|
714
|
+
/* #endif */
|
|
715
|
+
flex-direction: row;
|
|
716
|
+
align-items: center;
|
|
717
|
+
line-height: 35px;
|
|
718
|
+
font-size: 14px;
|
|
719
|
+
/* border-bottom: solid 1px $uni-border-3; */
|
|
720
|
+
padding: 0px 10px;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
.uni-select__selector-item-check {
|
|
726
|
+
margin-left: auto;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.uni-select__selector-empty:last-child,
|
|
730
|
+
.uni-select__selector-item:last-child {
|
|
731
|
+
/* #ifndef APP-NVUE */
|
|
732
|
+
border-bottom: none;
|
|
733
|
+
/* #endif */
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
.uni-select__selector__disabled {
|
|
737
|
+
opacity: 0.4;
|
|
738
|
+
cursor: default;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/* picker 弹出层通用的指示小三角 */
|
|
742
|
+
.uni-popper__arrow_bottom,
|
|
743
|
+
.uni-popper__arrow_bottom::after,
|
|
744
|
+
.uni-popper__arrow_top,
|
|
745
|
+
.uni-popper__arrow_top::after {
|
|
746
|
+
position: absolute;
|
|
747
|
+
display: block;
|
|
748
|
+
width: 0;
|
|
749
|
+
height: 0;
|
|
750
|
+
border-color: transparent;
|
|
751
|
+
border-style: solid;
|
|
752
|
+
border-width: 6px;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
.uni-popper__arrow_bottom {
|
|
756
|
+
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
|
757
|
+
top: -6px;
|
|
758
|
+
left: 10%;
|
|
759
|
+
margin-right: 3px;
|
|
760
|
+
border-top-width: 0;
|
|
761
|
+
border-bottom-color: #EBEEF5;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.uni-popper__arrow_bottom::after {
|
|
765
|
+
content: " ";
|
|
766
|
+
top: 1px;
|
|
767
|
+
margin-left: -6px;
|
|
768
|
+
border-top-width: 0;
|
|
769
|
+
border-bottom-color: #fff;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.uni-popper__arrow_top {
|
|
773
|
+
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
|
774
|
+
bottom: -6px;
|
|
775
|
+
left: 10%;
|
|
776
|
+
margin-right: 3px;
|
|
777
|
+
border-bottom-width: 0;
|
|
778
|
+
border-top-color: #EBEEF5;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.uni-popper__arrow_top::after {
|
|
782
|
+
content: " ";
|
|
783
|
+
bottom: 1px;
|
|
784
|
+
margin-left: -6px;
|
|
785
|
+
border-bottom-width: 0;
|
|
786
|
+
border-top-color: #fff;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
.uni-select__input-text {
|
|
791
|
+
// width: 280px;
|
|
792
|
+
width: 100%;
|
|
793
|
+
color: $uni-main-color;
|
|
794
|
+
white-space: nowrap;
|
|
795
|
+
text-overflow: ellipsis;
|
|
796
|
+
-o-text-overflow: ellipsis;
|
|
797
|
+
overflow: hidden;
|
|
798
|
+
|
|
799
|
+
&--wrap {
|
|
800
|
+
white-space: normal;
|
|
801
|
+
text-overflow: initial;
|
|
802
|
+
-o-text-overflow: initial;
|
|
803
|
+
overflow: visible;
|
|
804
|
+
word-wrap: break-word;
|
|
805
|
+
word-break: break-all;
|
|
806
|
+
// line-height: 1.5;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
.uni-select__input-placeholder {
|
|
811
|
+
color: $uni-base-color;
|
|
812
|
+
font-size: 12px;
|
|
813
|
+
margin: 1px 0;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.uni-select--mask {
|
|
817
|
+
position: fixed;
|
|
818
|
+
top: 0;
|
|
819
|
+
bottom: 0;
|
|
820
|
+
right: 0;
|
|
821
|
+
left: 0;
|
|
822
|
+
z-index: 2;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.align-left {
|
|
826
|
+
text-align: left;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.align-center {
|
|
830
|
+
text-align: center;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.align-right {
|
|
834
|
+
text-align: right;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
</style>
|