...
|
...
|
@@ -25,8 +25,13 @@ Page({ |
|
|
data: {
|
|
|
name: '',
|
|
|
sex: ['男','女'],
|
|
|
sex_index:0,
|
|
|
is_sex_change:false,
|
|
|
default_sex: {id: 1,name: '男'},
|
|
|
city: ['北京市', '天津市', '河北省'],
|
|
|
// city: ['北京市', '天津市', '河北省'],
|
|
|
region: ['北京市', '北京市', '东城区'],
|
|
|
is_city_change:false,
|
|
|
customItem: '全部',
|
|
|
default_birth: '2008-11-11',
|
|
|
default_city: '北京市',
|
|
|
years: years,
|
...
|
...
|
@@ -37,6 +42,13 @@ Page({ |
|
|
day: 2,
|
|
|
value: [9999, 1, 1],
|
|
|
},
|
|
|
bindRegionChange(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
region: e.detail.value,
|
|
|
is_city_change: true,
|
|
|
})
|
|
|
},
|
|
|
inputName(e) {
|
|
|
this.setData({
|
|
|
name: e.detail.value
|
...
|
...
|
@@ -82,9 +94,9 @@ Page({ |
|
|
let params = {
|
|
|
id: self.data.current_student.id,
|
|
|
name: self.data.name || self.data.current_student.name,
|
|
|
sex: (self.data.sex[self.data.sex_index] === '男' ? 1 : 2) || (+self.data.current_student.sex === 1 ? 1 : 2),
|
|
|
sex: ((self.data.is_sex_change)&&self.data.sex[self.data.sex_index] == '男' ? 1 : (!self.data.is_sex_change&&+self.data.current_student.sex == 1 ? 1 : 2)),
|
|
|
birthday: self.data.birth_date || self.data.current_student.birthday,
|
|
|
city: self.data.city[self.data.city_index] || self.data.current_student.city,
|
|
|
city: self.data.is_city_change?self.data.region[0] + ',' + self.data.region[1] + ',' + self.data.region[2]:self.data.current_student.city,
|
|
|
};
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
// console.log('保存', res);
|
...
|
...
|
@@ -111,7 +123,7 @@ Page({ |
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
// console.log('options', options);
|
|
|
console.log('options', options);
|
|
|
this.setData({
|
|
|
is_back: options.is_back?options.is_back:'',
|
|
|
current_student: options.current_student?JSON.parse(options.current_student):'',
|
...
|
...
|
@@ -135,7 +147,7 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
this.setData({is_sex_change:false})
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|