...
|
...
|
@@ -6,11 +6,18 @@ Page({ |
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
//
|
|
|
ifempower:true,//是否授权
|
|
|
showapply:false,
|
|
|
provincearr:[],
|
|
|
cityarr:[],
|
|
|
countryarr:[],
|
|
|
confirmvalarr:[0,0,0],
|
|
|
valarr:[0,0,0],
|
|
|
photo: '',
|
|
|
name: '',
|
|
|
enddata:'',
|
|
|
arraysex: ['男', '女'],
|
|
|
region:['天津市','天津市','西青区'],
|
|
|
sex: '',
|
|
|
birthday: '', //生日
|
|
|
nation: '', //民族
|
...
|
...
|
@@ -19,7 +26,7 @@ Page({ |
|
|
"土族", "达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族",
|
|
|
"俄罗斯族", "鄂温克族", "德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"
|
|
|
],
|
|
|
|
|
|
|
|
|
politics: '', //政治面貌
|
|
|
politicsarr: ['共青团员', '中共预备党员', '中共党员', '群众', '无党派人士', '其他'], //
|
|
|
education: '', //学历
|
...
|
...
|
@@ -30,7 +37,6 @@ Page({ |
|
|
postcode: '', //邮编
|
|
|
school: '', //
|
|
|
card_number: '', //身份证号码
|
|
|
fixed_phone: '', //固定电话
|
|
|
move_phone: '', //
|
|
|
email: '', //
|
|
|
urgency_phone: '', //
|
...
|
...
|
@@ -43,32 +49,33 @@ Page({ |
|
|
typearr: ['医院志愿者', '社会志愿者', '办事处志愿者'],
|
|
|
apply_nav: 0, //0为履历1,1为履历2,2为履历3,
|
|
|
record: [{
|
|
|
start_time: '',
|
|
|
end_time: '',
|
|
|
unit: '',
|
|
|
duty: '',
|
|
|
name: '',
|
|
|
phone: ''
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
start_time: '',
|
|
|
end_time: '',
|
|
|
unit: '',
|
|
|
duty: '',
|
|
|
name: '',
|
|
|
phone: ''
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
},
|
|
|
{
|
|
|
start_time: '',
|
|
|
end_time: '',
|
|
|
unit: '',
|
|
|
duty: '',
|
|
|
name: '',
|
|
|
phone: ''
|
|
|
record_start_time: '',
|
|
|
record_end_time: '',
|
|
|
record_unit: '',
|
|
|
record_duty: '',
|
|
|
record_name: '',
|
|
|
record_phone: ''
|
|
|
}
|
|
|
],
|
|
|
front_card: '', //身份证正面照
|
|
|
reverse_card: '' //身份证反面照
|
|
|
reverse_card: '', //身份证反面照
|
|
|
id:'',//用户id,
|
|
|
},
|
|
|
setname(e) {
|
|
|
this.setData({
|
...
|
...
|
@@ -125,11 +132,7 @@ Page({ |
|
|
sex: parseInt(e.detail.value) + 1
|
|
|
})
|
|
|
},
|
|
|
setfixed_phone(e) {
|
|
|
this.setData({
|
|
|
fixed_phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
setmove_phone(e) {
|
|
|
this.setData({
|
|
|
move_phone: e.detail.value
|
...
|
...
|
@@ -167,6 +170,205 @@ Page({ |
|
|
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) => {
|
|
|
console.log(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) => {
|
|
|
console.log(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
|
|
|
})
|
|
|
|
|
|
}else if (that.data.is_submit=='1'){
|
|
|
that.getdatalist();
|
|
|
}
|
|
|
|
|
|
}).catch((err)=>{
|
|
|
console.log(err)
|
|
|
})
|
|
|
},
|
|
|
//切换省份获取市和区/县
|
|
|
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)=>{
|
|
|
console.log('切换省份获取市和区/县',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)=>{
|
|
|
console.log(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) => {
|
|
|
console.log('切换市获取区/县', 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) => {
|
|
|
console.log(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;
|
|
|
console.log(e);
|
...
|
...
|
@@ -178,24 +380,11 @@ Page({ |
|
|
address: e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
|
|
|
})
|
|
|
},
|
|
|
chooseaddress() {
|
|
|
let that = this;
|
|
|
// wx.chooseAddress({
|
|
|
// success: function(res) {
|
|
|
// that.setData({
|
|
|
// province: res.provinceName,
|
|
|
// city: res.cityName,
|
|
|
// county: res.countyName,
|
|
|
// address: res.provinceName + res.cityName + res.countyName + res.detailInfo
|
|
|
// })
|
|
|
// }
|
|
|
// })
|
|
|
},
|
|
|
bindstartChange(e) {
|
|
|
let that = this;
|
|
|
let apply_nav = parseInt(that.data.apply_nav);
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].start_time = e.detail.value;
|
|
|
record[apply_nav].record_start_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
...
|
...
|
@@ -204,7 +393,7 @@ Page({ |
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].end_time = e.detail.value;
|
|
|
record[apply_nav].record_end_time = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
...
|
...
|
@@ -213,7 +402,7 @@ Page({ |
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].unit = e.detail.value;
|
|
|
record[apply_nav].record_unit = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
...
|
...
|
@@ -222,7 +411,7 @@ Page({ |
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].name = e.detail.value;
|
|
|
record[apply_nav].record_name = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
...
|
...
|
@@ -231,7 +420,7 @@ Page({ |
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].duty = e.detail.value;
|
|
|
record[apply_nav].record_duty = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
...
|
...
|
@@ -240,14 +429,19 @@ Page({ |
|
|
let that = this;
|
|
|
let apply_nav = that.data.apply_nav;
|
|
|
let record = that.data.record;
|
|
|
record[apply_nav].phone = e.detail.value;
|
|
|
record[apply_nav].record_phone = e.detail.value;
|
|
|
that.setData({
|
|
|
record: record
|
|
|
})
|
|
|
},
|
|
|
//上传头像1为头像,2为省份证正面,3为省份证反面
|
|
|
uploadImages(e) {
|
|
|
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,
|
...
|
...
|
@@ -258,7 +452,7 @@ Page({ |
|
|
'XX-Token': wx.getStorageSync('token'),
|
|
|
'XX-Device-Type': ''
|
|
|
}
|
|
|
let url = 'http://volunteer.w.bronet.cn/api/user/upload/one';
|
|
|
let url = 'https://volunteer.cnpu.org/api/user/upload/one';
|
|
|
wx.uploadFile({
|
|
|
url: url, //仅为示例,非真实的接口地址
|
|
|
filePath: tempFilePaths[0],
|
...
|
...
|
@@ -300,7 +494,6 @@ Page({ |
|
|
submit() {
|
|
|
let that = this;
|
|
|
let err='';
|
|
|
|
|
|
//匹配中国邮政编码
|
|
|
// var AuglyTest_PostalCode = /^[0-9]\\d{5}$/;
|
|
|
//匹配身份证
|
...
|
...
|
@@ -341,10 +534,6 @@ Page({ |
|
|
err = '请输入您的身份证号!';
|
|
|
} else if (!AuglyTest_ID.test(that.data.card_number)){
|
|
|
err = '请输入正确的身份证号!';
|
|
|
}else if (that.data.fixed_phone==''){
|
|
|
err = '请输入您的固定电话!';
|
|
|
} else if (!AuglyTest_tel.test(that.data.fixed_phone)){
|
|
|
err = '请输入正确的固定电话!';
|
|
|
}else if (that.data.move_phone==''){
|
|
|
err = '请输入您的移动电话!';
|
|
|
} else if (!AuglyTest_phone.test(that.data.move_phone)){
|
...
|
...
|
@@ -378,12 +567,12 @@ Page({ |
|
|
let record_name = [];
|
|
|
let record_phone = [];
|
|
|
for (let obj of record) {
|
|
|
record_start_time.push(obj.start_time);
|
|
|
record_end_time.push(obj.end_time);
|
|
|
record_unit.push(obj.unit);
|
|
|
record_duty.push(obj.duty);
|
|
|
record_name.push(obj.name);
|
|
|
record_phone.push(obj.phone);
|
|
|
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 = {
|
...
|
...
|
@@ -401,7 +590,7 @@ Page({ |
|
|
addr: that.data.addr,
|
|
|
school: that.data.school,
|
|
|
card_number: that.data.card_number,
|
|
|
fixed_phone: that.data.fixed_phone,
|
|
|
|
|
|
move_phone: that.data.move_phone,
|
|
|
postcode: that.data.postcode,
|
|
|
email: that.data.email,
|
...
|
...
|
@@ -428,6 +617,7 @@ Page({ |
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
|
|
|
setTimeout(function(){
|
|
|
wx.switchTab({
|
|
|
url: '/pages/my/my'
|
...
|
...
|
@@ -444,15 +634,83 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
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)=>{
|
|
|
console.log(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();
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -467,12 +725,15 @@ Page({ |
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
@@ -480,7 +741,7 @@ Page({ |
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|