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

校友地区拆分为两个表单

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