Commit 623f7d68 by 李萌

no message

parent fa40d4cd
...@@ -6,7 +6,7 @@ Page({ ...@@ -6,7 +6,7 @@ Page({
data: { data: {
title: "录入信息", title: "录入信息",
array: ['请选择', '小学', '初中', '高中(包括中专和普通高中)', '大学(包括高职、大专及本科)', '研究生及以上', '文盲'], array: ['请选择', '小学', '初中', '高中(包括中专和普通高中)', '大学(包括高职、大专及本科)', '研究生及以上', '文盲'],
date: '1980-01-01', date: '1980-01-01',//生日
time: '请选择时间', time: '请选择时间',
items: [{ items: [{
name: '男', name: '男',
...@@ -22,7 +22,7 @@ Page({ ...@@ -22,7 +22,7 @@ Page({
usernumber: '', usernumber: '',
sheqvNumber: '', sheqvNumber: '',
workNumber: '', workNumber: '',
index: 0, index: 0,//文化程度
title1: "", // 答题 title1: "", // 答题
content: '', content: '',
otype: -2, otype: -2,
...@@ -441,7 +441,7 @@ Page({ ...@@ -441,7 +441,7 @@ Page({
data.openid = user.openid; data.openid = user.openid;
data.name = that.data.username; //姓名 data.name = that.data.username; //姓名
data.sex = that.data.sex; //性别 data.sex = that.data.sex; //性别
data.birthday = that.data.date; // 年龄 data.birthday = that.data.date; // 生日
data.usernumber = that.data.usernumber //手机号 data.usernumber = that.data.usernumber //手机号
data.jobnumber = that.data.jobnumber; //工号 data.jobnumber = that.data.jobnumber; //工号
data.sheqvNumber = that.data.sheqvNumber; data.sheqvNumber = that.data.sheqvNumber;
...@@ -609,6 +609,7 @@ Page({ ...@@ -609,6 +609,7 @@ Page({
// 获取授权 上传头像昵称 得到这个用户的信息 // 获取授权 上传头像昵称 得到这个用户的信息
// var url = Api.HOST + 'wechat.php?s=Home/getinfo_two'; // var url = Api.HOST + 'wechat.php?s=Home/getinfo_two';
var url = Api.HOST + 'wechat.php?s=Home/getinfo'; var url = Api.HOST + 'wechat.php?s=Home/getinfo';
// var url = Api.HOST + 'wechat.php?s=Home/getinfos';
var data = {}; var data = {};
var user = wx.getStorageSync('user'); var user = wx.getStorageSync('user');
var authorize = wx.getStorageSync('weiLb'); var authorize = wx.getStorageSync('weiLb');
...@@ -628,42 +629,81 @@ Page({ ...@@ -628,42 +629,81 @@ Page({
}); });
} }
} }
if (res.info) { if(res.info) {
if (res.info.cultural == '') { wx.setStorageSync('userInfo', res.info)
res.info.cultural = 0; }
if(wx.getStorageSync('allUserinfo')) {
console.log('用的缓存用户信息');
var storageUserinfo = wx.getStorageSync('allUserinfo');
if(storageUserinfo.edu == '') {
storageUserinfo.edu = 0;
} else { } else {
res.info.cultural = res.info.cultural || res.info.edu; storageUserinfo.edu = storageUserinfo.edu ? storageUserinfo.edu : 0;
} }
if (!res.info.birthday) { if (!storageUserinfo.birthday) {
res.info.birthday = "请选择"; storageUserinfo.birthday = "请选择";
} else { } else {
res.info.birthday = res.info.birthday; storageUserinfo.birthday = storageUserinfo.birthday;
}
var essentialData = {}
if (res.info.essential_information) {
essentialData = JSON.parse(res.info.essential_information);
} }
wx.setStorageSync('userInfo', res.info) that.setData({
that.setData({ username: storageUserinfo.name ? storageUserinfo.name : '',
username: res.info.name||'', usernumber: storageUserinfo.usernumber ? storageUserinfo.usernumber : '',
usernumber: essentialData.usernumber || '', ask_department: storageUserinfo.ask_department ? storageUserinfo.ask_department : '',
ask_department: essentialData.ask_department || '', select: storageUserinfo.select ? storageUserinfo.select : 0,
select: essentialData.select || 0, idCard:storageUserinfo.idcard ? storageUserinfo.idcard : '',
idCard:essentialData.idCard||'', index: storageUserinfo.edu,
index: res.info.cultural||0, date: storageUserinfo.birthday,
date: res.info.birthday, sex: storageUserinfo.sex,
sex: res.info.xingbie, home: storageUserinfo.house, // 家庭类型
home: res.info.house, // 家庭类型 fage: storageUserinfo.fage, // 父亲年龄
fage: res.info.fage, // 父亲年龄 foccupation: storageUserinfo.foccupation, //父亲职业
foccupation: res.info.foccupation, //父亲职业 fdegree: storageUserinfo.fdegree, //父亲文化程度
fdegree: res.info.fdegree, //父亲文化程度 mage: storageUserinfo.mage, // 母亲年龄
mage: res.info.mage, // 母亲年龄 moccupation: storageUserinfo.moccupation, //母亲职业
moccupation: res.info.moccupation, //母亲职业 mdegree: storageUserinfo.mdegree, //母亲文化程度
mdegree: res.info.mdegree, //母亲文化程度 jobnumber: storageUserinfo.jobnumber ? storageUserinfo.jobnumber : '', //工号
jobnumber: res.info.jobnumber ||'', //工号 yzm:that.data.is_yzm == 1 ? storageUserinfo.yzm : ''
yzm: that.data.is_yzm == 1 ? essentialData.yzm : ''
}); });
} else {
console.log('用的后端接口用户信息') ;
if (res.info) {
if (res.info.cultural == '') {
res.info.cultural = 0;
} else {
res.info.cultural = res.info.cultural || res.info.edu;
}
if (!res.info.birthday) {
res.info.birthday = "请选择";
} else {
res.info.birthday = res.info.birthday;
}
var essentialData = {}
if (res.info.essential_information) {
essentialData = JSON.parse(res.info.essential_information);
}
// wx.setStorageSync('userInfo', res.info)
that.setData({
username: res.info.name||'',
usernumber: essentialData.usernumber || '',
ask_department: essentialData.ask_department || '',
select: essentialData.select || 0,
idCard:essentialData.idCard||'',
index: res.info.cultural||0,//文化程度-接口返回的是cultural,前端用的是edu
date: res.info.birthday,
sex: res.info.xingbie,
home: res.info.house, // 家庭类型
fage: res.info.fage, // 父亲年龄
foccupation: res.info.foccupation, //父亲职业
fdegree: res.info.fdegree, //父亲文化程度
mage: res.info.mage, // 母亲年龄
moccupation: res.info.moccupation, //母亲职业
mdegree: res.info.mdegree, //母亲文化程度
jobnumber: res.info.jobnumber ||'', //工号
yzm: that.data.is_yzm == 1 ? essentialData.yzm : ''
});
}
} }
}); });
}, },
onUnload() {}, onUnload() {},
......
...@@ -167,46 +167,90 @@ Page({ ...@@ -167,46 +167,90 @@ Page({
data.characters_id = info.g_id; data.characters_id = info.g_id;
} }
Api.fetchPost(url, data, (err, res) => { Api.fetchPost(url, data, (err, res) => {
if (res.info) { if(wx.getStorageSync('allUserinfo')) {
if (res.info.cultural == '') { console.log('用的缓存数据');
res.info.cultural = 0; var storageUserinfo = wx.getStorageSync('allUserinfo');
} else { if(storageUserinfo.edu == '') {
// res.info.cultural = res.info.cultural; storageUserinfo.edu = 0;
res.info.cultural = res.info.cultural ? res.info.cultural : res.info.edu; } else {
} storageUserinfo.edu = storageUserinfo.edu ? storageUserinfo.edu : 0;
if (!res.info.birthday) { }
res.info.birthday = "请选择"; if (!storageUserinfo.birthday) {
} else { storageUserinfo.birthday = "请选择";
res.info.birthday = res.info.birthday; } else {
} storageUserinfo.birthday = storageUserinfo.birthday;
if (!that.data.hosiptiaFlag) { }
that.setData({ if (!that.data.hosiptiaFlag) {
username: res.info.name, that.setData({
index: res.info.cultural, username: storageUserinfo.name ? storageUserinfo.name :'',
idCard:res.info.idCard, index: storageUserinfo.edu,
date: res.info.birthday, idCard:storageUserinfo.idcard ? storageUserinfo.idcard : '',
sex: res.info.xingbie, date: storageUserinfo.birthday,
home: res.info.house, // 家庭类型 sex: storageUserinfo.sex,
fage: res.info.fage, // 父亲年龄 home: storageUserinfo.house, // 家庭类型
foccupation: res.info.foccupation, //父亲职业 fage: storageUserinfo.fage, // 父亲年龄
fdegree: res.info.fdegree, //父亲文化程度 foccupation: storageUserinfo.foccupation, //父亲职业
mage: res.info.mage, // 母亲年龄 fdegree: storageUserinfo.fdegree, //父亲文化程度
moccupation: res.info.moccupation, //母亲职业 mage: storageUserinfo.mage, // 母亲年龄
mdegree: res.info.mdegree, //母亲文化程度 moccupation: storageUserinfo.moccupation, //母亲职业
}); mdegree: storageUserinfo.mdegree, //母亲文化程度
});
} else {
that.setData({
username: storageUserinfo.name ? storageUserinfo.name :'',
index: storageUserinfo.edu,
date: storageUserinfo.birthday,
// sex: res.info.xingbie,
sex: storageUserinfo.sex,
select: storageUserinfo.hunfou,
username1: storageUserinfo.ask_department,
idCard:storageUserinfo.idcard ? storageUserinfo.idcard : '',
});
}
} else { } else {
that.setData({ console.log('用的后端接口数据');
username: res.info.name, if (res.info) {
index: res.info.cultural, if (res.info.cultural == '') {
date: res.info.birthday, res.info.cultural = 0;
// sex: res.info.xingbie, } else {
sex: res.info.xingbie ? res.info.xingbie : res.info.sex, // res.info.cultural = res.info.cultural;
select: res.info.hunfou, res.info.cultural = res.info.cultural ? res.info.cultural : res.info.edu;
username1: res.info.ask_department, }
idCard:res.info.idCard, if (!res.info.birthday) {
}); res.info.birthday = "请选择";
} else {
res.info.birthday = res.info.birthday;
}
if (!that.data.hosiptiaFlag) {
that.setData({
username: res.info.name,
index: res.info.cultural,
idCard:res.info.idCard,
date: res.info.birthday,
sex: res.info.xingbie,
home: res.info.house, // 家庭类型
fage: res.info.fage, // 父亲年龄
foccupation: res.info.foccupation, //父亲职业
fdegree: res.info.fdegree, //父亲文化程度
mage: res.info.mage, // 母亲年龄
moccupation: res.info.moccupation, //母亲职业
mdegree: res.info.mdegree, //母亲文化程度
});
} else {
that.setData({
username: res.info.name,
index: res.info.cultural,
date: res.info.birthday,
// sex: res.info.xingbie,
sex: res.info.xingbie ? res.info.xingbie : res.info.sex,
select: res.info.hunfou,
username1: res.info.ask_department,
idCard:res.info.idCard,
});
}
}
} }
}
}); });
}, },
inputChange: function(e) { inputChange: function(e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment