Skip to content

Commit 0efdf92

Browse files
author
wangbing11
committed
update mock
1 parent 041140d commit 0efdf92

40 files changed

+1342
-1081
lines changed

src/mock/app/menu-list.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
"errno": 0,
3+
"data": [
4+
{
5+
"label": "Data",
6+
"path": "/data",
7+
"submenu": [
8+
{
9+
"label": "General",
10+
"path": "/data/general",
11+
"template": "template-data-report"
12+
},
13+
{
14+
"label": "Real-time",
15+
"path": "/data/real-time",
16+
"template": "template-data-report"
17+
}
18+
]
19+
},
20+
{
21+
"label": "Curd",
22+
"path": "/curd",
23+
"submenu": [
24+
{
25+
"label": "User Management",
26+
"path": "/curd/user",
27+
"template": "template-curd"
28+
},
29+
{
30+
"label": "Post Management",
31+
"path": "/curd/post",
32+
"template": "template-curd"
33+
}
34+
]
35+
}
36+
]
37+
}

src/mock/app/menu-list.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/mock/home/home-data.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
"errno": 0,
3+
"data": {
4+
"carouselData": [
5+
"Welcome to Configurable Platform",
6+
"Power and Fasten Platform Developing"
7+
],
8+
"hotTemplates": [
9+
{
10+
"title": "Data Report",
11+
"description": "A comfigurable data report template, support searching and data visualization!"
12+
},
13+
{
14+
"title": "Authority Management",
15+
"description": "A comfigurable authority management template, based on BRAC model"
16+
},
17+
{
18+
"title": "Editable Table",
19+
"description": "Modify data inside the table, really convenient!"
20+
}
21+
]
22+
}
23+
}

src/mock/home/home-data.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/mock/user/user-info.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
"errno": 0,
3+
"data": {
4+
"departmentName": "研发部部",
5+
"headUrl": "http://neisou.baidu.com/images/headportrait/wangbing11/0_112.jpg",
6+
"userName": "abing"
7+
}
8+
}

src/mock/user/user-info.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import index from "./index.vue";
2+
3+
export default index;
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<template>
2+
<div class="page-form-con">
3+
<template v-for="(talkConfig, index) in formsConfig">
4+
<div
5+
v-if="index <= current"
6+
class="page-form-con-talk" :key="index"
7+
>
8+
<div class="page-form-con-talk-question">
9+
<div class="page-form-con-talk-question-asker">智能小护士:</div>
10+
<FormGenerator
11+
:ref="'FormGenerator-' + index"
12+
class="page-form-con-talk-question-field"
13+
:fields="talkConfig.questionFields"
14+
:model="model"
15+
:options="options"
16+
@on-submit="handleSave(index)"
17+
/>
18+
</div>
19+
<div class="page-form-con-talk-anwser">
20+
<div class="page-form-con-talk-anwser-user">
21+
:兔百万和汤圆
22+
</div>
23+
<div class="page-form-con-talk-anwser-detail">
24+
{{model[talkConfig.answerField]}}
25+
</div>
26+
</div>
27+
</div>
28+
</template>
29+
</div>
30+
</template>
31+
<script>
32+
import pageConfig from "./page-config.js";
33+
export default {
34+
data() {
35+
return {
36+
pageConfig,
37+
model: {},
38+
current: 0
39+
};
40+
},
41+
computed: {
42+
formsConfig() {
43+
return this.pageConfig.forms;
44+
},
45+
options() {
46+
return this.pageConfig.formOptions;
47+
}
48+
},
49+
methods: {
50+
handleSave(index) {
51+
this.$refs[`FormGenerator-${index}`][0].submit()
52+
.then(data => {
53+
console.log(`FormGenerator-${index}`, data);
54+
this.current < 2 && this.current++;
55+
});
56+
},
57+
58+
handleButtonEvent(event) {
59+
this[event.name]();
60+
},
61+
62+
// 上一步
63+
prev() {
64+
this.current--;
65+
}
66+
}
67+
};
68+
</script>
69+
<style lang="less">
70+
.page-form-con {
71+
width: 70%;
72+
margin: 30px;
73+
padding: 30px;
74+
border: solid 1px #e4e4e4;
75+
border-radius: 10px;
76+
overflow: hidden;
77+
78+
&-talk{
79+
margin: 20px 0px;
80+
&-question {
81+
&-asker {
82+
height: 40px;
83+
font-size: 12px;
84+
font-weight: bold;
85+
}
86+
87+
&-field {
88+
width: 70%;
89+
border: solid 1px #e4e4e4;
90+
border-radius: 10px;
91+
padding: 10px;
92+
// background: #e4e4e4;
93+
}
94+
}
95+
96+
&-anwser {
97+
float: right;
98+
text-align: right;
99+
100+
&-user {
101+
height: 40px;
102+
font-size: 12px;
103+
font-weight: bold;
104+
}
105+
106+
&-detail {
107+
border: solid 1px #e4e4e4;
108+
border-radius: 10px;
109+
padding: 10px;
110+
font-weight: bold;
111+
}
112+
}
113+
}
114+
}
115+
</style>
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
export default {
2+
title: "基础表单",
3+
desc: "表单页用于向用户收集或验证信息,基础表单常见于数据项较少的表单场景。",
4+
forms: [
5+
{
6+
questionFields: [
7+
{
8+
label: "城市",
9+
type: "Radio",
10+
model: "city",
11+
placeholder: "请选择",
12+
options: [
13+
{
14+
label: "北京",
15+
value: "Beijing"
16+
},
17+
{
18+
label: "上海",
19+
value: "Shanghai"
20+
},
21+
{
22+
label: "广州",
23+
value: "Guangzhou"
24+
},
25+
{
26+
label: "深圳",
27+
value: "Shenzhen"
28+
}
29+
],
30+
required: true,
31+
width: 300,
32+
},
33+
{
34+
type: "Submit",
35+
subtype: "primary",
36+
text: "提交",
37+
width: 150,
38+
inline: true
39+
},
40+
{
41+
type: "Reset",
42+
text: "取消",
43+
width: 100,
44+
labelWidth: 0,
45+
inline: true
46+
}
47+
],
48+
answerField: "city"
49+
},
50+
{
51+
questionFields: [
52+
{
53+
label: "性别",
54+
type: "Radio",
55+
model: "gender",
56+
options: [
57+
{
58+
label: "男",
59+
value: "M"
60+
},
61+
{
62+
label: "女",
63+
value: "F"
64+
}
65+
],
66+
required: true
67+
},
68+
{
69+
type: "Submit",
70+
subtype: "primary",
71+
text: "提交",
72+
width: 150,
73+
inline: true
74+
},
75+
{
76+
type: "Reset",
77+
text: "重置",
78+
width: 100,
79+
labelWidth: 0,
80+
inline: true
81+
}
82+
],
83+
answerField: "gender"
84+
},
85+
{
86+
questionFields: [
87+
{
88+
label: "请输入您的姓名",
89+
type: "Input",
90+
model: "name",
91+
placeholder: "如:张三",
92+
rules: [
93+
{
94+
type: "string",
95+
required: true,
96+
pattern: "^[\\u4e00-\\u9fa5]+$",
97+
message: "请输入中文姓名"
98+
}
99+
],
100+
width: 300,
101+
labelWidth: 120,
102+
},
103+
{
104+
type: "Submit",
105+
subtype: "primary",
106+
text: "提交",
107+
inline: true,
108+
labelWidth: 120,
109+
},
110+
{
111+
type: "Reset",
112+
text: "取消",
113+
inline: true,
114+
labelWidth: 0,
115+
}
116+
],
117+
answerField: "name"
118+
},
119+
],
120+
formOptions: {
121+
labelPosition: "left"
122+
}
123+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default [
2+
{
3+
path: "/form-conversational",
4+
component: () =>
5+
import(/* webpackChunkName: "form-simple" */ "./index.vue")
6+
}
7+
];

0 commit comments

Comments
 (0)