Skip to content

Commit 8fa5960

Browse files
authored
Merge pull request vincentzyc#1 from vincentzyc/develop
Develop
2 parents d50b102 + ff2b975 commit 8fa5960

4 files changed

Lines changed: 88 additions & 10 deletions

File tree

‎src/assets/css/widget.styl‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,27 @@ $primary-background-color = #d8e8fa;
237237
text-align: center;
238238
// box-shadow: 0 3px 10px 1px #90c7ff;
239239
}
240+
241+
.wg-horizontal-picker {
242+
white-space: nowrap;
243+
height: 36px;
244+
line-height: 36px;
245+
margin: 0;
246+
padding: 0;
247+
248+
.picker-item {
249+
height: 100%;
250+
text-align: center;
251+
display: inline-block;
252+
padding: 0;
253+
white-space: nowrap;
254+
position: relative;
255+
overflow: hidden;
256+
text-overflow: ellipsis;
257+
color: #707274;
258+
box-sizing: border-box;
259+
backface-visibility: hidden;
260+
}
261+
}
240262
}
241263
}

‎src/assets/json/field-types.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
}, {
4848
"value": "accFund",
4949
"label": "是否有本地公积金"
50+
}],
51+
52+
"hPickerTypes": [{
53+
"value": "age",
54+
"label": "年龄"
55+
}, {
56+
"value": "amount",
57+
"label": "金额"
5058
}],
5159

5260
"dateTypes": [{

‎src/assets/json/widget.json‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"showLabel": false,
77
"labelTitle": "手机号",
88
"labelPosition": "left",
9-
"labelwidth": 50,
10-
"labelWidth": "50px",
9+
"labelwidth": 50,
10+
"labelWidth": "50px",
1111
"value": "",
1212
"apiKey": "phone",
1313
"codeValue": "",
@@ -23,11 +23,11 @@
2323
"type": "input",
2424
"name": "输入框",
2525
"placeholder": "请输入姓名",
26-
"showLabel": false,
26+
"showLabel": false,
2727
"labelTitle": "姓名",
2828
"labelPosition": "left",
29-
"labelwidth": 50,
30-
"labelWidth": "50px",
29+
"labelwidth": 50,
30+
"labelWidth": "50px",
3131
"value": "",
3232
"apiKey": "name",
3333
"fieldTypes": "inputTypes",
@@ -70,8 +70,8 @@
7070
"showLabel": false,
7171
"labelTitle": "教育程度",
7272
"labelPosition": "left",
73-
"labelwidth": 50,
74-
"labelWidth": "50px",
73+
"labelwidth": 50,
74+
"labelWidth": "50px",
7575
"fieldTypes": "selectTypes",
7676
"options": ["硕士及以上", "本科", "大专", "中专/高中及以下"],
7777
"style": {
@@ -90,6 +90,20 @@
9090
"margin": "0px 0px 0px 0px"
9191
}
9292
},
93+
{
94+
"type": "h-picker",
95+
"name": "横向滑动单选",
96+
"labelTitle": "年龄",
97+
"value": "25",
98+
"options": ["20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"],
99+
"labelPosition": "left",
100+
"fieldTypes": "hPickerTypes",
101+
"apiKey": "age",
102+
"pickerColor":"#409eff",
103+
"style": {
104+
"margin": "0px 0px 0px 0px"
105+
}
106+
},
93107
{
94108
"type": "button",
95109
"name": "按钮",

‎src/components/widget-form-list.vue‎

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
:class="{active: selectWg.key === item.key,'widget-view-imgshow':item.type === 'imgshow'}"
1414
@click="handleSelectWidget(index)"
1515
>
16+
<!-- 手机 -->
1617
<div v-if="item.type === 'phone'" class="wg-phone" :style="item.style">
1718
<div class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']">
1819
<div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div>
@@ -29,13 +30,15 @@
2930
</div>
3031
</div>
3132

33+
<!-- 输入框 -->
3234
<div v-if="item.type === 'input'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style">
3335
<div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div>
3436
<div class="flex-auto">
3537
<input v-model="item.value" :placeholder="item.placeholder" class="wg-input">
3638
</div>
3739
</div>
3840

41+
<!-- 选择框 -->
3942
<div
4043
v-if="item.type === 'checkbox'"
4144
class="wg-item flex-wrap wg-checkbox"
@@ -51,44 +54,67 @@
5154
</div>
5255
</div>
5356

57+
<!-- 下拉选择 -->
5458
<div v-if="item.type === 'select'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style">
5559
<div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div>
5660
<div class="flex-auto">
5761
<select v-model="item.value" class="wg-select flex-auto">
5862
<option value disabled selected hidden>{{item.placeholder}}</option>
59-
<option v-for="item in item.options" :key="item" :value="item" :label="item.showLabel?item.label:item"></option>
63+
<option v-for="optionsItem in item.options" :key="optionsItem" :value="optionsItem" :label="item.showLabel?item.label:optionsItem"></option>
6064
</select>
6165
</div>
6266
</div>
6367

64-
<div v-if="item.type==='switch'" class="wg-item wg-switch" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style">
68+
<!-- 开关 -->
69+
<div
70+
v-if="item.type==='switch'"
71+
class="wg-item wg-switch"
72+
:class="[item.labelPosition==='top'?'flex-column':'align-middle']"
73+
:style="item.style"
74+
>
6575
<div class="wg-title" :style="{width:item.labelWidth}">{{item.labelTitle}}</div>
6676
<label class="label">
6777
<input type="checkbox" class="wg-switch-input" v-model="item.value" style="display:none">
6878
<span class="wg-switch-core"></span>
6979
</label>
7080
</div>
7181

82+
<!-- 日期选择 -->
7283
<div v-if="item.type === 'date'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style">
7384
<div class="wg-title" :style="{width:item.labelWidth}">{{item.labelTitle}}</div>
7485
<div class="flex-auto">
7586
<input type="date" v-model="item.value" class="wg-input flex-auto">
7687
</div>
7788
</div>
7889

90+
<!-- 图片展示 -->
7991
<div class="flex flex-center" v-if="item.type === 'imgshow'" :class="{'img-placeholder':!item.value}" :style="item.style">
8092
<img v-if="item.value" :src="item.value" alt="图片展示" width="100%">
8193
<img v-else src="@/assets/img/img-placeholder.png" alt="图片展示">
8294
</div>
8395

96+
<!-- 按钮 -->
8497
<div class="flex flex-center" v-if="item.type === 'button'" :style="item.style">
8598
<button class="wg-button" :style="item.style.btnStyle">{{item.btnText}}</button>
8699
</div>
87100

101+
<!-- 文本描述 -->
88102
<div v-if="item.type === 'staticText'" class="wg-staticText" :style="item.style">
89103
<p :style="item.style">{{item.value}}</p>
90104
</div>
91105

106+
<!-- 横向滑动自动选择 -->
107+
<div class="flex flex-center" v-if="item.type === 'h-picker'" :style="item.style">
108+
<div class="wg-horizontal-picker">
109+
<div
110+
class="picker-item"
111+
v-for="optionsItem in item.options"
112+
:key="optionsItem"
113+
:style="optionsItem===item.value?{ color: optionsItem.pickerColor }:{}"
114+
>{{optionsItem}}</div>
115+
</div>
116+
</div>
117+
92118
<el-button
93119
title="删除"
94120
@click.stop="handleWidgetDelete(index)"
@@ -98,7 +124,15 @@
98124
plain
99125
type="danger"
100126
>删除</el-button>
101-
<el-button title="复制" @click.stop="handleWidgetClone(index)" class="widget-action-clone" v-if="selectWg.key === item.key" circle plain type="primary">复制</el-button>
127+
<el-button
128+
title="复制"
129+
@click.stop="handleWidgetClone(index)"
130+
class="widget-action-clone"
131+
v-if="selectWg.key === item.key"
132+
circle
133+
plain
134+
type="primary"
135+
>复制</el-button>
102136
</div>
103137
</template>
104138
</draggable>

0 commit comments

Comments
 (0)