Commit 623f7d68 by 李萌

no message

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