|
|
|
|
|
const app=getApp();
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
//
|
|
|
ifempower:true,//是否授权
|
|
|
showapply:false,
|
|
|
provincearr:[],
|
|
|
cityarr:[],
|
|
|
countryarr:[],
|
|
|
confirmvalarr:[0,0,0],
|
|
|
valarr:[0,0,0],
|
|
|
photo: '',
|
|
|
name: '',
|
|
|
enddata:'',
|
|
|
arraysex: ['男', '女'],
|
|
|
sex: '',
|
|
|
birthday: '', //生日
|
|
|
nation: '', //民族
|
|
|
nationarr: ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族", "土家族",
|
|
|
"哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族",
|
|
|
"土族", "达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族",
|
|
|
"俄罗斯族", "鄂温克族", "德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"
|
|
|
],
|
|
|
|
|
|
politics: '', //政治面貌
|
|
|
politicsarr: ['共青团员', '中共预备党员', '中共党员', '群众', '无党派人士', '其他'], //
|
|
|
education: '', //学历
|
|
|
educationarr: ['小学', '中学', '专科', '本科', '硕士研究生', '博士研究生', '其他'], //
|
|
|
unit: '', //工作单位
|
|
|
duty: '', //职务
|
|
|
addr: '', //通讯地址,
|
|
|
postcode: '', //邮编
|
|
|
school: '', //
|
|
|
card_number: '', //身份证号码
|
|
|
move_phone: '', //
|
|
|
email: '', //
|
|
|
urgency_phone: '', //
|
|
|
qq: '',
|
|
|
province: '',
|
|
|
city: '',
|
|
|
county: '',
|
|
|
address: '', //详细地址,
|
|
|
type: '', //1医院志愿者,2社会志愿者,3办事处志愿者
|
|
|
typearr: ['医院志愿者', '社会志愿者', '办事处志愿者'],
|
|
|
apply_nav: 0, //0为履历1,1为履历2,2为履历3,
|
|
|
record: [{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
}
|
|
|
],
|
|
|
front_card: '', //身份证正面照
|
|
|
reverse_card: '', //身份证反面照
|
|
|
id:'',//用户id,
|
|
|
},
|
|
|
setname(e) {
|
|
|
this.setData({
|
|
|
name: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setunit(e) {
|
|
|
this.setData({
|
|
|
unit: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setduty(e) {
|
|
|
this.setData({
|
|
|
duty: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setaddr(e) {
|
|
|
this.setData({
|
|
|
addr: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setpostcode(e) {
|
|
|
this.setData({
|
|
|
postcode: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setschool(e) {
|
|
|
this.setData({
|
|
|
school: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setcard_number(e) {
|
|
|
this.setData({
|
|
|
card_number: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setemail(e) {
|
|
|
this.setData({
|
|
|
email: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
seturgency_phone(e) {
|
|
|
this.setData({
|
|
|
urgency_phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setqq(e) {
|
|
|
this.setData({
|
|
|
qq: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindsex(e) {
|
|
|
this.setData({
|
|
|
sex: parseInt(e.detail.value) + 1
|
|
|
})
|
|
|
},
|
|
|
|
|
|
setmove_phone(e) {
|
|
|
this.setData({
|
|
|
move_phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
bindbirthdayChange(e) {
|
|
|
this.setData({
|
|
|
birthday: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindnationChange(e) {
|
|
|
let nationarr = this.data.nationarr;
|
|
|
this.setData({
|
|
|
nation: nationarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
bindeducationChange(e) {
|
|
|
let educationarr = this.data.educationarr;
|
|
|
this.setData({
|
|
|
education: educationarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
|
|
|
bindpoliticsChange(e) {
|
|
|
let politicsarr = this.data.politicsarr;
|
|
|
this.setData({
|
|
|
politics: politicsarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
// bindtypeChange(e) {
|
|
|
// let typearr = this.data.typearr;
|
|
|
// this.setData({
|
|
|
// type: parseInt(e.detail.value) +1
|
|
|
// })
|
|
|
// },
|
|
|
start(e) {
|
|
|
let that = this;
|
|
|
let tem = e.currentTarget.dataset.tem;
|
|
|
app.globalData.userInfo = e.detail.userInfo;
|
|
|
wx.login({
|
|
|
success: function (s) {
|
|
|
let url = 'wxapp/public/getSessionKey';
|
|
|
if (s.code) {
|
|
|
var code = s.code;
|
|
|
var param = {
|
|
|
code: code
|
|
|
}
|
|
|
app.post(url, param).then((res) => {
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv,tem);
|
|
|
}).catch((errMsg) => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
login(openid, session_key, encrypted_data, iv,tem) {
|
|
|
let that = this;
|
|
|
let param = {
|
|
|
openid: openid,
|
|
|
session_key: session_key,
|
|
|
encrypted_data: encrypted_data,
|
|
|
iv: iv
|
|
|
}
|
|
|
let url = 'wxapp/public/login';
|
|
|
app.post(url, param).then((res) => {
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
that.setData({
|
|
|
ifempower:true
|
|
|
})
|
|
|
that.uploadImage(tem);
|
|
|
}).catch((errMsg) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择省市区
|
|
|
getarea(){
|
|
|
let that=this;
|
|
|
let url ='index/area/index';
|
|
|
app.post(url,{}).then((res)=>{
|
|
|
let country = res.country;
|
|
|
let tem = {
|
|
|
id: 0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id: 0,
|
|
|
country_name: ''
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
let cityarr = res.city;
|
|
|
let countryarr = res.country;
|
|
|
let provincearr = res.province;
|
|
|
that.setData({
|
|
|
cityarr: cityarr,
|
|
|
countryarr: temcountry,
|
|
|
provincearr: provincearr
|
|
|
})
|
|
|
if (that.data.is_submit==undefined){
|
|
|
that.setData({
|
|
|
ifempower:false
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
//
|
|
|
ifempower: true, //是否授权
|
|
|
showapply: false,
|
|
|
provincearr: [],
|
|
|
cityarr: [],
|
|
|
countryarr: [],
|
|
|
confirmvalarr: [0, 0, 0],
|
|
|
valarr: [0, 0, 0],
|
|
|
photo: '',
|
|
|
name: '',
|
|
|
enddata: '',
|
|
|
arraysex: ['男', '女'],
|
|
|
sex: '',
|
|
|
birthday: '', //生日
|
|
|
nation: '', //民族
|
|
|
nationarr: ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族", "土家族",
|
|
|
"哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族",
|
|
|
"土族", "达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族",
|
|
|
"俄罗斯族", "鄂温克族", "德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"
|
|
|
],
|
|
|
|
|
|
politics: '', //政治面貌
|
|
|
politicsarr: ['共青团员', '中共预备党员', '中共党员', '群众', '无党派人士', '其他'], //
|
|
|
education: '', //学历
|
|
|
educationarr: ['小学', '中学', '专科', '本科', '硕士研究生', '博士研究生', '其他'], //
|
|
|
unit: '', //工作单位
|
|
|
duty: '', //职务
|
|
|
addr: '', //通讯地址,
|
|
|
postcode: '', //邮编
|
|
|
school: '', //
|
|
|
card_number: '', //身份证号码
|
|
|
move_phone: '', //
|
|
|
email: '', //
|
|
|
urgency_phone: '', //
|
|
|
qq: '',
|
|
|
province: '',
|
|
|
city: '',
|
|
|
county: '',
|
|
|
address: '', //详细地址,
|
|
|
type: '', //1医院志愿者,2社会志愿者,3办事处志愿者
|
|
|
typearr: ['医院志愿者', '社会志愿者', '办事处志愿者'],
|
|
|
apply_nav: 0, //0为履历1,1为履历2,2为履历3,
|
|
|
record: [{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
}
|
|
|
],
|
|
|
front_card: '', //身份证正面照
|
|
|
reverse_card: '', //身份证反面照
|
|
|
id: '', //用户id,
|
|
|
},
|
|
|
setname(e) {
|
|
|
this.setData({
|
|
|
name: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setunit(e) {
|
|
|
this.setData({
|
|
|
unit: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setduty(e) {
|
|
|
this.setData({
|
|
|
duty: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setaddr(e) {
|
|
|
this.setData({
|
|
|
addr: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setpostcode(e) {
|
|
|
this.setData({
|
|
|
postcode: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setschool(e) {
|
|
|
this.setData({
|
|
|
school: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setcard_number(e) {
|
|
|
this.setData({
|
|
|
card_number: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setemail(e) {
|
|
|
this.setData({
|
|
|
email: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
seturgency_phone(e) {
|
|
|
this.setData({
|
|
|
urgency_phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
setqq(e) {
|
|
|
this.setData({
|
|
|
qq: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindsex(e) {
|
|
|
this.setData({
|
|
|
sex: parseInt(e.detail.value) + 1
|
|
|
})
|
|
|
},
|
|
|
|
|
|
}else if (that.data.is_submit=='1'){
|
|
|
that.getdatalist();
|
|
|
}
|
|
|
setmove_phone(e) {
|
|
|
this.setData({
|
|
|
move_phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
}).catch((err)=>{
|
|
|
bindbirthdayChange(e) {
|
|
|
this.setData({
|
|
|
birthday: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindnationChange(e) {
|
|
|
let nationarr = this.data.nationarr;
|
|
|
this.setData({
|
|
|
nation: nationarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
bindeducationChange(e) {
|
|
|
let educationarr = this.data.educationarr;
|
|
|
this.setData({
|
|
|
education: educationarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//切换省份获取市和区/县
|
|
|
get_city(province_id=0){
|
|
|
let that=this;
|
|
|
let url ='index/area/get_city';
|
|
|
let params={
|
|
|
'province_id': province_id
|
|
|
}
|
|
|
app.post(url, params).then((res)=>{
|
|
|
let country = res.country;
|
|
|
let tem = {
|
|
|
id: 0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id: 0,
|
|
|
country_name: ' '
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
that.setData({
|
|
|
cityarr: res.city,
|
|
|
countryarr: temcountry
|
|
|
})
|
|
|
}).catch((err)=>{
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//切换市获取区/县
|
|
|
get_country(city_id=0){
|
|
|
let that=this;
|
|
|
let url ='index/area/get_country';
|
|
|
let params={
|
|
|
'city_id': city_id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
let country = res.country;
|
|
|
let tem={
|
|
|
id:0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id:0,
|
|
|
country_name:' '
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
that.setData({
|
|
|
countryarr: temcountry
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
bindChange: function (e) {
|
|
|
let that=this;
|
|
|
let valarr = that.data.valarr;
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
const val = e.detail.value;
|
|
|
if (valarr[0] != val[0] ){//改变省
|
|
|
let i = val[0];
|
|
|
that.get_city(provincearr[i].province_id);
|
|
|
valarr[0] = val[0];
|
|
|
valarr[1] = 0;
|
|
|
valarr[2] = 0;
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
} else if (valarr[1] != val[1]){//改变市
|
|
|
let j = val[1];
|
|
|
that.get_country(cityarr[j].city_id);
|
|
|
valarr[1] = val[1];
|
|
|
valarr[2] = 0;
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
}else {//改变区
|
|
|
valarr[2] = val[2];
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
//取消地区选择
|
|
|
setno(){
|
|
|
let that=this;
|
|
|
that.setData({
|
|
|
valarr: that.data.confirmvalarr,
|
|
|
showapply: false
|
|
|
})
|
|
|
},
|
|
|
//确定选择区域
|
|
|
setyes(){
|
|
|
let that=this;
|
|
|
let valarr = that.data.valarr;
|
|
|
let i = valarr[0];
|
|
|
let j = valarr[1];
|
|
|
let k = valarr[2];
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
let countryarr = that.data.countryarr;
|
|
|
that.setData({
|
|
|
confirmvalarr: valarr,
|
|
|
province: provincearr[i].province_name,
|
|
|
city: cityarr[j].city_name,
|
|
|
county: countryarr[k].country_name,
|
|
|
address: provincearr[i].province_name + cityarr[j].city_name + countryarr[k].country_name,
|
|
|
showapply:false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
setshowapply(){
|
|
|
let that=this;
|
|
|
that.setData({
|
|
|
showapply:true
|
|
|
})
|
|
|
},
|
|
|
setshowapply_no() {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
showapply: false
|
|
|
})
|
|
|
},
|
|
|
void_fun(){
|
|
|
},
|
|
|
bindRegionChange(e){
|
|
|
let that=this;
|
|
|
this.setData({
|
|
|
region: e.detail.value,
|
|
|
province: e.detail.value[0],
|
|
|
city: e.detail.value[1],
|
|
|
county: e.detail.value[2],
|
|
|
address: e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
|
|
|
})
|
|
|
},
|
|
|
bindstartChange(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = parseInt(that.data.apply_nav);
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_start_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
bindendChange(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_end_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordunit(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_unit = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordname(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_name = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordduty(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_duty = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordphone(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_phone = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
uploadImages(e){
|
|
|
let that=this;
|
|
|
let tem = e.currentTarget.dataset.tem;
|
|
|
that.uploadImage(tem);
|
|
|
|
|
|
},
|
|
|
//上传头像1为头像,2为省份证正面,3为省份证反面
|
|
|
uploadImage(tem) {
|
|
|
let that = this;
|
|
|
wx.chooseImage({
|
|
|
count: 1,
|
|
|
sizeType: ['original', 'compressed'],
|
|
|
success: function(res) {
|
|
|
let tempFilePaths = res.tempFilePaths //总文件
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token'),
|
|
|
'XX-Device-Type': ''
|
|
|
bindpoliticsChange(e) {
|
|
|
let politicsarr = this.data.politicsarr;
|
|
|
this.setData({
|
|
|
politics: politicsarr[e.detail.value]
|
|
|
})
|
|
|
},
|
|
|
// bindtypeChange(e) {
|
|
|
// let typearr = this.data.typearr;
|
|
|
// this.setData({
|
|
|
// type: parseInt(e.detail.value) +1
|
|
|
// })
|
|
|
// },
|
|
|
start(e) {
|
|
|
let that = this;
|
|
|
let tem = e.currentTarget.dataset.tem;
|
|
|
app.globalData.userInfo = e.detail.userInfo;
|
|
|
wx.login({
|
|
|
success: function(s) {
|
|
|
let url = 'wxapp/public/getSessionKey';
|
|
|
if (s.code) {
|
|
|
var code = s.code;
|
|
|
var param = {
|
|
|
code: code
|
|
|
}
|
|
|
app.post(url, param).then((res) => {
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv, tem);
|
|
|
}).catch((errMsg) => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
login(openid, session_key, encrypted_data, iv, tem) {
|
|
|
let that = this;
|
|
|
let param = {
|
|
|
openid: openid,
|
|
|
session_key: session_key,
|
|
|
encrypted_data: encrypted_data,
|
|
|
iv: iv
|
|
|
}
|
|
|
let url = 'https://volunteer.cnpu.org/api/user/upload/one';
|
|
|
wx.uploadFile({
|
|
|
url: url, //仅为示例,非真实的接口地址
|
|
|
filePath: tempFilePaths[0],
|
|
|
name: 'file',
|
|
|
header: head,
|
|
|
formData: {},
|
|
|
success: function(res) {
|
|
|
let temdata = JSON.parse(res.data);
|
|
|
if (temdata.code == 20000) {
|
|
|
if (tem == '1') {
|
|
|
that.setData({
|
|
|
photo: temdata.data.url
|
|
|
})
|
|
|
} else if (tem == '2') {
|
|
|
that.setData({
|
|
|
front_card: temdata.data.url
|
|
|
})
|
|
|
} else if (tem == '3') {
|
|
|
let url = 'wxapp/public/login';
|
|
|
app.post(url, param).then((res) => {
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
that.setData({
|
|
|
ifempower: true
|
|
|
})
|
|
|
that.uploadImage(tem);
|
|
|
}).catch((errMsg) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择省市区
|
|
|
getarea() {
|
|
|
let that = this;
|
|
|
let url = 'index/area/index';
|
|
|
app.post(url, {}).then((res) => {
|
|
|
let country = res.country;
|
|
|
let tem = {
|
|
|
id: 0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id: 0,
|
|
|
country_name: ''
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
let cityarr = res.city;
|
|
|
let countryarr = res.country;
|
|
|
let provincearr = res.province;
|
|
|
that.setData({
|
|
|
cityarr: cityarr,
|
|
|
countryarr: temcountry,
|
|
|
provincearr: provincearr
|
|
|
})
|
|
|
if (that.data.is_submit == undefined) {
|
|
|
that.setData({
|
|
|
reverse_card: temdata.data.url
|
|
|
ifempower: false
|
|
|
})
|
|
|
}
|
|
|
|
|
|
} else if (that.data.is_submit == '1') {
|
|
|
that.getdatalist();
|
|
|
}
|
|
|
},
|
|
|
fail: function(res) {},
|
|
|
complete: () => {}
|
|
|
})
|
|
|
},
|
|
|
fail: function(res) {}
|
|
|
})
|
|
|
},
|
|
|
setapply_nav(e) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
apply_nav: e.currentTarget.dataset.apply_nav
|
|
|
})
|
|
|
},
|
|
|
submit() {
|
|
|
let that = this;
|
|
|
let err='';
|
|
|
//匹配中国邮政编码
|
|
|
// var AuglyTest_PostalCode = /^[0-9]\\d{5}$/;
|
|
|
//匹配身份证
|
|
|
var AuglyTest_ID = /\d{15}|\d{18}/;
|
|
|
//验证手机号
|
|
|
var AuglyTest_phone =/^1(3|4|5|6|7|8)\d{9}$/;
|
|
|
//验证腾讯QQ号
|
|
|
var AuglyTest_QQ = /^[1-9]*[1-9][0-9]*$/;
|
|
|
//匹配国内电话号码
|
|
|
var AuglyTest_tel = /(\d{3}-|\d{4}-)?(\d{8}|\d{7})?/;
|
|
|
//email地址
|
|
|
var AuglyTest_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
|
|
if (that.data.photo==''){
|
|
|
err = '请上传您的头像!'
|
|
|
} else if (that.data.name==''){
|
|
|
err='请输入您的姓名!'
|
|
|
} else if (that.data.sex==''){
|
|
|
err = '请选择您的姓别!';
|
|
|
} else if (that.data.birthday==''){
|
|
|
err = '请选择您的出生日期!';
|
|
|
} else if (that.data.nation==''){
|
|
|
err = '请选择您的民族!';
|
|
|
} else if (that.data.education==''){
|
|
|
err = '请选择您的学历!';
|
|
|
} else if (that.data.politics==''){
|
|
|
err = '请选择您的政治面貌!';
|
|
|
} else if (that.data.unit==''){
|
|
|
err='请填写您的工作单位!';
|
|
|
} else if (that.data.duty==''){
|
|
|
err = '请填写您的职务!';
|
|
|
} else if (that.data.addr==''){
|
|
|
err ='请填写您的通讯地址!';
|
|
|
} else if (that.data.postcode==''){
|
|
|
err = '请填写您的邮编!';
|
|
|
} else if (that.data.school==''){
|
|
|
err ='请输入就读/毕业院校!';
|
|
|
} else if (that.data.card_number==''){
|
|
|
err = '请输入您的身份证号!';
|
|
|
} else if (!AuglyTest_ID.test(that.data.card_number)){
|
|
|
err = '请输入正确的身份证号!';
|
|
|
}else if (that.data.move_phone==''){
|
|
|
err = '请输入您的移动电话!';
|
|
|
} else if (!AuglyTest_phone.test(that.data.move_phone)){
|
|
|
err = '请输入正确的移动电话!';
|
|
|
}else if (that.data.email==''){
|
|
|
err = '请输入您的电子邮箱!';
|
|
|
} else if (!AuglyTest_email.test(that.data.email)){
|
|
|
err = '请输入正确的电子邮箱!';
|
|
|
}else if (that.data.urgency_phone==''){
|
|
|
err = '请输入紧急联系人及电话!';
|
|
|
} else if (that.data.qq==''){
|
|
|
err = '请输入您的QQ!';
|
|
|
} else if (!AuglyTest_QQ.test(that.data.qq)){
|
|
|
err = '请输入正确的QQ号!';
|
|
|
}
|
|
|
else if (that.data.address==''){
|
|
|
err = '请选择您的服务区域';
|
|
|
} else if(that.data.type==''){
|
|
|
err = '请选择您的志愿类别!';
|
|
|
} else if (that.data.front_card==''){
|
|
|
err = '请上传身份证正面!';
|
|
|
} else if (that.data.reverse_card==''){
|
|
|
err = '请上传身份证反面!';
|
|
|
}
|
|
|
if(err==''){
|
|
|
let record = that.data.record;
|
|
|
let record_start_time = [];
|
|
|
let record_end_time = [];
|
|
|
let record_unit = [];
|
|
|
let record_duty = [];
|
|
|
let record_name = [];
|
|
|
let record_phone = [];
|
|
|
for (let obj of record) {
|
|
|
record_start_time.push(obj.record_start_time);
|
|
|
record_end_time.push(obj.record_end_time);
|
|
|
record_unit.push(obj.record_unit);
|
|
|
record_duty.push(obj.record_duty);
|
|
|
record_name.push(obj.record_name);
|
|
|
record_phone.push(obj.record_phone);
|
|
|
}
|
|
|
let url = 'index/member_center/submit_form';
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token')
|
|
|
}
|
|
|
let params = {
|
|
|
name: that.data.name,
|
|
|
sex: that.data.sex,
|
|
|
birthday: that.data.birthday,
|
|
|
nation: that.data.nation,
|
|
|
politics: that.data.politics,
|
|
|
education: that.data.education,
|
|
|
unit: that.data.unit,
|
|
|
duty: that.data.duty,
|
|
|
addr: that.data.addr,
|
|
|
school: that.data.school,
|
|
|
card_number: that.data.card_number,
|
|
|
|
|
|
move_phone: that.data.move_phone,
|
|
|
postcode: that.data.postcode,
|
|
|
email: that.data.email,
|
|
|
urgency_phone: that.data.urgency_phone,
|
|
|
qq: that.data.qq,
|
|
|
province: that.data.province,
|
|
|
city: that.data.city,
|
|
|
county: that.data.county,
|
|
|
address: that.data.address,
|
|
|
// type: that.data.type,
|
|
|
record_start_time: record_start_time,
|
|
|
record_end_time: record_end_time,
|
|
|
record_unit: record_unit,
|
|
|
record_duty: record_duty,
|
|
|
record_name: record_name,
|
|
|
record_phone: record_phone,
|
|
|
front_card: that.data.front_card,
|
|
|
reverse_card: that.data.reverse_card,
|
|
|
photo: that.data.photo
|
|
|
}
|
|
|
app.post(url, params, head).then((res) => {
|
|
|
wx.showToast({
|
|
|
title: '提交成功,等待审核',
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
|
|
|
setTimeout(function(){
|
|
|
wx.switchTab({
|
|
|
url: '/pages/my/my'
|
|
|
})
|
|
|
},1000)
|
|
|
}).catch((err) => {
|
|
|
})
|
|
|
}else{
|
|
|
wx.showToast({
|
|
|
title: err,
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
getdatalist(){
|
|
|
let that=this;
|
|
|
let url ='/index/member_center/edit';
|
|
|
let params={
|
|
|
'id':that.data.id
|
|
|
};
|
|
|
let head={
|
|
|
'XX-Token':wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, head).then((res)=>{
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
let countryarr = that.data.countryarr;
|
|
|
let val=[0,0,0];
|
|
|
for (let i=0; i<provincearr.length;i++ ){
|
|
|
if (provincearr[i].province_name == res.province){
|
|
|
val[0]=i;
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//切换省份获取市和区/县
|
|
|
get_city(province_id = 0) {
|
|
|
let that = this;
|
|
|
let url = 'index/area/get_city';
|
|
|
let params = {
|
|
|
'province_id': province_id
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < cityarr.length; i++) {
|
|
|
if (cityarr[i].city_name == res.city) {
|
|
|
val[1] = i;
|
|
|
app.post(url, params).then((res) => {
|
|
|
let country = res.country;
|
|
|
let tem = {
|
|
|
id: 0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id: 0,
|
|
|
country_name: ' '
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
that.setData({
|
|
|
cityarr: res.city,
|
|
|
countryarr: temcountry
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//切换市获取区/县
|
|
|
get_country(city_id = 0) {
|
|
|
let that = this;
|
|
|
let url = 'index/area/get_country';
|
|
|
let params = {
|
|
|
'city_id': city_id
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < countryarr.length; i++) {
|
|
|
if (countryarr[i].country_name == res.county) {
|
|
|
val[2] = i;
|
|
|
app.post(url, params).then((res) => {
|
|
|
let country = res.country;
|
|
|
let tem = {
|
|
|
id: 0,
|
|
|
city_id: res.country[0].city_id,
|
|
|
country_id: 0,
|
|
|
country_name: ' '
|
|
|
}
|
|
|
country.push(tem);
|
|
|
let temcountry = country.reverse();
|
|
|
that.setData({
|
|
|
countryarr: temcountry
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
bindChange: function(e) {
|
|
|
let that = this;
|
|
|
let valarr = that.data.valarr;
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
const val = e.detail.value;
|
|
|
if (valarr[0] != val[0]) { //改变省
|
|
|
let i = val[0];
|
|
|
that.get_city(provincearr[i].province_id);
|
|
|
valarr[0] = val[0];
|
|
|
valarr[1] = 0;
|
|
|
valarr[2] = 0;
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
} else if (valarr[1] != val[1]) { //改变市
|
|
|
let j = val[1];
|
|
|
that.get_country(cityarr[j].city_id);
|
|
|
valarr[1] = val[1];
|
|
|
valarr[2] = 0;
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
} else { //改变区
|
|
|
valarr[2] = val[2];
|
|
|
that.setData({
|
|
|
valarr: valarr
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
that.setData({
|
|
|
valarr: val,
|
|
|
confirmvalarr: val,
|
|
|
addr: res.addr,
|
|
|
address: res.address,
|
|
|
birthday: res.birthday,
|
|
|
card_number: res.card_number,
|
|
|
city: res.city,
|
|
|
county: res.county,
|
|
|
duty: res.duty,
|
|
|
education: res.education,
|
|
|
email: res.email,
|
|
|
front_card: res.front_card,
|
|
|
move_phone: res.move_phone,
|
|
|
name: res.name,
|
|
|
nation: res.nation,
|
|
|
photo: res.photo,
|
|
|
politics: res.politics,
|
|
|
postcode:res.postcode,
|
|
|
province: res.province,
|
|
|
qq: res.qq,
|
|
|
record: res.record,
|
|
|
reverse_card: res.reverse_card,
|
|
|
school: res.school,
|
|
|
sex: res.sex,
|
|
|
unit: res.unit,
|
|
|
urgency_phone: res.urgency_phone,
|
|
|
type: res.type
|
|
|
})
|
|
|
}).catch((err)=>{
|
|
|
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
let that=this;
|
|
|
that.setData({
|
|
|
is_submit: options.is_submit,
|
|
|
id: options.id
|
|
|
})
|
|
|
let now = new Date();
|
|
|
let time = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate();
|
|
|
this.setData({
|
|
|
enddata: time
|
|
|
})
|
|
|
that.getarea();
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
//取消地区选择
|
|
|
setno() {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
valarr: that.data.confirmvalarr,
|
|
|
showapply: false
|
|
|
})
|
|
|
},
|
|
|
//确定选择区域
|
|
|
setyes() {
|
|
|
let that = this;
|
|
|
let valarr = that.data.valarr;
|
|
|
let i = valarr[0];
|
|
|
let j = valarr[1];
|
|
|
let k = valarr[2];
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
let countryarr = that.data.countryarr;
|
|
|
that.setData({
|
|
|
confirmvalarr: valarr,
|
|
|
province: provincearr[i].province_name,
|
|
|
city: cityarr[j].city_name,
|
|
|
county: countryarr[k].country_name,
|
|
|
address: provincearr[i].province_name + cityarr[j].city_name + countryarr[k].country_name,
|
|
|
showapply: false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
setshowapply() {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
showapply: true
|
|
|
})
|
|
|
},
|
|
|
setshowapply_no() {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
showapply: false
|
|
|
})
|
|
|
},
|
|
|
void_fun() {},
|
|
|
bindRegionChange(e) {
|
|
|
let that = this;
|
|
|
this.setData({
|
|
|
region: e.detail.value,
|
|
|
province: e.detail.value[0],
|
|
|
city: e.detail.value[1],
|
|
|
county: e.detail.value[2],
|
|
|
address: e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
|
|
|
})
|
|
|
},
|
|
|
bindstartChange(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = parseInt(that.data.apply_nav);
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_start_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
bindendChange(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_end_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordunit(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_unit = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordname(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_name = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordduty(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_duty = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
setrecordphone(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].record_phone = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
uploadImages(e) {
|
|
|
let that = this;
|
|
|
let tem = e.currentTarget.dataset.tem;
|
|
|
that.uploadImage(tem);
|
|
|
|
|
|
},
|
|
|
//上传头像1为头像,2为省份证正面,3为省份证反面
|
|
|
uploadImage(tem) {
|
|
|
let that = this;
|
|
|
wx.chooseImage({
|
|
|
count: 1,
|
|
|
sizeType: ['original', 'compressed'],
|
|
|
success: function(res) {
|
|
|
let tempFilePaths = res.tempFilePaths //总文件
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token'),
|
|
|
'XX-Device-Type': ''
|
|
|
}
|
|
|
let url = 'https://volunteer.cnpu.org/api/user/upload/one';
|
|
|
wx.uploadFile({
|
|
|
url: url, //仅为示例,非真实的接口地址
|
|
|
filePath: tempFilePaths[0],
|
|
|
name: 'file',
|
|
|
header: head,
|
|
|
formData: {},
|
|
|
success: function(res) {
|
|
|
let temdata = JSON.parse(res.data);
|
|
|
if (temdata.code == 20000) {
|
|
|
if (tem == '1') {
|
|
|
that.setData({
|
|
|
photo: temdata.data.url
|
|
|
})
|
|
|
} else if (tem == '2') {
|
|
|
that.setData({
|
|
|
front_card: temdata.data.url
|
|
|
})
|
|
|
} else if (tem == '3') {
|
|
|
that.setData({
|
|
|
reverse_card: temdata.data.url
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
fail: function(res) {},
|
|
|
complete: () => {}
|
|
|
})
|
|
|
},
|
|
|
fail: function(res) {}
|
|
|
})
|
|
|
},
|
|
|
setapply_nav(e) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
apply_nav: e.currentTarget.dataset.apply_nav
|
|
|
})
|
|
|
},
|
|
|
submit() {
|
|
|
let that = this;
|
|
|
let err = '';
|
|
|
//匹配中国邮政编码
|
|
|
// var AuglyTest_PostalCode = /^[0-9]\\d{5}$/;
|
|
|
//匹配身份证
|
|
|
var AuglyTest_ID = /\d{15}|\d{18}/;
|
|
|
//验证手机号
|
|
|
var AuglyTest_phone = /^1(3|4|5|6|7|8)\d{9}$/;
|
|
|
//验证腾讯QQ号
|
|
|
var AuglyTest_QQ = /^[1-9]*[1-9][0-9]*$/;
|
|
|
//匹配国内电话号码
|
|
|
var AuglyTest_tel = /(\d{3}-|\d{4}-)?(\d{8}|\d{7})?/;
|
|
|
//email地址
|
|
|
var AuglyTest_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
|
|
if (that.data.photo == '') {
|
|
|
err = '请上传您的头像!'
|
|
|
} else if (that.data.name == '') {
|
|
|
err = '请输入您的姓名!'
|
|
|
} else if (that.data.sex == '') {
|
|
|
err = '请选择您的姓别!';
|
|
|
} else if (that.data.birthday == '') {
|
|
|
err = '请选择您的出生日期!';
|
|
|
} else if (that.data.nation == '') {
|
|
|
err = '请选择您的民族!';
|
|
|
} else if (that.data.education == '') {
|
|
|
err = '请选择您的学历!';
|
|
|
} else if (that.data.politics == '') {
|
|
|
err = '请选择您的政治面貌!';
|
|
|
} else if (that.data.unit == '') {
|
|
|
err = '请填写您的工作单位!';
|
|
|
} else if (that.data.duty == '') {
|
|
|
err = '请填写您的职务!';
|
|
|
} else if (that.data.addr == '') {
|
|
|
err = '请填写您的通讯地址!';
|
|
|
} else if (that.data.postcode == '') {
|
|
|
err = '请填写您的邮编!';
|
|
|
} else if (that.data.school == '') {
|
|
|
err = '请输入就读/毕业院校!';
|
|
|
} else if (that.data.card_number == '') {
|
|
|
err = '请输入您的身份证号!';
|
|
|
} else if (!AuglyTest_ID.test(that.data.card_number)) {
|
|
|
err = '请输入正确的身份证号!';
|
|
|
} else if (that.data.move_phone == '') {
|
|
|
err = '请输入您的移动电话!';
|
|
|
} else if (!AuglyTest_phone.test(that.data.move_phone)) {
|
|
|
err = '请输入正确的移动电话!';
|
|
|
} else if (that.data.email == '') {
|
|
|
err = '请输入您的电子邮箱!';
|
|
|
} else if (!AuglyTest_email.test(that.data.email)) {
|
|
|
err = '请输入正确的电子邮箱!';
|
|
|
} else if (that.data.urgency_phone == '') {
|
|
|
err = '请输入紧急联系人及电话!';
|
|
|
} else if (that.data.qq == '') {
|
|
|
err = '请输入您的QQ!';
|
|
|
} else if (!AuglyTest_QQ.test(that.data.qq)) {
|
|
|
err = '请输入正确的QQ号!';
|
|
|
} else if (that.data.address == '') {
|
|
|
err = '请选择您的服务区域';
|
|
|
} else if (that.data.type == '') {
|
|
|
err = '请选择您的志愿类别!';
|
|
|
} else if (that.data.front_card == '') {
|
|
|
err = '请上传身份证正面!';
|
|
|
} else if (that.data.reverse_card == '') {
|
|
|
err = '请上传身份证反面!';
|
|
|
}
|
|
|
if (err == '') {
|
|
|
let record = that.data.record;
|
|
|
let record_start_time = [];
|
|
|
let record_end_time = [];
|
|
|
let record_unit = [];
|
|
|
let record_duty = [];
|
|
|
let record_name = [];
|
|
|
let record_phone = [];
|
|
|
for (let obj of record) {
|
|
|
record_start_time.push(obj.record_start_time);
|
|
|
record_end_time.push(obj.record_end_time);
|
|
|
record_unit.push(obj.record_unit);
|
|
|
record_duty.push(obj.record_duty);
|
|
|
record_name.push(obj.record_name);
|
|
|
record_phone.push(obj.record_phone);
|
|
|
}
|
|
|
let url = 'index/member_center/submit_form';
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token')
|
|
|
}
|
|
|
let params = {
|
|
|
name: that.data.name,
|
|
|
sex: that.data.sex,
|
|
|
birthday: that.data.birthday,
|
|
|
nation: that.data.nation,
|
|
|
politics: that.data.politics,
|
|
|
education: that.data.education,
|
|
|
unit: that.data.unit,
|
|
|
duty: that.data.duty,
|
|
|
addr: that.data.addr,
|
|
|
school: that.data.school,
|
|
|
card_number: that.data.card_number,
|
|
|
|
|
|
move_phone: that.data.move_phone,
|
|
|
postcode: that.data.postcode,
|
|
|
email: that.data.email,
|
|
|
urgency_phone: that.data.urgency_phone,
|
|
|
qq: that.data.qq,
|
|
|
province: that.data.province,
|
|
|
city: that.data.city,
|
|
|
county: that.data.county,
|
|
|
address: that.data.address,
|
|
|
// type: that.data.type,
|
|
|
record_start_time: record_start_time,
|
|
|
record_end_time: record_end_time,
|
|
|
record_unit: record_unit,
|
|
|
record_duty: record_duty,
|
|
|
record_name: record_name,
|
|
|
record_phone: record_phone,
|
|
|
front_card: that.data.front_card,
|
|
|
reverse_card: that.data.reverse_card,
|
|
|
photo: that.data.photo
|
|
|
}
|
|
|
app.post(url, params, head).then((res) => {
|
|
|
wx.showToast({
|
|
|
title: '提交成功,等待审核',
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
wx.switchTab({
|
|
|
url: '/pages/my/my'
|
|
|
})
|
|
|
}, 1000)
|
|
|
}).catch((err) => {})
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: err,
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
getdatalist() {
|
|
|
let that = this;
|
|
|
let url = '/index/member_center/edit';
|
|
|
let params = {
|
|
|
'id': that.data.id
|
|
|
};
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, head).then((res) => {
|
|
|
let provincearr = that.data.provincearr;
|
|
|
let cityarr = that.data.cityarr;
|
|
|
let countryarr = that.data.countryarr;
|
|
|
let val = [0, 0, 0];
|
|
|
for (let i = 0; i < provincearr.length; i++) {
|
|
|
if (provincearr[i].province_name == res.province) {
|
|
|
val[0] = i;
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < cityarr.length; i++) {
|
|
|
if (cityarr[i].city_name == res.city) {
|
|
|
val[1] = i;
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < countryarr.length; i++) {
|
|
|
if (countryarr[i].country_name == res.county) {
|
|
|
val[2] = i;
|
|
|
}
|
|
|
}
|
|
|
that.setData({
|
|
|
valarr: val,
|
|
|
confirmvalarr: val,
|
|
|
addr: res.addr,
|
|
|
address: res.address,
|
|
|
birthday: res.birthday,
|
|
|
card_number: res.card_number,
|
|
|
city: res.city,
|
|
|
county: res.county,
|
|
|
duty: res.duty,
|
|
|
education: res.education,
|
|
|
email: res.email,
|
|
|
front_card: res.front_card,
|
|
|
move_phone: res.move_phone,
|
|
|
name: res.name,
|
|
|
nation: res.nation,
|
|
|
photo: res.photo,
|
|
|
politics: res.politics,
|
|
|
postcode: res.postcode,
|
|
|
province: res.province,
|
|
|
qq: res.qq,
|
|
|
record: res.record,
|
|
|
reverse_card: res.reverse_card,
|
|
|
school: res.school,
|
|
|
sex: res.sex,
|
|
|
unit: res.unit,
|
|
|
urgency_phone: res.urgency_phone,
|
|
|
type: res.type
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
is_submit: options.is_submit,
|
|
|
id: options.id,
|
|
|
page_type: options.type ? options.type : null
|
|
|
})
|
|
|
let now = new Date();
|
|
|
let time = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate();
|
|
|
this.setData({
|
|
|
enddata: time
|
|
|
})
|
|
|
that.getarea();
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|