Skip to content

Commit 27dadaf

Browse files
committed
finish init
1 parent 4feca5e commit 27dadaf

11 files changed

Lines changed: 282 additions & 410 deletions

File tree

‎src/assets/css/widget.scss‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ $primary-background-color: #ecf5ff;
4646

4747
.widget-view.widget-view-imgshow {
4848
padding: 0;
49+
background: #f1f1f1;
4950
}
5051

5152
.widget-view {
5253
margin: 0;
5354
padding: 10px;
55+
background: #fff;
5456
position: relative;
5557

5658
&:after {
@@ -75,8 +77,8 @@ $primary-background-color: #ecf5ff;
7577
}
7678

7779
&.active {
78-
background: $primary-background-color;
79-
box-shadow: 0px 1px 10px 1px #90c7ff;
80+
background: $primary-background-color;
81+
// box-shadow: 0px 1px 10px 1px #90c7ff;
8082
z-index: 2001;
8183
}
8284

@@ -95,21 +97,23 @@ $primary-background-color: #ecf5ff;
9597
}
9698

9799
.wg-input, .wg-select {
98-
width: 100%;
99100
padding: 10px 0;
100101
color: #666;
101102
font-size: 14px;
102103
border-radius: 4px;
103104
border: 1px solid #ddd;
104105
text-indent: 10px;
105106
background: #fff;
107+
transition: .3s;
108+
}
109+
.wg-title {
110+
font-size: 14px;
111+
margin-right: 10px;
112+
color: #333;
106113
}
107114
.wg-radio, .wg-checkbox {
108115
line-height: 40px;
109116

110-
.title {
111-
font-size: 16px;
112-
}
113117
.label {
114118
cursor: pointer;
115119
position: relative;

‎src/assets/js/api.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Vue from "vue";
12
import Crypto from "./crypto";
23

34
export default {
@@ -6,6 +7,7 @@ export default {
67
Vue.prototype.$api = this;
78
}
89
},
10+
vue: new Vue(),
911
env() {
1012
if (process.env.NODE_ENV === "development") return "development";
1113
if (window.location.href.includes("192.168")) return "test";

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

Lines changed: 67 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -2,155 +2,98 @@
22
"basicComponents": [{
33
"type": "input",
44
"name": "输入框",
5-
"config": {
6-
"selectType":"name",
7-
"inputTypes":[{
8-
"value": "name",
9-
"label": "姓名"
10-
},{
11-
"value": "mail",
12-
"label": "邮箱"
13-
},{
14-
"value": "age",
15-
"label": "年龄(岁)"
16-
},{
17-
"value": "idCard",
18-
"label": "身份证"
19-
},{
20-
"value": "phone",
21-
"label": "手机号"
22-
}],
23-
"defaultValue": "",
24-
"apiKey":"name",
25-
"required": false,
26-
"placeholder": "请输入内容"
27-
}
5+
"placeholder": "请输入内容",
6+
"showLabel": false,
7+
"defaultValue": "",
8+
"apiKey": "name",
9+
"inputTypes": [{
10+
"value": "name",
11+
"label": "姓名"
12+
}, {
13+
"value": "mail",
14+
"label": "邮箱"
15+
}, {
16+
"value": "age",
17+
"label": "年龄(岁)"
18+
}, {
19+
"value": "idCard",
20+
"label": "身份证"
21+
}, {
22+
"value": "phone",
23+
"label": "手机号"
24+
}]
2825
},
2926
{
3027
"type": "radio",
3128
"name": "单选框组",
32-
"config": {
33-
"inline": false,
34-
"defaultValue": "",
35-
"showLabel": false,
36-
"options": [{
37-
"value": "选项1",
38-
"label": "选项1"
39-
},
40-
{
41-
"value": "选项2",
42-
"label": "选项2"
43-
},
44-
{
45-
"value": "选项3",
46-
"label": "选项3"
47-
}
48-
],
49-
"required": false,
50-
"width": "",
51-
"remote": false,
52-
"remoteOptions": [],
53-
"props": {
54-
"value": "value",
55-
"label": "label"
29+
"defaultValue": "",
30+
"apiKey": "",
31+
"options": [{
32+
"value": "选项1",
33+
"label": "选项1"
5634
},
57-
"remoteFunc": ""
58-
}
35+
{
36+
"value": "选项2",
37+
"label": "选项2"
38+
},
39+
{
40+
"value": "选项3",
41+
"label": "选项3"
42+
}
43+
]
5944
},
6045
{
6146
"type": "checkbox",
6247
"name": "多选框组",
63-
"config": {
64-
"inline": false,
65-
"defaultValue": [],
66-
"showLabel": false,
67-
"options": [{
68-
"value": "选项1"
69-
},
70-
{
71-
"value": "选项2"
72-
},
73-
{
74-
"value": "选项3"
75-
}
76-
],
77-
"required": false,
78-
"width": "",
79-
"remote": false,
80-
"remoteOptions": [],
81-
"props": {
82-
"value": "value",
83-
"label": "label"
48+
"defaultValue": [],
49+
"apiKey": "",
50+
"options": [{
51+
"value": "选项1"
52+
},
53+
{
54+
"value": "选项2"
8455
},
85-
"remoteFunc": ""
86-
}
56+
{
57+
"value": "选项3"
58+
}
59+
]
8760
},
8861
{
8962
"type": "date",
9063
"name": "日期选择器",
91-
"config": {
92-
"defaultValue": "",
93-
"readonly": false,
94-
"disabled": false,
95-
"editable": true,
96-
"clearable": true,
97-
"startPlaceholder": "",
98-
"endPlaceholder": "",
99-
"type": "date",
100-
"format": "yyyy-MM-dd",
101-
"timestamp": false,
102-
"required": false,
103-
"width": ""
104-
}
64+
"defaultValue": ""
10565
},
10666
{
10767
"type": "select",
10868
"name": "下拉选择框",
109-
"config": {
110-
"defaultValue": "",
111-
"multiple": false,
112-
"disabled": false,
113-
"clearable": false,
114-
"placeholder": "请选择",
115-
"required": false,
116-
"showLabel": false,
117-
"width": "",
118-
"options": [{
119-
"value": "下拉框1"
120-
},
121-
{
122-
"value": "下拉框2"
123-
},
124-
{
125-
"value": "下拉框3"
126-
}
127-
],
128-
"remote": false,
129-
"remoteOptions": [],
130-
"props": {
131-
"value": "value",
132-
"label": "label"
69+
"defaultValue": "",
70+
"apiKey": "",
71+
"placeholder": "请选择",
72+
"showLabel": false,
73+
"options": [{
74+
"value": "下拉框1"
75+
},
76+
{
77+
"value": "下拉框2"
13378
},
134-
"remoteFunc": ""
135-
}
79+
{
80+
"value": "下拉框3"
81+
}
82+
]
13683
},
13784
{
13885
"type": "switch",
13986
"name": "开关",
140-
"config": {
141-
"defaultValue": false,
142-
"required": false,
143-
"disabled": false
144-
}
145-
},
146-
{
87+
"defaultValue": false,
88+
"apiKey": "",
89+
"disabled": false
90+
},
91+
{
14792
"type": "imgshow",
14893
"name": "图片展示",
149-
"config": {
150-
"defaultValue": "",
151-
"required": false,
152-
"disabled": false
153-
}
94+
"defaultValue": "",
95+
"apiKey": "",
96+
"disabled": false
15497
}
15598
]
15699
}

‎src/components/PageConfig.vue‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
<template>
22
<div class="form-config-container">
33
<el-form label-position="top">
4-
<el-form-item label="标签对齐方式">
5-
<el-radio-group v-model="config.labelPosition">
6-
<el-radio-button label="left">左对齐</el-radio-button>
7-
<el-radio-button label="right">右对齐</el-radio-button>
8-
<el-radio-button label="top">顶部对齐</el-radio-button>
9-
</el-radio-group>
10-
</el-form-item>
11-
12-
<el-form-item label="表单字段宽度">
13-
<el-input-number v-model="config.labelWidth" :min="0" :max="200" :step="10"></el-input-number>
4+
<el-form-item label="页面标题">
5+
<el-input v-model="pageData.config.title"></el-input>
146
</el-form-item>
157
</el-form>
8+
<!-- <button @click="test()">testetetse</button> -->
169
</div>
1710
</template>
1811

1912
<script>
20-
import { mapState } from "vuex";
13+
import { mapState } from 'vuex';
2114
export default {
2215
computed: {
2316
...mapState({
24-
config: state => state.common.pageData.config
17+
pageData: state => state.common.pageData
2518
})
2619
},
20+
methods: {
21+
test() {
22+
console.log(this.$store.state);
23+
}
24+
}
2725
}
2826
</script>

0 commit comments

Comments
 (0)