8
8
</el-form-item >
9
9
</el-col >
10
10
<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
+ >
13
18
<el-option
14
19
v-for =" item in cities"
15
20
v-if =" !item.disabled"
41
46
</el-col >
42
47
</el-row >
43
48
<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
+ >
46
57
<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 >
49
68
</el-checkbox-group >
50
69
</el-form-item >
51
70
</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
+ >
54
79
<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 >
57
95
</el-radio-group >
58
96
</el-form-item >
59
97
</el-col >
106
144
107
145
<script >
108
146
import Vue from ' vue'
109
- import Component , { Getter , namespace } from ' class-component'
147
+ import Component , { Action , Getter , namespace } from ' class-component'
110
148
111
- const ExampleGetter = namespace (' examples/index' , Getter)
149
+ const ActivityGetter = namespace (' examples/index' , Getter)
150
+ const ActivityAction = namespace (' examples/activity' , Action)
112
151
113
152
@Component ({
114
153
props: {
@@ -117,12 +156,12 @@ const ExampleGetter = namespace('examples/index', Getter)
117
156
default () {
118
157
return {
119
158
account: ' ' ,
120
- region : ' activity.city.ly' ,
159
+ city : ' activity.city.ly' ,
121
160
date1: ' ' ,
122
161
date2: ' ' ,
123
162
delivery: false ,
124
163
type: [],
125
- priority: ' ' ,
164
+ priority: ' activity.priority.low ' ,
126
165
rate: 0 ,
127
166
organizer: [],
128
167
desc: ' ' ,
@@ -138,8 +177,8 @@ const ExampleGetter = namespace('examples/index', Getter)
138
177
{ required: true , message: this .$t (' activity.rule.account.required' ), trigger: ' blur' },
139
178
{ min: 6 , message: this .$t (' activity.rule.account.length' ), trigger: ' blur' }
140
179
],
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' }
143
182
],
144
183
date1: [
145
184
{ type: ' date' , required: true , message: this .$t (' activity.rule.date1.required' ), trigger: ' change' }
@@ -164,9 +203,10 @@ const ExampleGetter = namespace('examples/index', Getter)
164
203
}
165
204
})
166
205
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
170
210
171
211
submit (formName ) {
172
212
/**
@@ -180,7 +220,7 @@ export default class NewActivity extends Vue {
180
220
181
221
this .$refs [formName].validate ((valid ) => {
182
222
if (valid) {
183
- this .$store . dispatch ( ' examples/activity/add ' , this .formData )
223
+ this .addActivity ( this .formData )
184
224
this .$message .success (this .$t (' activity.success' ))
185
225
if (formName === ' popForm' ) {
186
226
this .popVisible = false
0 commit comments