提交 fb0da3a3 authored 作者: 王鹏飞's avatar 王鹏飞

校友地区拆分为两个表单

上级 bd1ba997
......@@ -36,5 +36,5 @@ export function submitApply(data) {
}
// 获取投票城市
export function getApplyCity() {
return httpRequest.get('/api/alumni/v1/vote/vote-config')
return httpRequest.get('/api/alumni/v1/vote/vote-config-new')
}
......@@ -33,6 +33,7 @@ export default {
isMobile,
applyCityList: [],
formModel: {
vote_city: '',
vote_config_id: '',
name: '',
gender: '',
......@@ -64,18 +65,42 @@ export default {
'is-mobile': this.isMobile
}
},
cityList() {
return Object.keys(this.applyCityList).map(item => {
return { name: item, text: item }
})
},
// 学习项目
projectlist() {
const list = this.applyCityList[this.formModel.vote_city] || []
return list.map(item => {
item.name = item.project
item.text = item.project
return item
})
},
fields() {
return [
{
fieldType: 'select',
name: 'vote_config_id',
label: '校友地区',
name: 'vote_city',
label: '地区',
required: true,
placeholder: '请选择地区',
rules: [{ required: true, message: '请选择地区' }],
values: this.applyCityList,
values: this.cityList,
valueKey: 'name'
},
{
fieldType: 'select',
name: 'vote_config_id',
label: '学习项目',
required: true,
placeholder: '请选择学习项目',
rules: [{ required: true, message: '请选择学习项目' }],
values: this.projectlist,
valueKey: 'id'
},
{
name: 'name',
label: '姓名',
......@@ -194,11 +219,11 @@ export default {
methods: {
getApplyCity() {
api.getApplyCity().then(response => {
const list = []
for (const key in response) {
list.push({ name: key, text: response[key] })
}
this.applyCityList = list
// const list = []
// for (const key in response) {
// list.push({ name: key, text: response[key] })
// }
this.applyCityList = response
})
},
handleSubmit() {
......@@ -219,6 +244,7 @@ export default {
data.province = province
data.city = city
}
delete data.vote_city
delete data.area
api.submitApply(data).then(response => {
if (response.success) {
......@@ -239,7 +265,7 @@ export default {
beforeMount() {
const voteApply = window.localStorage.getItem('voteApply')
if (voteApply) {
this.formModel = JSON.parse(voteApply)
this.formModel = Object.assign(this.formModel, JSON.parse(voteApply))
}
this.getApplyCity()
},
......@@ -349,6 +375,7 @@ export default {
margin-top: 40px;
font-size: 23px;
line-height: 23px;
font-weight: 800;
letter-spacing: 1px;
}
.t2 {
......@@ -356,6 +383,7 @@ export default {
font-size: 18px;
line-height: 18px;
letter-spacing: 1px;
font-weight: 400;
}
}
.vote-submit-banner {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论