Commit 9218b7e1 by 李萌

Merge branch 'limeng-量表提交流程优化' into 'master'

答题提交流程优化

See merge request !1
parents 70e885fd 309d76f5
...@@ -293,6 +293,12 @@ Page({ ...@@ -293,6 +293,12 @@ Page({
user_answer: answer.score, user_answer: answer.score,
answer: answer.answer, answer: answer.answer,
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -317,41 +323,7 @@ Page({ ...@@ -317,41 +323,7 @@ Page({
flag: true flag: true
}) })
return; return;
}
var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = liangbiaoCon.res[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
data1.unitid = unitid;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
// console.log(lb_descript.desc.measure_id)
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
Api.fetchPost(urls, data1, (err, res) => {
if (err) {
that.setData({
flag: true
})
}
that.setData({ that.setData({
flag: true flag: true
}) })
...@@ -363,10 +335,7 @@ Page({ ...@@ -363,10 +335,7 @@ Page({
wx.removeStorageSync('timeArr') wx.removeStorageSync('timeArr')
wx.removeStorageSync('lbCon') wx.removeStorageSync('lbCon')
wx.removeStorageSync('liangbiaoCon') wx.removeStorageSync('liangbiaoCon')
// wx.removeStorageSync('lb_descript') if (res.data.charactersStatus == 1) {
// console.log(res)
if (res == 1) {
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { if (lb_tz == '1') {
wx.reLaunch({ wx.reLaunch({
...@@ -378,7 +347,7 @@ Page({ ...@@ -378,7 +347,7 @@ Page({
url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`, url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
}) })
} }
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.switchTab({ wx.switchTab({
...@@ -391,7 +360,78 @@ Page({ ...@@ -391,7 +360,78 @@ Page({
} }
}) })
} }
}) }
// var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
// var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = liangbiaoCon.res[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.res_id = res;
// data1.user_stime = time;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// data1.unitid = unitid;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// // console.log(lb_descript.desc.measure_id)
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// Api.fetchPost(urls, data1, (err, res) => {
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// wx.hideLoading()
// wx.removeStorageSync('answerData')
// wx.removeStorageSync('chaTime')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime')
// wx.removeStorageSync('timeArr')
// wx.removeStorageSync('lbCon')
// wx.removeStorageSync('liangbiaoCon')
// if (res == 1) {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1'
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// })
// }
// } else if (res == 0) {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.switchTab({
// url: '/pages/record/record?lbtype=-1',
// success: function () {
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }
// })
}) })
} }
}, },
......
...@@ -72,7 +72,7 @@ Page({ ...@@ -72,7 +72,7 @@ Page({
var num = e.currentTarget.dataset.num; var num = e.currentTarget.dataset.num;
var answer = e.currentTarget.dataset.answer; var answer = e.currentTarget.dataset.answer;
var score = e.currentTarget.dataset.score; var score = e.currentTarget.dataset.score;
console.log(num, 'idnidnidn') // console.log(num, 'idnidnidn')
this.setData({ this.setData({
num: num num: num
}) })
...@@ -104,13 +104,13 @@ Page({ ...@@ -104,13 +104,13 @@ Page({
}, },
next: function (e) { next: function (e) {
console.log(e) // console.log(e)
let that = this; let that = this;
var lb_rw = wx.getStorageSync('lb_rw'); var lb_rw = wx.getStorageSync('lb_rw');
var answerData_rw = wx.getStorageSync('answerData_rw'); var answerData_rw = wx.getStorageSync('answerData_rw');
if (lb_rw.length <= answerData_rw.score.length) { if (lb_rw.length <= answerData_rw.score.length) {
console.log(this.data.num < lb_rw.length, '1') // console.log(this.data.num < lb_rw.length, '1')
if (this.data.num < lb_rw.length) { if (this.data.num < lb_rw.length) {
var len = lb_rw[e].answer.length == 6 ? 1 : 2; var len = lb_rw[e].answer.length == 6 ? 1 : 2;
this.setData({ this.setData({
...@@ -162,19 +162,12 @@ Page({ ...@@ -162,19 +162,12 @@ Page({
} }
var thisTime = Date.parse(new Date()); var thisTime = Date.parse(new Date());
var cha = thisTime - startTime2 + chaTime2; var cha = thisTime - startTime2 + chaTime2;
console.log(cha, 'cha') // console.log(cha, 'cha')
var time = Api.reversalTime(cha) var time = Api.reversalTime(cha)
console.log(time, 'time') // console.log(time, 'time')
var liangbiaoCon = wx.getStorageSync('liangbiaoCon'); var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var answer = wx.getStorageSync('answerData_rw'); var answer = wx.getStorageSync('answerData_rw');
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
// if (liangbiaoCon.talp == '1') {
// var data = { user_stime: time, user_answer: answer.score, answer: answer.answer, user_number: user.openid, measure_id: lb_descript.id[0], };
// var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
// } else {
// var data = { user_stime: time, user_answer: answer.score, answer: answer.answer, user_number: user.openid, measure_id: lb_descript.id[0], };
// var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
// }
var user = wx.getStorageSync('user'); var user = wx.getStorageSync('user');
var ndata = { var ndata = {
measure_id: lb_descript.id[0], measure_id: lb_descript.id[0],
...@@ -184,7 +177,13 @@ Page({ ...@@ -184,7 +177,13 @@ Page({
user_answer: answer.score, user_answer: answer.score,
answer: answer.answer, answer: answer.answer,
}; };
var url = Api.HOST_huaiji + 'amedical.php/gauge/pcAddData'; var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
ndata.submit_type = 2; ndata.submit_type = 2;
...@@ -208,40 +207,7 @@ Page({ ...@@ -208,40 +207,7 @@ Page({
flag: true flag: true
}) })
return; return;
}
var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = liangbiaoCon.res[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
data1.unitid = unitid;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
Api.fetchPost(urls, data1, (err, res) => {
if (err) {
that.setData({
flag: true
})
}
that.setData({ that.setData({
flag: true flag: true
}) })
...@@ -252,10 +218,7 @@ Page({ ...@@ -252,10 +218,7 @@ Page({
wx.removeStorageSync('timeArr2') wx.removeStorageSync('timeArr2')
wx.removeStorageSync('lbCon') wx.removeStorageSync('lbCon')
wx.removeStorageSync('liangbiaoCon') wx.removeStorageSync('liangbiaoCon')
if (res.data.charactersStatus == 1) {
console.log(res)
if (res == 1) {
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { if (lb_tz == '1') {
wx.reLaunch({ wx.reLaunch({
...@@ -273,7 +236,7 @@ Page({ ...@@ -273,7 +236,7 @@ Page({
} }
}) })
} }
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.reLaunch({ wx.reLaunch({
...@@ -287,7 +250,86 @@ Page({ ...@@ -287,7 +250,86 @@ Page({
} }
}) })
} }
}) }
// var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
// var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = liangbiaoCon.res[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.res_id = res;
// data1.user_stime = time;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// data1.unitid = unitid;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// Api.fetchPost(urls, data1, (err, res) => {
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// wx.removeStorageSync('answerData_rw')
// wx.removeStorageSync('chaTime2')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime2')
// wx.removeStorageSync('timeArr2')
// wx.removeStorageSync('lbCon')
// wx.removeStorageSync('liangbiaoCon')
// console.log(res)
// if (res == 1) {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({ flag: true })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({ flag: true })
// }
// })
// }
// } else if (res == 0) {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// url: '/pages/record/record?lbtype=-1',
// success: function () {
// that.setData({ flag: true })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }
// })
}) })
} }
}, },
......
...@@ -1072,12 +1072,9 @@ Page({ ...@@ -1072,12 +1072,9 @@ Page({
var time = Api.reversalTime(cha) var time = Api.reversalTime(cha)
var user = wx.getStorageSync('user'); var user = wx.getStorageSync('user');
var answer = wx.getStorageSync('answer_swiper'); var answer = wx.getStorageSync('answer_swiper');
console.log(answer.score.length, 'answer.score.length;')
for (let i = 0; i < answer.score.length; i++) { for (let i = 0; i < answer.score.length; i++) {
answer.score[i] = answer.score[i].replace(/[\r\n]/g, ''); answer.score[i] = answer.score[i].replace(/[\r\n]/g, '');
} }
console.log('answer.score.lengthwwwww;')
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
var swiper_arr = wx.getStorageSync('swiper_arr'); var swiper_arr = wx.getStorageSync('swiper_arr');
var lb_tp = wx.getStorageSync('lb_tz') var lb_tp = wx.getStorageSync('lb_tz')
...@@ -1085,26 +1082,6 @@ Page({ ...@@ -1085,26 +1082,6 @@ Page({
answer.score.unshift(wx.getStorageSync('canvas')); answer.score.unshift(wx.getStorageSync('canvas'));
answer.answer.unshift(0); answer.answer.unshift(0);
} }
// if (lb_tp == '1') {
// var data = {
// user_stime: time,
// user_answer: answer.score,
// answer: answer.answer,
// user_number: lb_descript.desc.z_openid,
// measure_id: lb_descript.id[0],
// };
// var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
// } else {
// var data = {
// user_stime: time,
// user_answer: answer.score,
// answer: answer.answer,
// user_number: user.openid,
// measure_id: lb_descript.id[0],
// g_id: wx.getStorageSync('g_id')
// };
// var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
// }
var stoUser = wx.getStorageSync('user'); var stoUser = wx.getStorageSync('user');
var ndata = { var ndata = {
measure_id: lb_descript.id[0], measure_id: lb_descript.id[0],
...@@ -1114,6 +1091,13 @@ Page({ ...@@ -1114,6 +1091,13 @@ Page({
user_answer: answer.score, user_answer: answer.score,
answer: answer.answer, answer: answer.answer,
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -1134,63 +1118,22 @@ Page({ ...@@ -1134,63 +1118,22 @@ Page({
let newdata = Object.assign({...ndata,...formdata}); let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata); newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => { Api.fetchPostN(url, newdata, (err, res) => {
// console.log(res, 'resllo')
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res) == 0) { if (Number(res) == 0) {
Api.alert("提交失败,请重新提交。") Api.alert("提交失败,请重新提交。")
return; return;
} } else if (Number(res.code) == -1) {
if (Number(res.code) == -1) {
wx.hideLoading(); wx.hideLoading();
Api.alert(res.msg) Api.alert(res.msg)
that.setData({ that.setData({
flag: true flag: true
}) })
return; return;
}
var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
var tp_characters_id = wx.getStorageSync("tplbDetail");
data1.unitid = unitid;
data1.characters_id = tp_characters_id.g_id;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
// clearTimeout(timer)
Api.fetchPost(urls, data1, (err, res) => {
// console.log('5555555555555', res)
if (err) {
that.setData({
flag: true
})
}
that.setData({ that.setData({
flag: true flag: true
}) })
if (res == 1 || res == 0) { if (res.data.charactersStatus == 1 || res.data.charactersStatus == 0) {
wx.removeStorageSync('answer_swiper') wx.removeStorageSync('answer_swiper')
wx.removeStorageSync('swiper_arr') wx.removeStorageSync('swiper_arr')
wx.removeStorageSync('chaTime') wx.removeStorageSync('chaTime')
...@@ -1199,7 +1142,6 @@ Page({ ...@@ -1199,7 +1142,6 @@ Page({
wx.removeStorageSync('timeArr') wx.removeStorageSync('timeArr')
wx.removeStorageSync('lb_swiper_con') wx.removeStorageSync('lb_swiper_con')
wx.hideLoading(); wx.hideLoading();
} else { } else {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -1208,11 +1150,7 @@ Page({ ...@@ -1208,11 +1150,7 @@ Page({
duration: 2000 duration: 2000
}) })
} }
if (res.data.charactersStatus == 1) {
// console.log('res', res)
if (res == 1) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -1242,8 +1180,7 @@ Page({ ...@@ -1242,8 +1180,7 @@ Page({
}) })
} }
}, 2000) }, 2000)
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -1253,7 +1190,6 @@ Page({ ...@@ -1253,7 +1190,6 @@ Page({
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.reLaunch({ wx.reLaunch({
// url: '/pages/end/end?lbtype=-1',
url: '/pages/record/record', url: '/pages/record/record',
success: function () { success: function () {
that.setData({ that.setData({
...@@ -1266,10 +1202,128 @@ Page({ ...@@ -1266,10 +1202,128 @@ Page({
} }
}) })
}, 2000) }, 2000)
} else {
} }
}) }
// var swiper_arr = wx.getStorageSync('swiper_arr');
// var data1 = {};
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = swiper_arr[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// var authorize = wx.getStorageSync('weiLb');
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.user_stime = time;
// data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// var tp_characters_id = wx.getStorageSync("tplbDetail");
// data1.unitid = unitid;
// data1.characters_id = tp_characters_id.g_id;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// clearTimeout(timer)
// Api.fetchPost(urls, data1, (err, res) => {
// // console.log('5555555555555', res)
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// if (res == 1 || res == 0) {
// wx.removeStorageSync('answer_swiper')
// wx.removeStorageSync('swiper_arr')
// wx.removeStorageSync('chaTime')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime')
// wx.removeStorageSync('timeArr')
// wx.removeStorageSync('lb_swiper_con')
// wx.hideLoading();
// } else {
// wx.hideLoading()
// wx.showToast({
// title: '请稍后再试',
// icon: 'none',
// duration: 2000
// })
// }
// // console.log('res', res)
// if (res == 1) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// wx.removeStorageSync('canvas')
// setTimeout(function () {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// }
// }, 2000)
// } else if (res == 0) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// // url: '/pages/end/end?lbtype=-1',
// url: '/pages/record/record',
// success: function () {
// that.setData({
// flag: true
// })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }, 2000)
// } else {
// }
// })
}) })
} }
}, },
......
...@@ -528,6 +528,12 @@ Page({ ...@@ -528,6 +528,12 @@ Page({
user_answer: answer.score, user_answer: answer.score,
answer: answer.answer, answer: answer.answer,
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -552,58 +558,18 @@ Page({ ...@@ -552,58 +558,18 @@ Page({
if (Number(res) == 0) { if (Number(res) == 0) {
Api.alert("提交失败,请重新提交。") Api.alert("提交失败,请重新提交。")
return; return;
} } else if (Number(res.code) == -1) {
if (Number(res.code) == -1) {
wx.hideLoading(); wx.hideLoading();
Api.alert(res.msg) Api.alert(res.msg)
that.setData({ that.setData({
flag: true flag: true
}) })
return; return;
}
var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
var tp_characters_id = wx.getStorageSync("tplbDetail");
data1.unitid = unitid;
data1.characters_id = tp_characters_id.g_id;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
// clearTimeout(timer)
Api.fetchPost(urls, data1, (err, res) => {
if (err) {
that.setData({ that.setData({
flag: true flag: true
}) })
} if (res.data.charactersStatus == 1 || res.data.charactersStatus == 0) {
that.setData({
flag: true
})
if (res == 1 || res == 0) {
wx.removeStorageSync('answer_swiper') wx.removeStorageSync('answer_swiper')
wx.removeStorageSync('swiper_arr') wx.removeStorageSync('swiper_arr')
wx.removeStorageSync('chaTime') wx.removeStorageSync('chaTime')
...@@ -612,7 +578,6 @@ Page({ ...@@ -612,7 +578,6 @@ Page({
wx.removeStorageSync('timeArr') wx.removeStorageSync('timeArr')
wx.removeStorageSync('lb_swiper_con') wx.removeStorageSync('lb_swiper_con')
wx.hideLoading(); wx.hideLoading();
} else { } else {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -621,8 +586,7 @@ Page({ ...@@ -621,8 +586,7 @@ Page({
duration: 2000 duration: 2000
}) })
} }
if (res == 1) { if (res.data.charactersStatus == 1) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -652,8 +616,7 @@ Page({ ...@@ -652,8 +616,7 @@ Page({
}) })
} }
}, 2000) }, 2000)
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -663,7 +626,6 @@ Page({ ...@@ -663,7 +626,6 @@ Page({
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.reLaunch({ wx.reLaunch({
// url: '/pages/end/end?lbtype=-1',
url: '/pages/record/record', url: '/pages/record/record',
success: function () { success: function () {
that.setData({ that.setData({
...@@ -677,7 +639,120 @@ Page({ ...@@ -677,7 +639,120 @@ Page({
}) })
}, 2000) }, 2000)
} }
}) }
// var swiper_arr = wx.getStorageSync('swiper_arr');
// var data1 = {};
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = swiper_arr[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// var authorize = wx.getStorageSync('weiLb');
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.user_stime = time;
// data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// var tp_characters_id = wx.getStorageSync("tplbDetail");
// data1.unitid = unitid;
// data1.characters_id = tp_characters_id.g_id;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// Api.fetchPost(urls, data1, (err, res) => {
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// if (res == 1 || res == 0) {
// wx.removeStorageSync('answer_swiper')
// wx.removeStorageSync('swiper_arr')
// wx.removeStorageSync('chaTime')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime')
// wx.removeStorageSync('timeArr')
// wx.removeStorageSync('lb_swiper_con')
// wx.hideLoading();
// } else {
// wx.hideLoading()
// wx.showToast({
// title: '请稍后再试',
// icon: 'none',
// duration: 2000
// })
// }
// if (res == 1) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// wx.removeStorageSync('canvas')
// setTimeout(function () {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// }
// }, 2000)
// } else if (res == 0) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// // url: '/pages/end/end?lbtype=-1',
// url: '/pages/record/record',
// success: function () {
// that.setData({
// flag: true
// })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }, 2000)
// }
// })
}) })
} }
}, },
......
...@@ -651,6 +651,12 @@ var pageData = { ...@@ -651,6 +651,12 @@ var pageData = {
user_answer: JSON.stringify(that.data.userInfo), user_answer: JSON.stringify(that.data.userInfo),
answer: JSON.stringify(that.data.userInfo), answer: JSON.stringify(that.data.userInfo),
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -671,62 +677,22 @@ var pageData = { ...@@ -671,62 +677,22 @@ var pageData = {
let newdata = Object.assign({...ndata,...formdata}); let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata); newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => { Api.fetchPostN(url, newdata, (err, res) => {
// console.log(res, 'resllo')
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res) == 0) { if (Number(res) == 0) {
Api.alert("提交失败,请重新提交。") Api.alert("提交失败,请重新提交。")
return; return;
} } else if (Number(res.code) == -1) {
if (Number(res.code) == -1) {
wx.hideLoading(); wx.hideLoading();
Api.alert(res.msg) Api.alert(res.msg)
that.setData({ that.setData({
flag: true flag: true
}) })
return; return;
}
var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
var tp_characters_id = wx.getStorageSync("tplbDetail");
data1.unitid = unitid;
data1.characters_id = tp_characters_id.g_id;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
// clearTimeout(timer)
Api.fetchPost(urls, data1, (err, res) => {
if (err) {
that.setData({
flag: true
})
}
that.setData({ that.setData({
flag: true flag: true
}) })
if (res == 1 || res == 0) { if (res.data.charactersStatus == 1 || res.data.charactersStatus == 0) {
wx.removeStorageSync('answer_swiper') wx.removeStorageSync('answer_swiper')
wx.removeStorageSync('swiper_arr') wx.removeStorageSync('swiper_arr')
wx.removeStorageSync('chaTime') wx.removeStorageSync('chaTime')
...@@ -743,9 +709,7 @@ var pageData = { ...@@ -743,9 +709,7 @@ var pageData = {
duration: 2000 duration: 2000
}) })
} }
console.log('res', res) if (res.data.charactersStatus == 1) {
if (res == 1) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -775,8 +739,7 @@ var pageData = { ...@@ -775,8 +739,7 @@ var pageData = {
}) })
} }
}, 2000) }, 2000)
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -786,7 +749,6 @@ var pageData = { ...@@ -786,7 +749,6 @@ var pageData = {
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.reLaunch({ wx.reLaunch({
// url: '/pages/end/end?lbtype=-1',
url: '/pages/record/record', url: '/pages/record/record',
success: function () { success: function () {
that.setData({ that.setData({
...@@ -801,7 +763,124 @@ var pageData = { ...@@ -801,7 +763,124 @@ var pageData = {
}, 2000) }, 2000)
} else { } else {
} }
}) }
// var swiper_arr = wx.getStorageSync('swiper_arr');
// var data1 = {};
// // var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = swiper_arr[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// var authorize = wx.getStorageSync('weiLb');
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// // data1.res_id = res;
// data1.user_stime = time;
// data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// var tp_characters_id = wx.getStorageSync("tplbDetail");
// data1.unitid = unitid;
// data1.characters_id = tp_characters_id.g_id;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// clearTimeout(timer)
// Api.fetchPost(urls, data1, (err, res) => {
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// if (res == 1 || res == 0) {
// wx.removeStorageSync('answer_swiper')
// wx.removeStorageSync('swiper_arr')
// wx.removeStorageSync('chaTime')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime')
// wx.removeStorageSync('timeArr')
// wx.removeStorageSync('lb_swiper_con')
// wx.hideLoading();
// } else {
// wx.hideLoading()
// wx.showToast({
// title: '请稍后再试',
// icon: 'none',
// duration: 2000
// })
// }
// console.log('res', res)
// if (res == 1) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// wx.removeStorageSync('canvas')
// setTimeout(function () {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// }
// }, 2000)
// } else if (res == 0) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// // url: '/pages/end/end?lbtype=-1',
// url: '/pages/record/record',
// success: function () {
// that.setData({
// flag: true
// })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }, 2000)
// } else {
// }
// })
}) })
} }
}, },
...@@ -991,6 +1070,12 @@ var pageData = { ...@@ -991,6 +1070,12 @@ var pageData = {
user_answer: JSON.stringify(that.data.userInfo1), user_answer: JSON.stringify(that.data.userInfo1),
answer: JSON.stringify(that.data.userInfo1), answer: JSON.stringify(that.data.userInfo1),
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -1011,63 +1096,22 @@ var pageData = { ...@@ -1011,63 +1096,22 @@ var pageData = {
let newdata = Object.assign({...ndata,...formdata}); let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata); newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => { Api.fetchPostN(url, newdata, (err, res) => {
// console.log(res, 'resllo')
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res) == 0) { if (Number(res) == 0) {
Api.alert("提交失败,请重新提交。") Api.alert("提交失败,请重新提交。")
return; return;
} } else if (Number(res.code) == -1) {
if (Number(res.code) == -1) {
wx.hideLoading(); wx.hideLoading();
Api.alert(res.msg) Api.alert(res.msg)
that.setData({ that.setData({
flag: true flag: true
}) })
return; return;
}
var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
var tp_characters_id = wx.getStorageSync("tplbDetail");
data1.unitid = unitid;
data1.characters_id = tp_characters_id.g_id;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
// clearTimeout(timer)
Api.fetchPost(urls, data1, (err, res) => {
// console.log('5555555555555', res)
if (err) {
that.setData({
flag: true
})
}
that.setData({ that.setData({
flag: true flag: true
}) })
if (res == 1 || res == 0) { if (res.data.charactersStatus == 1 || res.data.charactersStatus == 0) {
wx.removeStorageSync('answer_swiper') wx.removeStorageSync('answer_swiper')
wx.removeStorageSync('swiper_arr') wx.removeStorageSync('swiper_arr')
wx.removeStorageSync('chaTime') wx.removeStorageSync('chaTime')
...@@ -1076,7 +1120,6 @@ var pageData = { ...@@ -1076,7 +1120,6 @@ var pageData = {
wx.removeStorageSync('timeArr') wx.removeStorageSync('timeArr')
wx.removeStorageSync('lb_swiper_con') wx.removeStorageSync('lb_swiper_con')
wx.hideLoading(); wx.hideLoading();
} else { } else {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -1085,9 +1128,7 @@ var pageData = { ...@@ -1085,9 +1128,7 @@ var pageData = {
duration: 2000 duration: 2000
}) })
} }
console.log('res', res) if (res.data.charactersStatus == 1) {
if (res == 1) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -1117,8 +1158,7 @@ var pageData = { ...@@ -1117,8 +1158,7 @@ var pageData = {
}) })
} }
}, 2000) }, 2000)
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -1128,7 +1168,6 @@ var pageData = { ...@@ -1128,7 +1168,6 @@ var pageData = {
wx.removeStorageSync('tplbDetail') wx.removeStorageSync('tplbDetail')
wx.removeStorageSync('weiLb') wx.removeStorageSync('weiLb')
wx.reLaunch({ wx.reLaunch({
// url: '/pages/end/end?lbtype=-1',
url: '/pages/record/record', url: '/pages/record/record',
success: function () { success: function () {
that.setData({ that.setData({
...@@ -1144,7 +1183,123 @@ var pageData = { ...@@ -1144,7 +1183,123 @@ var pageData = {
} else { } else {
} }
}) }
// var swiper_arr = wx.getStorageSync('swiper_arr');
// var data1 = {};
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
// var ti_title = swiper_arr[0].measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// var authorize = wx.getStorageSync('weiLb');
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.user_stime = time;
// data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// var tp_characters_id = wx.getStorageSync("tplbDetail");
// data1.unitid = unitid;
// data1.characters_id = tp_characters_id.g_id;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// Api.fetchPost(urls, data1, (err, res) => {
// if (err) {
// that.setData({
// flag: true
// })
// }
// that.setData({
// flag: true
// })
// if (res == 1 || res == 0) {
// wx.removeStorageSync('answer_swiper')
// wx.removeStorageSync('swiper_arr')
// wx.removeStorageSync('chaTime')
// wx.removeStorageSync('endTime')
// wx.removeStorageSync('startTime')
// wx.removeStorageSync('timeArr')
// wx.removeStorageSync('lb_swiper_con')
// wx.hideLoading();
// } else {
// wx.hideLoading()
// wx.showToast({
// title: '请稍后再试',
// icon: 'none',
// duration: 2000
// })
// }
// console.log('res', res)
// if (res == 1) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// wx.removeStorageSync('canvas')
// setTimeout(function () {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// }
// }, 2000)
// } else if (res == 0) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// // url: '/pages/end/end?lbtype=-1',
// url: '/pages/record/record',
// success: function () {
// that.setData({
// flag: true
// })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }, 2000)
// } else {
// }
// })
}) })
} }
}, },
......
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
sendAnswerOption sendAnswerOption
} from '../../utils/scale/dati08.js' } from '../../utils/scale/dati08.js'
import datiTestData from '../../utils/scale/dati08TestData' import datiTestData from '../../utils/scale/dati08TestData'
var Api = require('../../utils/api.js');
Page({ Page({
data: { data: {
currentIndex: 0, currentIndex: 0,
...@@ -309,6 +310,12 @@ Page({ ...@@ -309,6 +310,12 @@ Page({
user_answer: sendDataScore, user_answer: sendDataScore,
answer: sendDataOption, answer: sendDataOption,
}; };
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
ndata.is_type = 0;
} else {
ndata.is_type = 1;
}
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData'; var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid; ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6; ndata.uid = 6;
...@@ -328,8 +335,7 @@ Page({ ...@@ -328,8 +335,7 @@ Page({
var formdata = wx.getStorageSync('allUserinfo'); var formdata = wx.getStorageSync('allUserinfo');
let newdata = Object.assign({...ndata,...formdata}); let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata); newdata = this.removeEmptyProperties(newdata);
// var url = HOST_xinli + 'xinli/index.php/Api/add_res'; fetchPostN(url,newdata,(err,res)=>{
fetchPostN(url,data,(err,res)=>{
clearTimeout(uploadData); clearTimeout(uploadData);
if (+res == 0) { if (+res == 0) {
wx.showModal({ wx.showModal({
...@@ -337,45 +343,15 @@ Page({ ...@@ -337,45 +343,15 @@ Page({
title: "提交失败,请重新提交。" title: "提交失败,请重新提交。"
}) })
return; return;
} } else if (Number(res.code) == -1) {
if (Number(res.code) == -1) {
wx.hideLoading(); wx.hideLoading();
Api.alert(res.msg) Api.alert(res.msg)
that.setData({ that.setData({
flag: true flag: true
}) })
return; return;
}
var data1 = {};
var ti_title = this.data.scaleData.measure_name;
var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title;
// data1.res_id = res;
data1.user_stime = user_stime;
var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') {
var unitid = wx.getStorageSync("unitid");
data1.unitid = unitid;
data1.z_openid = lb_descript.desc.z_openid;
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = lb_descript.desc.z_openid;
data1.is_type = 0;
data1.measure_id = lb_descript.id[0];
} else { } else {
data1.z_openid = user.openid; if (res.data.charactersStatus == 1 || res.data.charactersStatus == 0) {
data1.t_openid = lb_descript.desc.t_openid;
data1.openid = user.openid;
data1.is_type = 1;
data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0];
}
// var urls = HOST + 'wechat.php?s=Home/del_vip'
var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips'
fetchPost(urls,data1,(err,res)=>{
if (res == 1 || res == 0) {
wx.removeStorageSync('lb_swiper_con'); wx.removeStorageSync('lb_swiper_con');
//删除答题记录缓存 //删除答题记录缓存
wx.removeStorageSync('answerRecordCache05') wx.removeStorageSync('answerRecordCache05')
...@@ -393,8 +369,7 @@ Page({ ...@@ -393,8 +369,7 @@ Page({
flag: true flag: true
}) })
} }
if (res == 1) { if (res.data.charactersStatus == 1) {
// clearTimeout(timer)
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -423,7 +398,7 @@ Page({ ...@@ -423,7 +398,7 @@ Page({
}) })
} }
}, 2000) }, 2000)
} else if (res == 0) { } else if (res.data.charactersStatus == 0) {
wx.showToast({ wx.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
...@@ -448,7 +423,106 @@ Page({ ...@@ -448,7 +423,106 @@ Page({
} else { } else {
} }
}) }
// var data1 = {};
// var ti_title = this.data.scaleData.measure_name;
// var lb_descript = wx.getStorageSync("lb_descript");
// data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
// data1.measure_name = ti_title;
// data1.user_stime = user_stime;
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// var unitid = wx.getStorageSync("unitid");
// data1.unitid = unitid;
// data1.z_openid = lb_descript.desc.z_openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = lb_descript.desc.z_openid;
// data1.is_type = 0;
// data1.measure_id = lb_descript.id[0];
// } else {
// data1.z_openid = user.openid;
// data1.t_openid = lb_descript.desc.t_openid;
// data1.openid = user.openid;
// data1.is_type = 1;
// data1.unitid = lb_descript.desc.unitid;
// data1.measure_id = lb_descript.id[0];
// }
// var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips'
// fetchPost(urls,data1,(err,res)=>{
// if (res == 1 || res == 0) {
// wx.removeStorageSync('lb_swiper_con');
// //删除答题记录缓存
// wx.removeStorageSync('answerRecordCache05')
// //删除计时
// wx.removeStorageSync('takeTime05')
// wx.hideLoading();
// }else {
// wx.hideLoading()
// wx.showToast({
// title: '请稍后再试',
// icon: 'none',
// duration: 2000
// })
// that.setData({
// flag: true
// })
// }
// if (res == 1) {
// // clearTimeout(timer)
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// var lb_tz = wx.getStorageSync('lb_tz');
// if (lb_tz == '1') {
// wx.reLaunch({
// url: '/pages/info1/info1?otype=1&otype1=1',
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// } else {
// var g_id = wx.getStorageSync('g_id');
// wx.reLaunch({
// url: `/pages/info/info?otype=1&otype1=1&ishow=1&g_id=${g_id}`,
// success: function () {
// that.setData({
// flag: true
// })
// }
// })
// }
// }, 2000)
// } else if (res == 0) {
// wx.showToast({
// title: '上传成功',
// icon: 'success',
// duration: 2000
// })
// setTimeout(function () {
// wx.removeStorageSync('tplbDetail')
// wx.removeStorageSync('weiLb')
// wx.reLaunch({
// url: '/pages/record/record',
// success: function () {
// that.setData({
// flag: true
// })
// wx.removeStorageSync('lb_descript');
// wx.removeStorageSync('allUserinfo');
// wx.removeStorageSync('g_id');
// wx.removeStorageSync('param_t_openid');
// }
// })
// }, 2000)
// } else {
// }
// })
}) })
} }
}, },
......
...@@ -377,40 +377,39 @@ Page({ ...@@ -377,40 +377,39 @@ Page({
} }
}, },
local() { // local() {
var that = this // var that = this
var data = wx.getStorageSync('data'); // var data = wx.getStorageSync('data');
if (!data) { // if (!data) {
this.main(); // this.main();
} // }
var BMap = new bmap.BMapWX({ // var BMap = new bmap.BMapWX({
ak: 'ex35RMokKmaz0qyifXBl88IClsom3IdZ' // ak: 'ex35RMokKmaz0qyifXBl88IClsom3IdZ'
}); // });
var str = ''; // var str = '';
wx.getLocation({ // wx.getLocation({
type: 'wgs84', // type: 'wgs84',
success: function (res) { // success: function (res) {
var latitude = res.latitude // var latitude = res.latitude
var longitude = res.longitude // var longitude = res.longitude
var str = latitude + ',' + longitude // var str = latitude + ',' + longitude
BMap.regeocoding({ // BMap.regeocoding({
// fail: fail, // location: str,
location: str, // success: function (res) {
success: function (res) { // var s = res.originalData.result.addressComponent.city;
var s = res.originalData.result.addressComponent.city; // that.register(s)
that.register(s) // },
}, // fail: function () {
fail: function () { // console.log('解析地址失败')
console.log('解析地址失败') // }
} // });
}); // },
}, // fail: function () {
fail: function () { // let str = ''
let str = '' // that.register(str);
that.register(str); // }
} // })
}) // },
},
queding: function () { queding: function () {
var data = wx.getStorageSync('data'); var data = wx.getStorageSync('data');
if (!data) { if (!data) {
......
...@@ -496,13 +496,10 @@ Page({ ...@@ -496,13 +496,10 @@ Page({
} }
wx.setStorageSync("judgeSex", judgeSex); wx.setStorageSync("judgeSex", judgeSex);
wx.setStorageSync("allUserinfo", data); wx.setStorageSync("allUserinfo", data);
// Api.fetchPost(urlt, data, (err, res) => {
wx.hideLoading() wx.hideLoading()
clearTimeout(timer1) clearTimeout(timer1)
// if (res.ret == 1) {
if (that.data.otype == 0 && that.data.lb_tz == '-1') { if (that.data.otype == 0 && that.data.lb_tz == '-1') {
wx.navigateTo({ wx.navigateTo({
// url: '/pages/swiper/swiper?otype=11',
url: '/pages/dati04/dati04?otype=11', url: '/pages/dati04/dati04?otype=11',
success: function () { success: function () {
wx.hideLoading() wx.hideLoading()
...@@ -588,15 +585,6 @@ Page({ ...@@ -588,15 +585,6 @@ Page({
} }
}) })
} }
// } else {
// Api.alert(res.msg, function () {
// that.setData({
// payInfo: true
// })
// });
// }
// });
} }
} }
}) })
......
...@@ -152,7 +152,7 @@ Page({ ...@@ -152,7 +152,7 @@ Page({
* a 接受的参数 数组 * a 接受的参数 数组
**/ **/
dealData(a) { dealData(a) {
console.log(a, 'a') // console.log(a, 'a')
let classification = [] let classification = []
let arr1 = []; let arr1 = [];
for (var i in a) { for (var i in a) {
...@@ -180,7 +180,7 @@ Page({ ...@@ -180,7 +180,7 @@ Page({
if (arr1[i].arr.length != 0) { if (arr1[i].arr.length != 0) {
arr2.push(arr1[i]) arr2.push(arr1[i])
} }
console.log(arr2,"arr2s") // console.log(arr2,"arr2s")
this.setData({ this.setData({
arr: arr2, arr: arr2,
}) })
......
...@@ -57,14 +57,14 @@ function formatNumber(n) { ...@@ -57,14 +57,14 @@ function formatNumber(n) {
return n[1] ? n : '0' + n return n[1] ? n : '0' + n
} }
function getLoc(callback) { // function getLoc(callback) {
wx.getLocation({ // wx.getLocation({
type: 'wgs84', // type: 'wgs84',
success: function (res) { // success: function (res) {
callback(res) // callback(res)
} // }
}) // })
} // }
function stripTags(str, r_str = "") { function stripTags(str, r_str = "") {
//去掉所有的html标记 //去掉所有的html标记
...@@ -358,7 +358,7 @@ function validateIdCard(idCard) { ...@@ -358,7 +358,7 @@ function validateIdCard(idCard) {
module.exports = { module.exports = {
base64src:base64src, base64src:base64src,
formatTime: formatTime, formatTime: formatTime,
getLoc: getLoc, // getLoc: getLoc,
stripTags: stripTags, stripTags: stripTags,
imageUtil: imageUtil, imageUtil: imageUtil,
Base64: Base64, Base64: Base64,
......
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