Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5dbec3b

Browse files
author
Renoir Boulanger
committedJun 1, 2018
Review Examples Side-Car data and Vuex store.
1 parent d938676 commit 5dbec3b

File tree

16 files changed

+359
-153
lines changed

16 files changed

+359
-153
lines changed
 

‎client/components/Navbar.vue

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export default class Navbar extends Vue {
6060
this.$store.dispatch('menu/addAll', this.translateMenus(menus))
6161
}
6262
}
63-
6463
translateMenus (menus) {
6564
return menus.map((menu) => {
6665
const subMenus = menu.children

‎client/components/examples/activity/NewActivity.vue

+60-20
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
</el-form-item>
99
</el-col>
1010
<el-col :xs="24" :sm="{span: 10, offset: 2}">
11-
<el-form-item :label="$t('activity.area')" prop="region">
12-
<el-select v-model="formData.region" filterable allow-create :placeholder="$t('activity.holder.area')">
11+
<el-form-item :label="$t('activity.city.label')" prop="city">
12+
<el-select
13+
v-model="formData.city"
14+
filterable
15+
allow-create
16+
:placeholder="$t('activity.holder.area')"
17+
>
1318
<el-option
1419
v-for="item in cities"
1520
v-if="!item.disabled"
@@ -41,19 +46,52 @@
4146
</el-col>
4247
</el-row>
4348
<el-row type="flex" justify="flex-start">
44-
<el-col :xs="24" :sm="10">
45-
<el-form-item :label="$t('activity.type')" prop="type">
49+
<el-col
50+
:xs="24"
51+
:sm="10"
52+
>
53+
<el-form-item
54+
:label="$t('activity.type.label')"
55+
prop="type"
56+
>
4657
<el-checkbox-group v-model="formData.type">
47-
<el-checkbox :label="$t('activity.price')"></el-checkbox>
48-
<el-checkbox :label="$t('activity.rights')"></el-checkbox>
58+
<el-checkbox
59+
label="activity.type.price"
60+
>
61+
{{$t('activity.type.price')}}
62+
</el-checkbox>
63+
<el-checkbox
64+
label="activity.type.rights"
65+
>
66+
{{$t('activity.type.rights')}}
67+
</el-checkbox>
4968
</el-checkbox-group>
5069
</el-form-item>
5170
</el-col>
52-
<el-col :xs="24" :sm="{span: 10, offset: 2}">
53-
<el-form-item :label="$t('activity.priority')" prop="priority">
71+
<el-col
72+
:xs="24"
73+
:sm="{span: 10, offset: 2}"
74+
>
75+
<el-form-item
76+
:label="$t('activity.priority.label')"
77+
prop="priority"
78+
>
5479
<el-radio-group v-model="formData.priority">
55-
<el-radio :label="$t('activity.medium')"></el-radio>
56-
<el-radio :label="$t('activity.high')"></el-radio>
80+
<el-radio
81+
label="activity.priority.low"
82+
>
83+
{{$t('activity.priority.low')}}
84+
</el-radio>
85+
<el-radio
86+
label="activity.priority.medium"
87+
>
88+
{{$t('activity.priority.medium')}}
89+
</el-radio>
90+
<el-radio
91+
label="activity.priority.high"
92+
>
93+
{{$t('activity.priority.high')}}
94+
</el-radio>
5795
</el-radio-group>
5896
</el-form-item>
5997
</el-col>
@@ -106,9 +144,10 @@
106144

107145
<script>
108146
import Vue from 'vue'
109-
import Component, { Getter, namespace } from 'class-component'
147+
import Component, { Action, Getter, namespace } from 'class-component'
110148
111-
const ExampleGetter = namespace('examples/index', Getter)
149+
const ActivityGetter = namespace('examples/index', Getter)
150+
const ActivityAction = namespace('examples/activity', Action)
112151
113152
@Component({
114153
props: {
@@ -117,12 +156,12 @@ const ExampleGetter = namespace('examples/index', Getter)
117156
default () {
118157
return {
119158
account: '',
120-
region: 'activity.city.ly',
159+
city: 'activity.city.ly',
121160
date1: '',
122161
date2: '',
123162
delivery: false,
124163
type: [],
125-
priority: '',
164+
priority: 'activity.priority.low',
126165
rate: 0,
127166
organizer: [],
128167
desc: '',
@@ -138,8 +177,8 @@ const ExampleGetter = namespace('examples/index', Getter)
138177
{ required: true, message: this.$t('activity.rule.account.required'), trigger: 'blur' },
139178
{ min: 6, message: this.$t('activity.rule.account.length'), trigger: 'blur' }
140179
],
141-
region: [
142-
{ required: true, message: this.$t('activity.rule.region.required'), trigger: 'change' }
180+
city: [
181+
{ required: true, message: this.$t('activity.rule.city.required'), trigger: 'change' }
143182
],
144183
date1: [
145184
{ type: 'date', required: true, message: this.$t('activity.rule.date1.required'), trigger: 'change' }
@@ -164,9 +203,10 @@ const ExampleGetter = namespace('examples/index', Getter)
164203
}
165204
})
166205
export default class NewActivity extends Vue {
167-
@ExampleGetter labels
168-
@ExampleGetter organizers
169-
@ExampleGetter cities
206+
@ActivityGetter labels
207+
@ActivityGetter organizers
208+
@ActivityGetter cities
209+
@ActivityAction('add') addActivity
170210
171211
submit (formName) {
172212
/**
@@ -180,7 +220,7 @@ export default class NewActivity extends Vue {
180220
181221
this.$refs[formName].validate((valid) => {
182222
if (valid) {
183-
this.$store.dispatch('examples/activity/add', this.formData)
223+
this.addActivity(this.formData)
184224
this.$message.success(this.$t('activity.success'))
185225
if (formName === 'popForm') {
186226
this.popVisible = false

‎client/locales/examples/en.json

+14-8
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
},
66
"account": "Account",
77
"date": "Date",
8-
"type": "Type",
9-
"area": "Area",
10-
"priority": "Priority",
8+
"priority": {
9+
"label": "Priority",
10+
"low": "Low",
11+
"medium": "Medium",
12+
"high": "High"
13+
},
1114
"organizer": "Organizer",
1215
"desc": "Description",
1316
"tag": "Tag",
@@ -28,17 +31,20 @@
2831
}
2932
},
3033
"city": {
34+
"label": "City",
3135
"sh": "ShangHai",
3236
"bj": "BeiJing",
3337
"gz": "GuangZhou",
34-
"ly": "Lyster",
38+
"ly": "Lyster Beach 🌴",
39+
"ny": "New-York 🍎",
3540
"sz": "ShenZhen"
3641
},
3742
"instDist": "JD",
38-
"price": "Discount",
39-
"rights": "Rights",
40-
"medium": "Medium",
41-
"high": "High",
43+
"type": {
44+
"label": "Type of activity",
45+
"price": "Discount",
46+
"rights": "Rights"
47+
},
4248
"rule": {
4349
"account": {
4450
"required": "Pls input account name",

‎client/locales/examples/fr.json

+15-9
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
},
66
"account": "Compte",
77
"date": "Date",
8-
"type": "Type",
9-
"area": "Région",
10-
"priority": "Priorité",
8+
"priority": {
9+
"label": "Priorité",
10+
"low": "Basse",
11+
"medium": "Moyenne",
12+
"high": "Élevée"
13+
},
1114
"organizer": "Organisateur",
1215
"desc": "Description",
1316
"tag": "Étiquette",
1417
"rate": "Appréciation",
1518
"create": "Créer",
1619
"reset": "Réinitialiser",
1720
"holder": {
18-
"area": "Choisir une région",
21+
"area": "Choisir une ville",
1922
"tag": "Choisir une étiquette",
2023
"date": "Choisir une date",
2124
"time": "Choisir un moment"
@@ -28,17 +31,20 @@
2831
}
2932
},
3033
"city": {
34+
"label": "Ville",
3135
"sh": "ShangHai",
3236
"bj": "BeiJing",
3337
"gz": "GuangZhou",
34-
"ly": "Lyster",
38+
"ly": "Lyster Beach 🌴",
39+
"ny": "New-York 🍎",
3540
"sz": "ShenZhen"
3641
},
3742
"instDist": "JD",
38-
"price": "Rabais",
39-
"rights": "Droit",
40-
"medium": "Médium",
41-
"high": "Élevé",
43+
"type": {
44+
"label": "Type d’activité",
45+
"price": "Rabais",
46+
"rights": "Droit"
47+
},
4248
"rule": {
4349
"account": {
4450
"required": "Veuillez spécifier un nom d’utilisateur",

‎client/locales/examples/zh.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
},
66
"account": "账号",
77
"date": "活动时间",
8-
"type": "活动类型",
9-
"area": "活动区域",
10-
"priority": "优先级",
8+
"priority": {
9+
"label": "优先级",
10+
"low": "",
11+
"medium": "",
12+
"high": ""
13+
},
1114
"organizer": "承办方",
1215
"desc": "活动描述",
1316
"tag": "活动标签",
@@ -28,17 +31,20 @@
2831
}
2932
},
3033
"city": {
34+
"label": "活动区域",
3135
"sh": "上海",
3236
"bj": "北京",
3337
"gz": "广州",
3438
"ly": "🌴",
39+
"ny": "🍎",
3540
"sz": "深圳"
3641
},
3742
"instDist": "即时配送",
38-
"price": "price",
39-
"rights": "rights",
40-
"medium": "",
41-
"high": "",
43+
"type": {
44+
"label": "活动类型",
45+
"price": "价格优惠",
46+
"rights": "价格权益"
47+
},
4248
"rule": {
4349
"account": {
4450
"required": "请输入活动名称",

‎client/pages/about.vue

+14
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,17 @@
44
<p>Hello, I am the about page :)</p>
55
</div>
66
</template>
7+
8+
<script>
9+
import Vue from 'vue'
10+
import Component from 'class-component'
11+
12+
@Component({
13+
head () {
14+
return {
15+
title: 'About'
16+
}
17+
}
18+
})
19+
export default class About extends Vue {}
20+
</script>

‎client/pages/examples/activity/create.vue

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<el-row type="flex" justify="center" :gutter="0">
44
<el-card style="width:90%">
55
<div slot="header">
6-
<span>{{$t(title)}}</span>
6+
<span>{{$t('activity.title.create')}}</span>
77
</div>
88
<new-activity :form-data="activity" ref="popActivity"></new-activity>
99
</el-card>
@@ -13,22 +13,23 @@
1313

1414
<script>
1515
import Vue from 'vue'
16+
import Component from 'class-component'
1617
import NewActivity from '@/components/examples/activity/NewActivity'
17-
import Component, { Getter, namespace } from 'class-component'
18-
19-
const ActivityGetter = namespace('examples/activity', Getter)
2018
2119
@Component({
2220
components: {
2321
NewActivity
22+
},
23+
head () {
24+
return {
25+
title: 'Examples Activity Create'
26+
}
2427
}
2528
})
2629
export default class Create extends Vue {
27-
@ActivityGetter title
28-
2930
activity = {
3031
account: '',
31-
region: '',
32+
city: '',
3233
date1: '',
3334
date2: '',
3435
delivery: false,

0 commit comments

Comments
 (0)
Please sign in to comment.