市北党建引领小程序初始化
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

262 lines
6.2 KiB

// subpages/redSail/pages/flowParty/flowParty.js
const api = require('../../../../utils/partApi')
Page({
/**
* 页面的初始数据
*/
data: {
selectedStatus:false,
selectList:[],
look:true,
informFlag:false,
longitude: 120.372537,
latitude: 36.098056,
scale: 13,
form:{
name:'',//姓名
idCard:'',//身份证
mobile:'',//手机哈
partyName:'',//现属党支部
freelance:'',//自由职业者
workUnit:'',//工作单位
workAddr:'',//工作地址
allDeptIds:[],//所属社区id
deptName:''//社区名称
},
pickerValue:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getByLoginUser()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
showToast (title) {
wx.showToast({
title: title,
icon: 'none',
duration: 2000
})
},
bindRealNameInput (e) {
this.setData({
'form.name': e.detail.value
})
console.log(this.data.form)
},
//身份证双向绑定
bindRealIdcardInput (e) {
this.setData({
'form.idCard': e.detail.value
})
console.log(this.data.form)
},
//手机号双向绑定
bindRealMobileInput (e) {
this.setData({
'form.mobile': e.detail.value
})
console.log(this.data.form)
},
//工作单位双向绑定
bindRealWorkUnitInput (e) {
this.setData({
'form.workUnit': e.detail.value
})
console.log(this.data.form)
},
//工作单位地址双向绑定
bindRealWorkAddrInput (e) {
this.setData({
'form.workAddr': e.detail.value
})
console.log(this.data.form)
},
//现属党支部双向绑定
bindRealPartInput(e){
this.setData({
'form.partyName': e.detail.value
})
console.log(this.data.form)
},
pickerConfirm (e) {
console.log(e);
if(e.currentTarget.dataset.value == '0'){
this.setData({
'form.freelance': e.detail.selectedValue[0],
selectedStatus: false
});
} else if(e.currentTarget.dataset.value == '1'){
this.setData({
['form.allDeptIds']: ['1175270520603930625',e.detail.selectedValue[0]],
'form.deptName':e.detail.label,
selectedStatusH: false
});
}
},
handleCLickShow(e){
this.setData({
pickerValue:e.currentTarget.dataset.value,
selectedStatus: true,
selectList:[]
})
if(e.currentTarget.dataset.value == '0'){
this.setData({
selectList: [{label:'是',value:'1'}, {label:'否',value:'0'}]
})
}else if(e.currentTarget.dataset.value == '1'){
this.setData({
selectList: this.data.orgOptions
})
}
},
submit(){
if (!this.data.form.name) {
this.showToast('请输入姓名')
return false
}
if (!this.data.form.idCard) {
this.showToast('请填写身份证号')
return false
}
if (!this.data.form.mobile) {
this.showToast('请填写手机号')
return false
}
if (!this.data.form.partyName) {
this.showToast('请填写现属党支部')
return false
}
if (!this.data.form.freelance) {
this.showToast('请选择是否为自由职业者')
return false
}
if (!this.data.form.workUnit) {
this.showToast('请填写工作单位')
return false
}
if (!this.data.form.workAddr) {
this.showToast('请填写工作单位地址')
return false
}
if (this.data.form.allDeptIds.length == 0) {
this.showToast('请选择所属社区')
return false
}
const para = {
...this.data.form
}
para.freelance = parseInt(para.freelance)
wx.showLoading({
title: "提交中..."
})
console.log(para);
api.submitFlowparty(para).then(res=>{
wx.hideLoading()
wx.showLoading({
title: '信息提交成功',
content: res.data.msg,
success: () => {
wx.reLaunch({
url: "/pages/index/index"
})
}
})
}).catch(err=>{
wx.hideLoading()
console.log(err);
})
},
getByLoginUser(){
api.getByLoginUser().then(res=>{
if (res.code !== 0) {
return this.$message.error(res.msg)
}
let arr = res.data.options[0].children.filter((item)=>(item.children))
this.setData({
orgOptions : arr
})
})
},
pickerCancel () {
this.setData({
selectedStatus: false
});
},
handleCheckbox(e){
console.log(e);
if(e.detail .value.length!=0){
this.setData({
look:false
})
}else{
this.setData({
look:true
})
}
},
handleBack(){
wx.navigateBack({
delta: 1
})
},
handleNext(){
this.setData({
informFlag:true
})
}
})