jufubao-forms 1.0.0-beta1
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/README.md +27 -0
- package/commands.js +84 -0
- package/commands.update.change.js +176 -0
- package/file.config.js +16 -0
- package/get.package.path.js +22 -0
- package/get.package.path.js.tpl +22 -0
- package/package.json +119 -0
- package/src/CreateClientID.js +16 -0
- package/src/ICONS.js +1148 -0
- package/src/common/authorize.js +261 -0
- package/src/common/getBusinessImageUrl.js +39 -0
- package/src/common/getServiceUrl.js +38 -0
- package/src/common/paysdk/jweixin.js +98 -0
- package/src/components/CusCouponChose/CusCouponChose.vue +1024 -0
- package/src/components/CusCouponItem/CusCouponItem.vue +298 -0
- package/src/components/CusEnter/CusEnter.vue +333 -0
- package/src/components/CusPoster/CusPoster.vue +213 -0
- package/src/components/CusPoster/CusSwiperDot.vue +234 -0
- package/src/components/CusProduct/CusProduct.vue +362 -0
- package/src/components/CusSwiperDot/CusSwiperDot.vue +234 -0
- package/src/components/CusTab/CusTab.vue +411 -0
- package/src/components/CusVideo/CusVideo.vue +170 -0
- package/src/components/JfbFormsDynamicForm/Api.js +66 -0
- package/src/components/JfbFormsDynamicForm/Attr.js +35 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicForm.vue +767 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormLess.less +79 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormMixin.js +30 -0
- package/src/components/JfbFormsDynamicForm/Mock.js +194 -0
- package/src/components/JfbFormsDynamicForm/XdFormDate.vue +71 -0
- package/src/components/JfbFormsDynamicForm/ld-select/ld-select.vue +329 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar-item.vue +177 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar.vue +930 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/en.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/index.js +8 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/time-picker.vue +934 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/uni-datetime-picker.vue +1042 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/util.js +403 -0
- package/src/components/JfbFormsList/Api.js +20 -0
- package/src/components/JfbFormsList/Attr.js +70 -0
- package/src/components/JfbFormsList/JfbFormsList.vue +228 -0
- package/src/components/JfbFormsList/JfbFormsListLess.less +79 -0
- package/src/components/JfbFormsList/JfbFormsListMixin.js +30 -0
- package/src/components/JfbFormsList/Mock.js +38 -0
- package/src/components/JfbFormsQuestionAndAnswer/Api.js +43 -0
- package/src/components/JfbFormsQuestionAndAnswer/Attr.js +14 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswer.vue +506 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerLess.less +79 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerMixin.js +30 -0
- package/src/components/JfbFormsQuestionAndAnswer/Mock.js +144 -0
- package/src/components/SkeProduct/SkeProduct.vue +241 -0
- package/src/config.app.plus.js +6 -0
- package/src/config.h5.js +13 -0
- package/src/config.mp.weixin.js +13 -0
- package/src/config.project.js +15 -0
- package/src/mixins/cardListMixins.js +187 -0
- package/src/mixins/colorCardMixins.js +122 -0
- package/src/mixins/componentsMixins.js +900 -0
- package/src/mixins/extsMixins.js +3 -0
- package/src/mixins/locationMixins.js +119 -0
- package/src/mixins/newLocaltionMixins.js +754 -0
- package/src/mixins/openDebuggerMixins.js +74 -0
- package/src/mixins/pageEditx.js +347 -0
- package/src/mixins/pageEvent.js +311 -0
- package/src/mixins/pageMain.js +120 -0
- package/src/mixins/pageUitls.js +738 -0
- package/src/mixins/posterMixins.js +122 -0
- package/src/mixins/scrollListFixedHeigthMixins.js +174 -0
- package/src/mocks.js +4 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc 获取绝对路径完整地址
|
|
3
|
+
* @param @path
|
|
4
|
+
**/
|
|
5
|
+
//例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
|
|
6
|
+
@basePath: 'business/';
|
|
7
|
+
@doMain: '//sandbox-img.jufubao.cn/';
|
|
8
|
+
|
|
9
|
+
.getBusinessImageUrl(@path, @size: 'size8') {
|
|
10
|
+
@url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
|
|
11
|
+
background-image: url(@url);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//start
|
|
15
|
+
.jfb-forms-dynamic-form {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
|
|
18
|
+
&__body{
|
|
19
|
+
position: relative;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
z-index: 2
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.editx,&.editx:hover {
|
|
25
|
+
position: relative;
|
|
26
|
+
min-height: unit(100, rpx);
|
|
27
|
+
z-index: 3;
|
|
28
|
+
&::after {
|
|
29
|
+
border: 2rpx dashed blue;
|
|
30
|
+
content: " ";
|
|
31
|
+
position: absolute;
|
|
32
|
+
top:0;
|
|
33
|
+
left:0;
|
|
34
|
+
bottom:0;
|
|
35
|
+
right:0;
|
|
36
|
+
z-index: var(--preview-z-index);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
&__edit {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: absolute;
|
|
46
|
+
right: unit(0, rpx);
|
|
47
|
+
top: unit(-52, rpx);
|
|
48
|
+
height: unit(50, rpx);
|
|
49
|
+
line-height: unit(50, rpx);
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
background: rgba(0, 0, 0, .6);
|
|
54
|
+
border-radius: unit(10, rpx);
|
|
55
|
+
box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
|
|
56
|
+
color: #fff;
|
|
57
|
+
font-size: unit(22, rpx);
|
|
58
|
+
|
|
59
|
+
&-icon{
|
|
60
|
+
padding: 0 unit(20, rpx);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.editx {
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**notPreview**/
|
|
73
|
+
.jfb-forms-dynamic-form {
|
|
74
|
+
//&:before {
|
|
75
|
+
//content: " ";
|
|
76
|
+
//display: table;
|
|
77
|
+
//}
|
|
78
|
+
}
|
|
79
|
+
/**endNotPreview**/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
//@AttrImport
|
|
5
|
+
import Attr from "./Attr";
|
|
6
|
+
//@EndAttrImport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
//#ifdef H5
|
|
13
|
+
|
|
14
|
+
//@AttrData
|
|
15
|
+
Attr:{}, //对外开发编辑属性
|
|
16
|
+
//@EndAttrData
|
|
17
|
+
|
|
18
|
+
// #endif
|
|
19
|
+
cssRoot: 'jfb-forms-dynamic-form'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
created() {
|
|
23
|
+
|
|
24
|
+
//@AttrDataCreated
|
|
25
|
+
this.Attr = this.$xdUniHelper.customClone(Attr);
|
|
26
|
+
//@EndAttrDataCreated
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
getDynamicForm: {
|
|
5
|
+
form_name: "普益调查",
|
|
6
|
+
list: [
|
|
7
|
+
{
|
|
8
|
+
field_id: 1,
|
|
9
|
+
field_value: "field_1",
|
|
10
|
+
form_id: 2,
|
|
11
|
+
field_name: "姓名",
|
|
12
|
+
field_type: "text",
|
|
13
|
+
explain: "昵称",
|
|
14
|
+
required: true,
|
|
15
|
+
options: [],
|
|
16
|
+
default: "",
|
|
17
|
+
placeholder: "请输入姓名",
|
|
18
|
+
validate_type: "all",
|
|
19
|
+
validate_rules:
|
|
20
|
+
'{"rule":{"label":"\\u4e0d\\u9650\\u5236","limit":["length_range","default_value","placeholder"],"value":"all","RegExp":"^.*$"},"limit":{"max":"5","min":"1","placeholder":"\\u8bf7\\u8f93\\u5165\\u59d3\\u540d"}}',
|
|
21
|
+
sort: 0,
|
|
22
|
+
created_time: 1721789997,
|
|
23
|
+
updated_time: 1721879197
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
field_id: 5,
|
|
27
|
+
field_value: "field_5",
|
|
28
|
+
form_id: 2,
|
|
29
|
+
field_name: "预约日期",
|
|
30
|
+
field_type: "date",
|
|
31
|
+
explain: "",
|
|
32
|
+
required: true,
|
|
33
|
+
options: [],
|
|
34
|
+
default: "",
|
|
35
|
+
placeholder: "请选择预约日期",
|
|
36
|
+
validate_type: "datetime",
|
|
37
|
+
validate_rules: '{"date_range":"after"}',
|
|
38
|
+
sort: 0,
|
|
39
|
+
created_time: 1721877747,
|
|
40
|
+
updated_time: 1722246228
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
field_id: 9,
|
|
44
|
+
field_value: "field_9",
|
|
45
|
+
form_id: 2,
|
|
46
|
+
field_name: "邮箱",
|
|
47
|
+
field_type: "text",
|
|
48
|
+
explain: "",
|
|
49
|
+
required: false,
|
|
50
|
+
options: [],
|
|
51
|
+
default: "jufubao@163.com",
|
|
52
|
+
placeholder: "邮箱",
|
|
53
|
+
validate_type: "email",
|
|
54
|
+
validate_rules:
|
|
55
|
+
'{"rule":{"label":"\\u90ae\\u7bb1","limit":["default_value"],"value":"email","RegExp":"\\\\w+([-+.]\\\\w+)*@\\\\w+([-.]\\\\w+)*\\\\.\\\\w+([-.]\\\\w+)*"},"limit":{"defaultValue":"jufubao@163.com"}}',
|
|
56
|
+
sort: 0,
|
|
57
|
+
created_time: 1722224238,
|
|
58
|
+
updated_time: 1722224971
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
field_id: 14,
|
|
62
|
+
field_value: "field_14",
|
|
63
|
+
form_id: 2,
|
|
64
|
+
field_name: "出生日期",
|
|
65
|
+
field_type: "datepicker",
|
|
66
|
+
explain: "",
|
|
67
|
+
required: false,
|
|
68
|
+
options: [],
|
|
69
|
+
default: "",
|
|
70
|
+
placeholder: "",
|
|
71
|
+
validate_type: "day",
|
|
72
|
+
validate_rules: "null",
|
|
73
|
+
sort: 0,
|
|
74
|
+
created_time: 1722242079,
|
|
75
|
+
updated_time: 1722243046
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
field_id: 8,
|
|
79
|
+
field_value: "field_8",
|
|
80
|
+
form_id: 2,
|
|
81
|
+
field_name: "手机号",
|
|
82
|
+
field_type: "text",
|
|
83
|
+
explain: "手机号注重个人隐私",
|
|
84
|
+
required: true,
|
|
85
|
+
options: [],
|
|
86
|
+
default: "",
|
|
87
|
+
placeholder: "请输入手机号",
|
|
88
|
+
validate_type: "phone",
|
|
89
|
+
validate_rules:
|
|
90
|
+
'{"rule":{"label":"\\u624b\\u673a\\u53f7","limit":[],"value":"phone","RegExp":"^1[3-9][0-9]{9}$"},"limit":[]}',
|
|
91
|
+
sort: 5,
|
|
92
|
+
created_time: 1722220289,
|
|
93
|
+
updated_time: 1722246042
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
request_id: "054e1fa215fd98a6"
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
getSaasDynamicForm: {
|
|
100
|
+
form_name: "普益调查",
|
|
101
|
+
list: [
|
|
102
|
+
{
|
|
103
|
+
field_id: 1,
|
|
104
|
+
field_value: "field_1",
|
|
105
|
+
form_id: 2,
|
|
106
|
+
field_name: "姓名",
|
|
107
|
+
field_type: "text",
|
|
108
|
+
explain: "昵称",
|
|
109
|
+
required: true,
|
|
110
|
+
options: [],
|
|
111
|
+
default: "",
|
|
112
|
+
placeholder: "请输入姓名",
|
|
113
|
+
validate_type: "all",
|
|
114
|
+
validate_rules:
|
|
115
|
+
'{"rule":{"label":"\\u4e0d\\u9650\\u5236","limit":["length_range","default_value","placeholder"],"value":"all","RegExp":"^.*$"},"limit":{"max":"5","min":"1","placeholder":"\\u8bf7\\u8f93\\u5165\\u59d3\\u540d"}}',
|
|
116
|
+
sort: 0,
|
|
117
|
+
created_time: 1721789997,
|
|
118
|
+
updated_time: 1721879197
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
field_id: 5,
|
|
122
|
+
field_value: "field_5",
|
|
123
|
+
form_id: 2,
|
|
124
|
+
field_name: "预约日期",
|
|
125
|
+
field_type: "date",
|
|
126
|
+
explain: "",
|
|
127
|
+
required: true,
|
|
128
|
+
options: [],
|
|
129
|
+
default: "",
|
|
130
|
+
placeholder: "请选择预约日期",
|
|
131
|
+
validate_type: "datetime",
|
|
132
|
+
validate_rules: '{"date_range":"after"}',
|
|
133
|
+
sort: 0,
|
|
134
|
+
created_time: 1721877747,
|
|
135
|
+
updated_time: 1722246228
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
field_id: 9,
|
|
139
|
+
field_value: "field_9",
|
|
140
|
+
form_id: 2,
|
|
141
|
+
field_name: "邮箱",
|
|
142
|
+
field_type: "text",
|
|
143
|
+
explain: "",
|
|
144
|
+
required: false,
|
|
145
|
+
options: [],
|
|
146
|
+
default: "jufubao@163.com",
|
|
147
|
+
placeholder: "邮箱",
|
|
148
|
+
validate_type: "email",
|
|
149
|
+
validate_rules:
|
|
150
|
+
'{"rule":{"label":"\\u90ae\\u7bb1","limit":["default_value"],"value":"email","RegExp":"\\\\w+([-+.]\\\\w+)*@\\\\w+([-.]\\\\w+)*\\\\.\\\\w+([-.]\\\\w+)*"},"limit":{"defaultValue":"jufubao@163.com"}}',
|
|
151
|
+
sort: 0,
|
|
152
|
+
created_time: 1722224238,
|
|
153
|
+
updated_time: 1722224971
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
field_id: 14,
|
|
157
|
+
field_value: "field_14",
|
|
158
|
+
form_id: 2,
|
|
159
|
+
field_name: "出生日期",
|
|
160
|
+
field_type: "datepicker",
|
|
161
|
+
explain: "",
|
|
162
|
+
required: false,
|
|
163
|
+
options: [],
|
|
164
|
+
default: "",
|
|
165
|
+
placeholder: "",
|
|
166
|
+
validate_type: "day",
|
|
167
|
+
validate_rules: "null",
|
|
168
|
+
sort: 0,
|
|
169
|
+
created_time: 1722242079,
|
|
170
|
+
updated_time: 1722243046
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
field_id: 8,
|
|
174
|
+
field_value: "field_8",
|
|
175
|
+
form_id: 2,
|
|
176
|
+
field_name: "手机号",
|
|
177
|
+
field_type: "text",
|
|
178
|
+
explain: "手机号注重个人隐私",
|
|
179
|
+
required: true,
|
|
180
|
+
options: [],
|
|
181
|
+
default: "",
|
|
182
|
+
placeholder: "请输入手机号",
|
|
183
|
+
validate_type: "phone",
|
|
184
|
+
validate_rules:
|
|
185
|
+
'{"rule":{"label":"\\u624b\\u673a\\u53f7","limit":[],"value":"phone","RegExp":"^1[3-9][0-9]{9}$"},"limit":[]}',
|
|
186
|
+
sort: 5,
|
|
187
|
+
created_time: 1722220289,
|
|
188
|
+
updated_time: 1722246042
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
request_id: "054e1fa215fd98a6"
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="xd-form-date">
|
|
3
|
+
<view @click="handleShowDate" class="form-column">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
<xd-font-icon icon="iconriqi" :size="32" :color="'#666666'"></xd-font-icon>
|
|
6
|
+
</view>
|
|
7
|
+
<xd-down-drawer :show.sync="showDate">
|
|
8
|
+
<xd-date
|
|
9
|
+
:main-color="'#FF5733'"
|
|
10
|
+
:start-date="start_date"
|
|
11
|
+
:end-date="end_date"
|
|
12
|
+
:selected="dateSelected"
|
|
13
|
+
@change="handleChange"
|
|
14
|
+
></xd-date>
|
|
15
|
+
</xd-down-drawer>
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
import XdDate from "@/components/XdDate/XdDate"
|
|
20
|
+
import XdDownDrawer from "@/components/XdDownDrawer/XdDownDrawer"
|
|
21
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon"
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: "XdFormDate",
|
|
25
|
+
components: {
|
|
26
|
+
XdDate,
|
|
27
|
+
XdDownDrawer,
|
|
28
|
+
XdFontIcon,
|
|
29
|
+
},
|
|
30
|
+
props: {},
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
showDate: false,
|
|
34
|
+
start_date: "",
|
|
35
|
+
end_date: "",
|
|
36
|
+
dateSelected: [],
|
|
37
|
+
chose_date: "",
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
handleChange(e){
|
|
42
|
+
this.chose_date = e.fulldate;
|
|
43
|
+
this.$emit("input", e.fulldate);
|
|
44
|
+
this.$emit("change", e.fulldate);
|
|
45
|
+
this.showDate = false;
|
|
46
|
+
},
|
|
47
|
+
handleShowDate(){
|
|
48
|
+
this.showDate = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style lang="less" scoped>
|
|
56
|
+
.xd-form-date{
|
|
57
|
+
height: 80rpx;
|
|
58
|
+
width: 100%;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
color: #666666;
|
|
62
|
+
font-size: 28rpx;
|
|
63
|
+
.form-column{
|
|
64
|
+
width: 100%;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: space-between;
|
|
68
|
+
padding: 0 20rpx;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="main">
|
|
3
|
+
<view class="input" :style="disabled?'background-color:#f5f7fa':''">
|
|
4
|
+
<view @click="showModal" class="content" :style="{'color': disabled || (!showVal && placeholder)? '#c0c4cc': ''}">{{showVal || placeholder}}</view>
|
|
5
|
+
<text v-if="clearable&&!disabled&&showVal" @click="empty" class="selectIcon iconcross"></text>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="select-modal" :class="isShowModal?'show':''" @tap="hideModal">
|
|
8
|
+
<view class="select-dialog" @tap.stop="" :style="{backgroundColor:bgColor}">
|
|
9
|
+
<view class="select-bar bg-white">
|
|
10
|
+
<view class="action text-blue" @tap="cancelClick">{{cancelText}}</view>
|
|
11
|
+
<view class="action text-green" @tap="confirmClick">{{confirmText}}</view>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="select-content">
|
|
14
|
+
<view class="select-item" v-for="(item,index) in list" :key="index"
|
|
15
|
+
:style="valueIndexOf(item)?'color:'+selectColor+';background-color:'+selectBgColor+';':'color:'+color+';'"
|
|
16
|
+
@click="select(item)">
|
|
17
|
+
<view class="title">{{getLabelKeyValue(item)}}</view>
|
|
18
|
+
<text class="selectIcon icongou" v-if="valueIndexOf(item)"></text>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
value:{
|
|
31
|
+
type:[Number,String,Array,Object],
|
|
32
|
+
default:null
|
|
33
|
+
},
|
|
34
|
+
placeholder:{ // 占位符
|
|
35
|
+
default: "",
|
|
36
|
+
type: String
|
|
37
|
+
},
|
|
38
|
+
multiple:{ // 是否多选
|
|
39
|
+
default: false,
|
|
40
|
+
type: Boolean
|
|
41
|
+
},
|
|
42
|
+
list: {
|
|
43
|
+
default: () => [],
|
|
44
|
+
type: Array
|
|
45
|
+
},
|
|
46
|
+
valueKey:{ // 指定list中valueKey的值作为下拉框绑定内容
|
|
47
|
+
default: 'value',
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
50
|
+
labelKey:{ // 指定list中labelKey的值作为下拉框显示内容
|
|
51
|
+
default: 'label',
|
|
52
|
+
type: String
|
|
53
|
+
},
|
|
54
|
+
disabled: {
|
|
55
|
+
default: false,
|
|
56
|
+
type: Boolean
|
|
57
|
+
},
|
|
58
|
+
clearable:{
|
|
59
|
+
default: false,
|
|
60
|
+
type: Boolean
|
|
61
|
+
},
|
|
62
|
+
cancelText:{
|
|
63
|
+
default: "取消",
|
|
64
|
+
type: String
|
|
65
|
+
},
|
|
66
|
+
confirmText:{
|
|
67
|
+
default: "确定",
|
|
68
|
+
type: String
|
|
69
|
+
},
|
|
70
|
+
color:{
|
|
71
|
+
default: "#000000",
|
|
72
|
+
type: String
|
|
73
|
+
},
|
|
74
|
+
selectColor:{
|
|
75
|
+
default: "#0081ff",
|
|
76
|
+
type: String
|
|
77
|
+
},
|
|
78
|
+
bgColor:{
|
|
79
|
+
default: "#F1F1F1",
|
|
80
|
+
type: String
|
|
81
|
+
},
|
|
82
|
+
selectBgColor:{
|
|
83
|
+
default: "#FFFFFF",
|
|
84
|
+
type: String
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
isShowModal:false,
|
|
90
|
+
uiValue: ""
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
value: {
|
|
95
|
+
handler(val) {
|
|
96
|
+
console.log("watch value", val);
|
|
97
|
+
// this.$emit('input', val);
|
|
98
|
+
},
|
|
99
|
+
deep: true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
computed: {
|
|
103
|
+
showVal(){
|
|
104
|
+
if(Array.isArray(this.uiValue)){
|
|
105
|
+
return this.uiValue.join(",")
|
|
106
|
+
}
|
|
107
|
+
return this.uiValue
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
created() {
|
|
111
|
+
if(this.multiple){
|
|
112
|
+
if(Array.isArray(this.value)){
|
|
113
|
+
this.uiValue = this.value;
|
|
114
|
+
} else {
|
|
115
|
+
if(typeof this.value === 'string'){
|
|
116
|
+
this.uiValue = this.value.split(",")
|
|
117
|
+
} else {
|
|
118
|
+
this.uiValue = []
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}else{
|
|
122
|
+
this.uiValue = this.value;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
select(item){ // 点击选项
|
|
128
|
+
let val = this.getValueKeyValue(item);
|
|
129
|
+
if(this.multiple){
|
|
130
|
+
let _value = this.uiValue || [];
|
|
131
|
+
if(!Array.isArray(_value)){
|
|
132
|
+
_value = _value.split(",")
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let index = _value.indexOf(val);
|
|
136
|
+
if(index!=-1){
|
|
137
|
+
_value.splice(index,1)
|
|
138
|
+
this.setInput(_value);
|
|
139
|
+
} else {
|
|
140
|
+
_value.push(val)
|
|
141
|
+
this.setInput(_value);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
this.setInput(val);
|
|
145
|
+
this.hideModal()
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
valueIndexOf(item){
|
|
149
|
+
let val = this.getValueKeyValue(item);
|
|
150
|
+
if(Array.isArray(this.uiValue)){
|
|
151
|
+
return this.uiValue.indexOf(val)!=-1
|
|
152
|
+
} else {
|
|
153
|
+
return this.uiValue === val
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
getLabelKeyValue(item){ // 获取label
|
|
157
|
+
return item[this.labelKey]
|
|
158
|
+
// if(item){
|
|
159
|
+
// return item[this.labelKey]
|
|
160
|
+
// } else {
|
|
161
|
+
// return item
|
|
162
|
+
// }
|
|
163
|
+
},
|
|
164
|
+
getValueKeyValue(item){ // 获取value
|
|
165
|
+
return item[this.valueKey]
|
|
166
|
+
},
|
|
167
|
+
empty(){ // 清空
|
|
168
|
+
if(this.multiple){
|
|
169
|
+
this.setInput([]);
|
|
170
|
+
} else {
|
|
171
|
+
this.setInput('');
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
setInput(val){
|
|
175
|
+
console.log("setInput", val)
|
|
176
|
+
this.uiValue = val;
|
|
177
|
+
this.$emit('change', val)
|
|
178
|
+
this.$emit('input', val)
|
|
179
|
+
},
|
|
180
|
+
cancelClick(){ // 点击取消
|
|
181
|
+
this.$emit('cancel', this.value)
|
|
182
|
+
this.hideModal()
|
|
183
|
+
},
|
|
184
|
+
confirmClick(){ // 点击确定
|
|
185
|
+
this.$emit('confirm', this.value)
|
|
186
|
+
this.hideModal()
|
|
187
|
+
},
|
|
188
|
+
showModal(){ // 显示model
|
|
189
|
+
if(!this.disabled){
|
|
190
|
+
this.isShowModal = true
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
hideModal(){ // 隐藏model
|
|
194
|
+
this.isShowModal = false
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</script>
|
|
199
|
+
<style>
|
|
200
|
+
@font-face {font-family: "selectIcon";
|
|
201
|
+
src: url('//at.alicdn.com/t/font_1833441_ycfzdhg2u3.eot?t=1590375117208'); /* IE9 */
|
|
202
|
+
src: url('//at.alicdn.com/t/font_1833441_ycfzdhg2u3.eot?t=1590375117208#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
|
203
|
+
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAMEAAsAAAAABvQAAAK4AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqBRIFCATYCJAMMCwgABCAFhQUHNRsfBsg+QCa3uoO0oAJTMwhxVu965keqWBy1hkbwtfzWb2Z279/shRhJisKF6FApKLI7oyBbpAaHo3w24k+ca9EUJbDmjaeznUdZ/FOUlkWdJ33rizZY/Pw6J5Xw0qKYxHTMesePHVT6EFpaC4zV70sKi2bYgNPc1w0WHnDVC/e/UnNTgyP+4Jq6BBpIHoisgypLaIAFEtU0wgeaIG8Yu4nAIZwnUK1QgFfOT6nUUoBpgXjj2lqplTMpiuXtCW3N2iK+aPTS2/Qdnzny8d+5IEiaDMy99exklra//FrKnX48pChmgrq5QcYRQCEe17ruqgqLAKv8WntwqwhpLms/nB5yW/iHRxJEC0QOgT3NnfgF01NBKvOuIzNoZdh5gJuAeGrsozE8vOJ7u5D832oz55039W5G+S52K0H+zNf1TJz07k26kqoQybRfwVFV4rjDS/K8EXUyuF1cXnT3weKS9Rvdm/xe7h8oA1hLwOR18R+Y4n4zwpr4z5SU089Vc+cpfWL+mn5APmT3Z39jeOs/GbWjK+DnmsuL/u6ehMX4j4yedSVkAUUuPh3TY022MtKZUEOtPqCb8Bkvnr5XT6imU0gGrEJW7aAL/gw0OhegVV2F6pC7uTOppirKIA4MFQhTrpCM+AbZlDu64L/QmAkQWlMhQXU75D07O9Gtl0PUYjTBLyAzOLNQYtypIEEjvsXtBLQTooV2nrQrGEau2gKmZlR4L8gwnGtBJbUn1diCOOQUnEkTkRAOeci9KHOQxvFro+tx3ZcGAaeljstCSBNDJuArgIyBYyy6OdZxAhHIELu1IC9AtgShCVtLltEKrSff1XoHJo3RC33hM63o3j6pSNkmqmIWEAtxFHB2OwoRBAfyeqE3r2ogHeF42dBhs7gvf7CukH5MmlUGOCpHihxFfs6TehDyKCqVAA==') format('woff2'),
|
|
204
|
+
url('//at.alicdn.com/t/font_1833441_ycfzdhg2u3.woff?t=1590375117208') format('woff'),
|
|
205
|
+
url('//at.alicdn.com/t/font_1833441_ycfzdhg2u3.ttf?t=1590375117208') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
|
|
206
|
+
url('//at.alicdn.com/t/font_1833441_ycfzdhg2u3.svg?t=1590375117208#selectIcon') format('svg'); /* iOS 4.1- */
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.selectIcon {
|
|
210
|
+
position: absolute;
|
|
211
|
+
right: 16rpx;
|
|
212
|
+
font-family: "selectIcon" !important;
|
|
213
|
+
font-size: 16px;
|
|
214
|
+
font-style: normal;
|
|
215
|
+
-webkit-font-smoothing: antialiased;
|
|
216
|
+
-moz-osx-font-smoothing: grayscale;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.icongou:before {
|
|
220
|
+
content: "\e61c";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.iconcross:before {
|
|
224
|
+
content: "\e61a";
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
</style>
|
|
228
|
+
<style lang="scss" scoped>
|
|
229
|
+
.main{
|
|
230
|
+
font-size: 28rpx;
|
|
231
|
+
}
|
|
232
|
+
.bg-white{
|
|
233
|
+
background-color: #FFFFFF;
|
|
234
|
+
}
|
|
235
|
+
.text-blue{
|
|
236
|
+
color: #0081ff;
|
|
237
|
+
}
|
|
238
|
+
.text-green{
|
|
239
|
+
color: #39b54a;
|
|
240
|
+
}
|
|
241
|
+
.input {
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items:center;
|
|
244
|
+
font-size: 28rpx;
|
|
245
|
+
height: 60rpx;
|
|
246
|
+
padding: 10rpx 20rpx;
|
|
247
|
+
border-radius: 10rpx;
|
|
248
|
+
// border: 1rpx solid rgba(0, 0, 0, 0.1);
|
|
249
|
+
.content{
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items:center;
|
|
252
|
+
height:100%;
|
|
253
|
+
width: 100%;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
.select-modal {
|
|
257
|
+
position: fixed;
|
|
258
|
+
top: 0;
|
|
259
|
+
right: 0;
|
|
260
|
+
bottom: 0;
|
|
261
|
+
left: 0;
|
|
262
|
+
z-index: 9999;
|
|
263
|
+
opacity: 0;
|
|
264
|
+
outline: 0;
|
|
265
|
+
text-align: center;
|
|
266
|
+
-ms-transform: scale(1.185);
|
|
267
|
+
transform: scale(1.185);
|
|
268
|
+
backface-visibility: hidden;
|
|
269
|
+
perspective: 2000rpx;
|
|
270
|
+
background: rgba(0, 0, 0, 0.6);
|
|
271
|
+
transition: all 0.3s ease-in-out 0s;
|
|
272
|
+
pointer-events: none;
|
|
273
|
+
margin-bottom: -1000rpx;
|
|
274
|
+
&::before {
|
|
275
|
+
content: "\200B";
|
|
276
|
+
display: inline-block;
|
|
277
|
+
height: 100%;
|
|
278
|
+
vertical-align: bottom;
|
|
279
|
+
}
|
|
280
|
+
.select-dialog {
|
|
281
|
+
position: relative;
|
|
282
|
+
display: inline-block;
|
|
283
|
+
margin-left: auto;
|
|
284
|
+
margin-right: auto;
|
|
285
|
+
background-color: #f8f8f8;
|
|
286
|
+
overflow: hidden;
|
|
287
|
+
width: 100%;
|
|
288
|
+
border-radius: 0;
|
|
289
|
+
.select-content{
|
|
290
|
+
// background-color: #F1F1F1;
|
|
291
|
+
max-height: 420rpx;
|
|
292
|
+
overflow:auto;
|
|
293
|
+
.select-item{
|
|
294
|
+
position: relative;
|
|
295
|
+
padding: 20rpx;
|
|
296
|
+
display: flex;
|
|
297
|
+
.title{
|
|
298
|
+
flex: 1;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
.select-modal.show {
|
|
305
|
+
opacity: 1;
|
|
306
|
+
transition-duration: 0.3s;
|
|
307
|
+
-ms-transform: scale(1);
|
|
308
|
+
transform: scale(1);
|
|
309
|
+
overflow-x: hidden;
|
|
310
|
+
overflow-y: auto;
|
|
311
|
+
pointer-events: auto;
|
|
312
|
+
margin-bottom: calc(env(safe-area-inset-bottom) + 2px);
|
|
313
|
+
}
|
|
314
|
+
.select-bar {
|
|
315
|
+
padding: 0 20rpx;
|
|
316
|
+
display: flex;
|
|
317
|
+
position: relative;
|
|
318
|
+
align-items: center;
|
|
319
|
+
min-height: 80rpx;
|
|
320
|
+
justify-content: space-between;
|
|
321
|
+
.action {
|
|
322
|
+
display: flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
height: 100%;
|
|
325
|
+
justify-content: center;
|
|
326
|
+
max-width: 100%;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
</style>
|