|
|
|
@ -22,33 +22,40 @@ Page({ |
|
|
|
workUnit: "", //工作单位
|
|
|
|
specialty: "", //特长
|
|
|
|
serviceType: 0, |
|
|
|
workAddr: "" |
|
|
|
workAddr: "", |
|
|
|
community: "" |
|
|
|
}, |
|
|
|
streetArr: ["大港街道", "即墨路街道", "辽宁路街道", "兴隆路街道", "延安路街道", "湖岛街道", "登州路街道", "水清沟街道", "台东街道", "阜新路街道", |
|
|
|
"四方街道", "开平路街道", "宁夏路街道", "镇江路街道", "海伦路街道", "敦化路街道", "双山街道", "洛阳路街道", "辽源路街道", "河西街道", "合肥路街道", |
|
|
|
"浮山新区街道" |
|
|
|
], |
|
|
|
communityArr: ['登台村', '将军台社区'], |
|
|
|
streetArr: [], |
|
|
|
communityArr: [], |
|
|
|
options: null, |
|
|
|
streetData: [], |
|
|
|
newArr:[], |
|
|
|
multiIds:[], |
|
|
|
multiIndex: [0, 0], |
|
|
|
orgOptions:[] |
|
|
|
newArr: [], |
|
|
|
multiIds: [], |
|
|
|
multiIndex: [0, 0], |
|
|
|
orgOptions: [] |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
this.setData({ |
|
|
|
orgOptions:shequ[0].data |
|
|
|
}) |
|
|
|
console.log(this.data.orgOptions); |
|
|
|
for(let i in this.data.shequ){ |
|
|
|
console.log(i); |
|
|
|
} |
|
|
|
// this.getByLoginUser()
|
|
|
|
this.setData({ |
|
|
|
orgOptions: shequ[0].data |
|
|
|
}) |
|
|
|
let street = []; |
|
|
|
let community = [] |
|
|
|
this.data.orgOptions.forEach(f => { |
|
|
|
street.push(f.lable) |
|
|
|
f.children.forEach(item => { |
|
|
|
community.push(item.lable) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
streetArr: street |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
communityArr: community |
|
|
|
}) |
|
|
|
// this.getByLoginUser()
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
@ -98,7 +105,7 @@ Page({ |
|
|
|
*/ |
|
|
|
onShareAppMessage() { |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
back() { |
|
|
|
//返回上一级,关闭当前页面
|
|
|
|
wx.navigateBack({ |
|
|
|
@ -124,7 +131,7 @@ Page({ |
|
|
|
}, |
|
|
|
bindPickerCommunity: function(e) { |
|
|
|
this.setData({ |
|
|
|
["volunteerTypeOneInfo.community"]: e.detail.value |
|
|
|
["volunteerTypeOneInfo.community"]: this.data.communityArr[e.detail.value] |
|
|
|
}) |
|
|
|
}, |
|
|
|
bindNameInput: function(e) { |
|
|
|
@ -153,7 +160,8 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
if (!this.data.volunteerTypeOneInfo.name || !this.data.volunteerTypeOneInfo.idCard || !this.data |
|
|
|
if (!this.data.volunteerTypeOneInfo.name || !this.data |
|
|
|
.volunteerTypeOneInfo.idCard || !this.data |
|
|
|
.volunteerTypeOneInfo.mobile || !this.data |
|
|
|
.volunteerTypeOneInfo.mobile) { |
|
|
|
wx.showToast({ |
|
|
|
@ -163,29 +171,44 @@ Page({ |
|
|
|
return |
|
|
|
} |
|
|
|
this.data.volunteerTypeOneInfo.serviceType = this.data.volunteerType; |
|
|
|
// this.data.volunteerTypeOneInfo.allDeptIds = []
|
|
|
|
// this.data.streetData.forEach(f => {
|
|
|
|
// if (this.data.volunteerTypeOneInfo.street == f.label) {
|
|
|
|
// this.data.volunteerTypeOneInfo.allDeptIds.push(f.allDeptIds)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
this.data.volunteerTypeOneInfo.allDeptIds = [] |
|
|
|
if (this.data.volunteerType == 0) { |
|
|
|
this.data.orgOptions.forEach(f => { |
|
|
|
if (f.lable == this.data.volunteerTypeOneInfo.street) { |
|
|
|
f.children.forEach(item => { |
|
|
|
this.data.volunteerTypeOneInfo.allDeptIds.push(item.value) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (this.data.volunteerType == 1) { |
|
|
|
this.data.orgOptions.forEach(f => { |
|
|
|
f.children.forEach(item => { |
|
|
|
if (item.lable == this.data.volunteerTypeOneInfo.community) { |
|
|
|
this.data.volunteerTypeOneInfo.allDeptIds.push(item.value) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
delete this.data.volunteerTypeOneInfo.community; |
|
|
|
delete this.data.volunteerTypeOneInfo.street; |
|
|
|
const _this = this; |
|
|
|
api.saveOrder(_this.data.volunteerTypeOneInfo).then(res => { |
|
|
|
if (res != 0) { |
|
|
|
wx.showToast({ |
|
|
|
title: "提交成功", |
|
|
|
icon: 'success', |
|
|
|
duration: 2000 //持续的时间
|
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
_this.back() |
|
|
|
}, 2000) |
|
|
|
} |
|
|
|
wx.showToast({ |
|
|
|
title: "提交成功", |
|
|
|
icon: 'success', |
|
|
|
duration: 2000 //持续的时间
|
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
_this.back() |
|
|
|
}, 2000) |
|
|
|
_this.data.volunteerTypeOneInfo.allDeptIds = [] |
|
|
|
}).catch(err => { |
|
|
|
wx.showToast({ |
|
|
|
title: err.msg, |
|
|
|
duration: 2000 //持续的时间
|
|
|
|
}) |
|
|
|
_this.data.volunteerTypeOneInfo.allDeptIds = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
getByLoginUser() { |
|
|
|
|