Skip to content

Commit 2b38070

Browse files
committed
优化控件样式
1 parent 1cb7e31 commit 2b38070

6 files changed

Lines changed: 136 additions & 109 deletions

File tree

‎src/assets/css/widget.scss‎

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,36 @@ $primary-background-color: #ecf5ff;
4444
}
4545
}
4646

47+
.widget-action-delete {
48+
position: absolute;
49+
right: 10px;
50+
bottom: -20px;
51+
z-index: 1009;
52+
}
53+
54+
.widget-action-clone {
55+
position: absolute;
56+
right: 70px;
57+
bottom: -20px;
58+
z-index: 1009;
59+
}
60+
4761
.widget-view.widget-view-imgshow {
4862
padding: 0;
49-
background: #f1f1f1;
63+
background: #f1f1f1;
64+
border-bottom:none;
65+
}
66+
67+
.widget-view.widget-view-button {
68+
border-bottom:none;
5069
}
5170

5271
.widget-view {
5372
margin: 0;
5473
padding: 10px;
5574
background: #fff;
56-
position: relative;
75+
position: relative;
76+
border-bottom: 1px solid #eee;
5777

5878
&:after {
5979
content: "";
@@ -77,31 +97,25 @@ $primary-background-color: #ecf5ff;
7797
}
7898

7999
&.active {
80-
background: $primary-background-color;
81-
// box-shadow: 0px 1px 10px 1px #90c7ff;
100+
background: $primary-background-color;
101+
// box-shadow: 0px 1px 10px 1px #90c7ff;
82102
z-index: 1111;
83103
}
84104

85-
.widget-action-delete {
86-
position: absolute;
87-
right: 10px;
88-
bottom: -20px;
89-
z-index: 1009;
90-
}
91-
92-
.widget-action-clone {
93-
position: absolute;
94-
right: 70px;
95-
bottom: -20px;
96-
z-index: 1009;
105+
.wg-item {
106+
display: flex;
107+
line-height: 50px;
97108
}
98109

99110
.wg-input, .wg-select {
100-
padding: 10px 0;
111+
width: 100%;
112+
height: 40px;
113+
margin: 5px 0;
101114
color: #666;
102115
font-size: 14px;
103116
border-radius: 4px;
104117
border: 1px solid #ddd;
118+
outline: none;
105119
text-indent: 10px;
106120
background: #fff;
107121
transition: .3s;
@@ -112,9 +126,9 @@ $primary-background-color: #ecf5ff;
112126
color: #333;
113127
}
114128
.wg-checkbox {
115-
line-height: 40px;
116129

117130
.label {
131+
float: left;
118132
cursor: pointer;
119133
position: relative;
120134
margin-right: 10px;
@@ -133,9 +147,6 @@ $primary-background-color: #ecf5ff;
133147
}
134148

135149
.wg-switch {
136-
line-height: 40px;
137-
display: flex;
138-
align-items: center;
139150

140151
.label {
141152
display: flex;
@@ -175,22 +186,22 @@ $primary-background-color: #ecf5ff;
175186
left: 100%;
176187
margin-left: -17px;
177188
}
178-
}
179-
.wg-button {
180-
width: 90%;
181-
margin: 15px 5%;
182-
background: $primary-color;
183-
color: #fff;
184-
height: 46px;
185-
line-height: 46px;
186-
font-size: 18px;
187-
outline: none;
188-
border: none;
189-
letter-spacing: 2px;
190-
border-radius: 20px;
191-
text-align: center;
192-
box-shadow: 0 5px 10px 3px #90c7ff;
193-
}
189+
}
190+
.wg-button {
191+
width: 90%;
192+
margin: 15px 5%;
193+
background: $primary-color;
194+
color: #fff;
195+
height: 46px;
196+
line-height: 46px;
197+
font-size: 18px;
198+
outline: none;
199+
border: none;
200+
letter-spacing: 2px;
201+
border-radius: 20px;
202+
text-align: center;
203+
box-shadow: 0 5px 10px 3px #90c7ff;
204+
}
194205
}
195206
}
196207
}

‎src/assets/js/api.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default {
1414
return "production";
1515
},
1616
apiUrl() {
17-
// return "http://192.168.218.185:8022/";
18-
if (this.env() === "development") return "http://192.168.218.185:8022/";
19-
if (this.env() === 'test') return "http://test-api.junjue888.com/";
20-
return "http://api.junjue888.com/";
17+
return "http://test-api.junjue888.com/";
18+
// if (this.env() === "development") return "http://192.168.218.185:8022/";
19+
// if (this.env() === 'test') return "http://test-api.junjue888.com/";
20+
// return "http://api.junjue888.com/";
2121
},
2222
getUrlParam(name) {
2323
var reg = new RegExp("(^|/?|&)" + name + "=([^&]*)(&|$)", "i");

‎src/assets/json/all-widget.json‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"name": "输入框",
55
"title": "输入框",
66
"placeholder": "请输入内容",
7-
"showLabel": false,
8-
"defaultValue": "",
7+
"showLabel": false,
8+
"labelPosition":"left",
9+
"value": "",
910
"apiKey": "name",
1011
"inputTypes": [{
1112
"value": "name",
@@ -28,9 +29,10 @@
2829
"type": "checkbox",
2930
"name": "选择框",
3031
"title": "选择框",
31-
"defaultValue": [],
32+
"value": [],
3233
"apiKey": "",
33-
"isRadio": false,
34+
"isRadio": false,
35+
"labelPosition":"left",
3436
"options": [{
3537
"value": "选项1"
3638
},
@@ -45,39 +47,42 @@
4547
{
4648
"type": "date",
4749
"name": "日期选择器",
48-
"title": "日期选择器",
49-
"defaultValue": ""
50+
"title": "日期选择器",
51+
"labelPosition":"left",
52+
"value": ""
5053
},
5154
{
5255
"type": "select",
5356
"name": "下拉选择框",
5457
"title": "下拉选择框",
55-
"defaultValue": "",
58+
"value": "",
5659
"apiKey": "",
5760
"placeholder": "请选择",
58-
"showLabel": false,
61+
"showLabel": false,
62+
"labelPosition":"left",
5963
"options": [{
60-
"value": "下拉框1"
64+
"value": "下拉选项1"
6165
},
6266
{
63-
"value": "下拉框2"
67+
"value": "下拉选项2"
6468
},
6569
{
66-
"value": "下拉框3"
70+
"value": "下拉选项3"
6771
}
6872
]
6973
},
7074
{
7175
"type": "switch",
7276
"name": "开关",
7377
"title": "开关",
74-
"defaultValue": false,
78+
"value": false,
79+
"labelPosition":"left",
7580
"apiKey": ""
7681
},
7782
{
7883
"type": "imgshow",
7984
"name": "图片展示",
80-
"defaultValue": "",
85+
"value": "",
8186
"apiKey": ""
8287
},
8388
{

‎src/components/widget-config.vue‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
<el-form-item label="是否显示标题" v-if="Object.keys(selectWg).indexOf('showLabel')>=0">
88
<el-switch v-model="selectWg.showLabel"></el-switch>
99
</el-form-item>
10+
<el-form-item label="标题对齐方式" v-if="Object.keys(selectWg).indexOf('labelPosition')>=0">
11+
<el-radio-group v-model="selectWg.labelPosition" size="mini">
12+
<el-radio-button label="left">左对齐</el-radio-button>
13+
<el-radio-button label="top">顶部对齐</el-radio-button>
14+
</el-radio-group>
15+
</el-form-item>
1016
<el-form-item label="提示内容" v-if="Object.keys(selectWg).indexOf('placeholder')>=0">
1117
<el-input v-model="selectWg.placeholder"></el-input>
1218
</el-form-item>
@@ -19,7 +25,7 @@
1925
<el-switch v-model="selectWg.isRadio" @change="isRadio"></el-switch>
2026
</el-form-item>
2127
<el-form-item label="默认选中" v-if="selectWg.type==='switch'">
22-
<el-switch v-model="selectWg.defaultValue"></el-switch>
28+
<el-switch v-model="selectWg.value"></el-switch>
2329
</el-form-item>
2430
<el-form-item label="按钮文字" v-if="Object.keys(selectWg).indexOf('btnText')>=0">
2531
<el-input v-model="selectWg.btnText"></el-input>
@@ -56,7 +62,7 @@
5662
:before-upload="beforeAvatarUpload"
5763
:on-error="uploadError"
5864
>
59-
<img v-if="selectWg.defaultValue" :src="selectWg.defaultValue" class="avatar">
65+
<img v-if="selectWg.value" :src="selectWg.value" class="avatar">
6066
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
6167
</el-upload>
6268
</el-form-item>
@@ -83,14 +89,16 @@ export default {
8389
},
8490
methods: {
8591
isRadio(flag) {
86-
this.selectWg.defaultValue = flag ? "" : []
92+
this.selectWg.value = flag ? "" : []
8793
},
8894
selectInput(val) {
8995
let selectWg = this.selectWg.options.find(item => val === item.value);
9096
this.selectWg.placeholder = `请输入${selectWg.label}`
9197
},
9298
handleAvatarSuccess(res, file) {
93-
this.selectWg.defaultValue = URL.createObjectURL(file.raw);
99+
// console.log(res, file);
100+
this.selectWg.value = res.data;
101+
// this.selectWg.value = URL.createObjectURL(file.raw);
94102
this.fullLoading.close()
95103
},
96104
uploadError(err, file, fileList) {

0 commit comments

Comments
 (0)