Commit 49cc3560 by 李萌

no message

parent 86889619
...@@ -75,7 +75,7 @@ Page({ ...@@ -75,7 +75,7 @@ Page({
} }
wx.setStorageSync('tplbDetail', tplbDetail) wx.setStorageSync('tplbDetail', tplbDetail)
wx.navigateTo({ wx.navigateTo({
url: '/pages/info1/info1', url: '/pages/info1/info1?paramTopenid='+e.currentTarget.dataset.topenid,
}) })
}, },
time(timestamp) { time(timestamp) {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<!-- <scroll-view scroll-y style="height: {{winH}}px;"> --> <!-- <scroll-view scroll-y style="height: {{winH}}px;"> -->
<block> <block>
<view class="list no_line"> <view class="list no_line">
<view class='record_1' wx:for="{{result}}" wx:for-item="item" bindtap='test' data-measure_id_t="{{item.measure_id_t}}" data-name="{{item.name}}" data-t_openid="{{item.t_openid}}" data-z_openid="{{item.z_openid}}" data-time="{{item.time01}}" data-t="{{item.g_time}}" data-img="{{item.headimgurl}}" data-measure_name_t="{{item.measure_name_t}}" data-idx="{{item.id}}" wx:for-index="index" wx:key="key"> <view class='record_1' wx:for="{{result}}" wx:for-item="item" bindtap='test' data-measure_id_t="{{item.measure_id_t}}" data-topenid="{{item.t_openid}}" data-name="{{item.name}}" data-t_openid="{{item.t_openid}}" data-z_openid="{{item.z_openid}}" data-time="{{item.time01}}" data-t="{{item.g_time}}" data-img="{{item.headimgurl}}" data-measure_name_t="{{item.measure_name_t}}" data-idx="{{item.id}}" wx:for-index="index" wx:key="key">
<view class='pho'> <view class='pho'>
<image src='{{item.headimgurl}}'></image> <image src='{{item.headimgurl}}'></image>
<view class='t-round'>{{item.lb_num}}</view> <view class='t-round'>{{item.lb_num}}</view>
......
...@@ -277,14 +277,27 @@ Page({ ...@@ -277,14 +277,27 @@ Page({
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
var liangbiaoCon = wx.getStorageSync('liangbiaoCon'); var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { // if (lb_tz == '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 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'; // var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} else { // } else {
var data = { user_stime: time, user_answer: answer.score, answer: answer.answer, user_number: user.openid, measure_id: lb_descript.id[0], }; // 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 url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} // }
data.unitid = lb_descript.desc.unitid; var stoUser = wx.getStorageSync('user');
var ndata = {
measure_id: lb_descript.id[0],
user_stime: time,
g_id: wx.getStorageSync('g_id'),
openid:stoUser.openid ? stoUser.openid:'',
user_answer: answer.score,
answer: answer.answer,
};
var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6;
ndata.submit_type = 2;
ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(function () { var uploadData = setTimeout(function () {
wx.hideLoading() wx.hideLoading()
wx.showToast({ icon: 'none', title: '您当前的网络不稳定,请检查网络重新提交', duration: 2000 }) wx.showToast({ icon: 'none', title: '您当前的网络不稳定,请检查网络重新提交', duration: 2000 })
...@@ -292,17 +305,28 @@ Page({ ...@@ -292,17 +305,28 @@ Page({
flag: true flag: true
}) })
}, 5000) }, 5000)
var formdata = wx.getStorageSync('allUserinfo');
Api.fetchPostN(url, data, (err, res) => { let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => {
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var liangbiaoCon = wx.getStorageSync('liangbiaoCon'); var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var data1 = {}; var data1 = {};
var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // 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 ti_title = liangbiaoCon.res[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = time; data1.user_stime = time;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { if (lb_tz == '1') {
...@@ -359,7 +383,10 @@ Page({ ...@@ -359,7 +383,10 @@ Page({
wx.switchTab({ wx.switchTab({
url: '/pages/record/record?lbtype=-1', url: '/pages/record/record?lbtype=-1',
success: function () { success: function () {
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
} }
...@@ -367,6 +394,15 @@ Page({ ...@@ -367,6 +394,15 @@ Page({
}) })
} }
}, },
removeEmptyProperties:function (obj) {
// 将对象转换为 [key, value] 数组
const entries = Object.entries(obj);
// 过滤掉属性值为空字符串的属性
const filteredEntries = entries.filter(([key, value]) => value !== ""&&value != 0&&value != 'undefined'&&value != null&&value != 'null'&&value != 'NULL');
// 将过滤后的数组转换回对象
const filteredObj = Object.fromEntries(filteredEntries);
return filteredObj;
},
/** /**
* 自定义函数---上一个 * 自定义函数---上一个
* 功能:返回上一个 * 功能:返回上一个
......
...@@ -147,12 +147,9 @@ Page({ ...@@ -147,12 +147,9 @@ Page({
tijiao: function () { tijiao: function () {
let that = this; let that = this;
if (this.data.flag) { if (this.data.flag) {
this.setData({ this.setData({
flag: false flag: false
}) })
// 计算答题时间 // 计算答题时间
var startTime2 = wx.getStorageSync('startTime2'); var startTime2 = wx.getStorageSync('startTime2');
var timeArr2 = wx.getStorageSync('timeArr2'); var timeArr2 = wx.getStorageSync('timeArr2');
...@@ -170,16 +167,28 @@ Page({ ...@@ -170,16 +167,28 @@ Page({
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 user = wx.getStorageSync('user');
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
if (liangbiaoCon.talp == '1') { // 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 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 url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} else { // } else {
var data = { user_stime: time, user_answer: answer.score, answer: answer.answer, user_number: user.openid, measure_id: lb_descript.id[0], }; // 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 url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} // }
data.unitid = lb_descript.desc.unitid; var user = wx.getStorageSync('user');
var ndata = {
measure_id: lb_descript.id[0],
user_stime: time,
g_id: wx.getStorageSync('g_id'),
openid:user.openid ? user.openid : '',
user_answer: answer.score,
answer: answer.answer,
};
var url = Api.HOST_huaiji + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid;
ndata.uid = 6;
ndata.submit_type = 2;
ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(function () { var uploadData = setTimeout(function () {
wx.hideLoading() wx.hideLoading()
wx.showToast({ icon: 'none', title: '您当前的网络不稳定,请检查网络重新提交', duration: 2000 }) wx.showToast({ icon: 'none', title: '您当前的网络不稳定,请检查网络重新提交', duration: 2000 })
...@@ -187,17 +196,28 @@ Page({ ...@@ -187,17 +196,28 @@ Page({
flag: true flag: true
}) })
}, 5000) }, 5000)
var formdata = wx.getStorageSync('allUserinfo');
Api.fetchPostN(url, data, (err, res) => { let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => {
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var liangbiaoCon = wx.getStorageSync('liangbiaoCon'); var liangbiaoCon = wx.getStorageSync('liangbiaoCon');
var data1 = {}; var data1 = {};
var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // 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 ti_title = liangbiaoCon.res[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = time; data1.user_stime = time;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { if (lb_tz == '1') {
...@@ -259,7 +279,10 @@ Page({ ...@@ -259,7 +279,10 @@ Page({
url: '/pages/record/record?lbtype=-1', url: '/pages/record/record?lbtype=-1',
success: function () { success: function () {
that.setData({ flag: true }) that.setData({ flag: true })
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
} }
...@@ -267,6 +290,15 @@ Page({ ...@@ -267,6 +290,15 @@ Page({
}) })
} }
}, },
removeEmptyProperties:function (obj) {
// 将对象转换为 [key, value] 数组
const entries = Object.entries(obj);
// 过滤掉属性值为空字符串的属性
const filteredEntries = entries.filter(([key, value]) => value !== ""&&value != 0&&value != 'undefined'&&value != null&&value != 'null'&&value != 'NULL');
// 将过滤后的数组转换回对象
const filteredObj = Object.fromEntries(filteredEntries);
return filteredObj;
},
preve: function (e) { preve: function (e) {
var num = e.currentTarget.dataset.num; var num = e.currentTarget.dataset.num;
num = Number(num) - 2; num = Number(num) - 2;
......
...@@ -1152,7 +1152,7 @@ Page({ ...@@ -1152,7 +1152,7 @@ Page({
var data1 = {}; var data1 = {};
// var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // var urls = Api.HOST + 'wechat.php?s=Home/del_vip';
var urls = Api.HOST + 'wechat.php?s=Home/del_vips'; var urls = Api.HOST_xlxl + 'wechat.php?s=Home/del_vips';
var ti_title = swiper_arr[0].measure_name; var ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb'); var authorize = wx.getStorageSync('weiLb');
...@@ -1261,6 +1261,7 @@ Page({ ...@@ -1261,6 +1261,7 @@ Page({
}) })
wx.removeStorageSync('lb_descript'); wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo'); wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid'); wx.removeStorageSync('param_t_openid');
} }
}) })
......
...@@ -499,27 +499,39 @@ Page({ ...@@ -499,27 +499,39 @@ Page({
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')
if (lb_tp == '1') { // if (lb_tp == '1') {
var data = { // var data = {
user_stime: time, // user_stime: time,
user_answer: answer.score, // user_answer: answer.score,
answer: answer.answer, // answer: answer.answer,
user_number: lb_descript.desc.z_openid, // 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 ndata = {
measure_id: lb_descript.id[0], measure_id: lb_descript.id[0],
};
var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} else {
var data = {
user_stime: time, user_stime: time,
g_id: wx.getStorageSync('g_id'),
openid:stoUser.openid ? stoUser.openid : '',
user_answer: answer.score, user_answer: answer.score,
answer: answer.answer, 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'; ndata.unitid = lb_descript.desc.unitid;
} ndata.uid = 6;
data.unitid = lb_descript.desc.unitid; ndata.submit_type = 2;
ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(function () { var uploadData = setTimeout(function () {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -531,23 +543,34 @@ Page({ ...@@ -531,23 +543,34 @@ Page({
flag: true flag: true
}) })
}, 5000) }, 5000)
var formdata = wx.getStorageSync('allUserinfo');
Api.fetchPostN(url, data, (err, res) => { let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata);
Api.fetchPostN(url, newdata, (err, res) => {
clearTimeout(uploadData) clearTimeout(uploadData)
if (Number(res) == 0) { if (Number(res) == 0) {
Api.alert("提交失败,请重新提交。") Api.alert("提交失败,请重新提交。")
return; return;
} }
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var swiper_arr = wx.getStorageSync('swiper_arr'); var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {}; var data1 = {};
var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // 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 ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb'); var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = time; data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id; data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
...@@ -644,7 +667,10 @@ Page({ ...@@ -644,7 +667,10 @@ Page({
that.setData({ that.setData({
flag: true flag: true
}) })
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
}, 2000) }, 2000)
...@@ -653,4 +679,13 @@ Page({ ...@@ -653,4 +679,13 @@ Page({
}) })
} }
}, },
removeEmptyProperties:function (obj) {
// 将对象转换为 [key, value] 数组
const entries = Object.entries(obj);
// 过滤掉属性值为空字符串的属性
const filteredEntries = entries.filter(([key, value]) => value !== ""&&value != 0&&value != 'undefined'&&value != null&&value != 'null'&&value != 'NULL');
// 将过滤后的数组转换回对象
const filteredObj = Object.fromEntries(filteredEntries);
return filteredObj;
},
}) })
\ No newline at end of file
...@@ -508,7 +508,7 @@ var pageData = { ...@@ -508,7 +508,7 @@ var pageData = {
formSubmit: function (e) { formSubmit: function (e) {
let that = this; let that = this;
var params = e.detail.value var params = e.detail.value
console.log("params", params) // console.log("params", params)
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
if (that.data.flag) { if (that.data.flag) {
that.setData({ that.setData({
...@@ -622,27 +622,40 @@ var pageData = { ...@@ -622,27 +622,40 @@ var pageData = {
var user = wx.getStorageSync('user'); var user = wx.getStorageSync('user');
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
var lb_tp = wx.getStorageSync('lb_tz') var lb_tp = wx.getStorageSync('lb_tz')
if (lb_tp == '1') { // if (lb_tp == '1') {
var data = { // var data = {
user_stime: time, // user_stime: time,
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),
user_number: lb_descript.desc.z_openid, // 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: JSON.stringify(that.data.userInfo),
// answer: JSON.stringify(that.data.userInfo),
// 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 user = wx.getStorageSync('user');
var ndata = {
measure_id: lb_descript.id[0], measure_id: lb_descript.id[0],
};
var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} else {
var data = {
user_stime: time, user_stime: time,
g_id: wx.getStorageSync('g_id'),
openid:user.openid ? user.openid : '',
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),
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 url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
} ndata.unitid = lb_descript.desc.unitid;
data.unitid = lb_descript.desc.unitid; ndata.uid = 6;
ndata.submit_type = 2;
ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(function () { var uploadData = setTimeout(function () {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -654,22 +667,34 @@ var pageData = { ...@@ -654,22 +667,34 @@ var pageData = {
flag: true flag: true
}) })
}, 5000) }, 5000)
Api.fetchPostN(url, data, (err, res) => { var formdata = wx.getStorageSync('allUserinfo');
console.log(res, 'resllo') let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata);
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;
} }
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var swiper_arr = wx.getStorageSync('swiper_arr'); var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {}; var data1 = {};
var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // 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 ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb'); var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = time; data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id; data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
...@@ -766,7 +791,10 @@ var pageData = { ...@@ -766,7 +791,10 @@ var pageData = {
that.setData({ that.setData({
flag: true flag: true
}) })
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
}, 2000) }, 2000)
...@@ -930,31 +958,43 @@ var pageData = { ...@@ -930,31 +958,43 @@ var pageData = {
} }
var thisTime = Date.parse(new Date()); var thisTime = Date.parse(new Date());
var cha = thisTime - startTime + chaTime; var cha = thisTime - startTime + chaTime;
var time = Api.reversalTime(cha) var time = Api.reversalTime(cha);
var user = wx.getStorageSync('user');
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
var lb_tp = wx.getStorageSync('lb_tz') var lb_tp = wx.getStorageSync('lb_tz')
if (lb_tp == '1') { // if (lb_tp == '1') {
var data = { // var data = {
user_stime: time, // user_stime: time,
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),
user_number: lb_descript.desc.z_openid, // 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: JSON.stringify(that.data.userInfo1),
// answer: JSON.stringify(that.data.userInfo1),
// 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 user = wx.getStorageSync('user');
var ndata = {
measure_id: lb_descript.id[0], measure_id: lb_descript.id[0],
};
var url = Api.HOST_xinli + 'xinli/index.php/Api/add_res';
} else {
var data = {
user_stime: time, user_stime: time,
g_id: wx.getStorageSync('g_id'),
openid:user.openid ? user.openid : '',
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),
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 url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
} ndata.unitid = lb_descript.desc.unitid;
data.unitid = lb_descript.desc.unitid; ndata.uid = 6;
ndata.submit_type = 2;
ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(function () { var uploadData = setTimeout(function () {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -966,23 +1006,34 @@ var pageData = { ...@@ -966,23 +1006,34 @@ var pageData = {
flag: true flag: true
}) })
}, 5000) }, 5000)
var formdata = wx.getStorageSync('allUserinfo');
Api.fetchPostN(url, data, (err, res) => { let newdata = Object.assign({...ndata,...formdata});
console.log(res, 'resllo') newdata = this.removeEmptyProperties(newdata);
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;
} }
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var swiper_arr = wx.getStorageSync('swiper_arr'); var swiper_arr = wx.getStorageSync('swiper_arr');
var data1 = {}; var data1 = {};
var urls = Api.HOST + 'wechat.php?s=Home/del_vip'; // 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 ti_title = swiper_arr[0].measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
var authorize = wx.getStorageSync('weiLb'); var authorize = wx.getStorageSync('weiLb');
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = time; data1.user_stime = time;
data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id; data1.characters_id = authorize.characters_id ? authorize.characters_id : authorize.record_id;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
...@@ -1006,7 +1057,7 @@ var pageData = { ...@@ -1006,7 +1057,7 @@ var pageData = {
} }
// clearTimeout(timer) // clearTimeout(timer)
Api.fetchPost(urls, data1, (err, res) => { Api.fetchPost(urls, data1, (err, res) => {
console.log('5555555555555', res) // console.log('5555555555555', res)
if (err) { if (err) {
that.setData({ that.setData({
flag: true flag: true
...@@ -1081,7 +1132,10 @@ var pageData = { ...@@ -1081,7 +1132,10 @@ var pageData = {
that.setData({ that.setData({
flag: true flag: true
}) })
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
}, 2000) }, 2000)
...@@ -1092,6 +1146,15 @@ var pageData = { ...@@ -1092,6 +1146,15 @@ var pageData = {
}) })
} }
}, },
removeEmptyProperties:function (obj) {
// 将对象转换为 [key, value] 数组
const entries = Object.entries(obj);
// 过滤掉属性值为空字符串的属性
const filteredEntries = entries.filter(([key, value]) => value !== ""&&value != 0&&value != 'undefined'&&value != null&&value != 'null'&&value != 'NULL');
// 将过滤后的数组转换回对象
const filteredObj = Object.fromEntries(filteredEntries);
return filteredObj;
},
//报错 //报错
showModal(error) { showModal(error) {
wx.showModal({ wx.showModal({
......
...@@ -274,32 +274,46 @@ Page({ ...@@ -274,32 +274,46 @@ Page({
mask: true mask: true
}); });
var user = wx.getStorageSync('user');
var lb_descript = wx.getStorageSync('lb_descript'); var lb_descript = wx.getStorageSync('lb_descript');
var lb_tp = wx.getStorageSync('lb_tz'); var lb_tp = wx.getStorageSync('lb_tz');
var user_stime = formatSeconds(this.data.takeTime) var user_stime = formatSeconds(this.data.takeTime)
if (lb_tp == '1') { // if (lb_tp == '1') {
var data = { // var data = {
user_stime: user_stime, // user_stime: user_stime,
user_answer: sendDataScore, // user_answer: sendDataScore,
answer: sendDataOption, // answer: sendDataOption,
user_number: lb_descript.desc.z_openid, // user_number: lb_descript.desc.z_openid,
measure_id: lb_descript.id[0] // measure_id: lb_descript.id[0]
}; // };
} else { // } else {
var data = { // var data = {
// user_stime: user_stime,
// user_answer: sendDataScore,
// answer: sendDataOption,
// user_number: user.openid,
// measure_id: lb_descript.id[0],
// g_id: wx.getStorageSync('g_id')
// };
// }
// console.log(data);
// data.unitid = lb_descript.desc.unitid;
var user = wx.getStorageSync('user');
var ndata = {
measure_id: lb_descript.id[0],
user_stime: user_stime, user_stime: user_stime,
g_id: wx.getStorageSync('g_id'),
openid:user.openid ? user.openid : '',
user_answer: sendDataScore, user_answer: sendDataScore,
answer: sendDataOption, answer: sendDataOption,
user_number: user.openid,
measure_id: lb_descript.id[0],
g_id: wx.getStorageSync('g_id')
}; };
} var url = Api.HOST_xlxl + 'amedical.php/gauge/pcAddData';
ndata.unitid = lb_descript.desc.unitid;
console.log(data); ndata.uid = 6;
ndata.submit_type = 2;
data.unitid = lb_descript.desc.unitid; ndata.t_openid = wx.getStorageSync('param_t_openid');
var uploadData = setTimeout(() => { var uploadData = setTimeout(() => {
wx.hideLoading(); wx.hideLoading();
wx.showToast({ wx.showToast({
...@@ -311,7 +325,10 @@ Page({ ...@@ -311,7 +325,10 @@ Page({
flag:true flag:true
}) })
}, 5000); }, 5000);
var url = HOST_xinli + 'xinli/index.php/Api/add_res'; var formdata = wx.getStorageSync('allUserinfo');
let newdata = Object.assign({...ndata,...formdata});
newdata = this.removeEmptyProperties(newdata);
// var url = HOST_xinli + 'xinli/index.php/Api/add_res';
fetchPostN(url,data,(err,res)=>{ fetchPostN(url,data,(err,res)=>{
clearTimeout(uploadData); clearTimeout(uploadData);
if (+res == 0) { if (+res == 0) {
...@@ -321,13 +338,21 @@ Page({ ...@@ -321,13 +338,21 @@ Page({
}) })
return; return;
} }
if (Number(res.code) == -1) {
wx.hideLoading();
Api.alert(res.msg)
that.setData({
flag: true
})
return;
}
var data1 = {}; var data1 = {};
var ti_title = this.data.scaleData.measure_name; var ti_title = this.data.scaleData.measure_name;
var lb_descript = wx.getStorageSync("lb_descript"); var lb_descript = wx.getStorageSync("lb_descript");
data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time; data1.g_time = lb_descript.desc.g_time || lb_descript.desc.time;
data1.measure_name = ti_title; data1.measure_name = ti_title;
data1.res_id = res; // data1.res_id = res;
data1.user_stime = user_stime; data1.user_stime = user_stime;
var lb_tz = wx.getStorageSync('lb_tz'); var lb_tz = wx.getStorageSync('lb_tz');
if (lb_tz == '1') { if (lb_tz == '1') {
...@@ -346,7 +371,8 @@ Page({ ...@@ -346,7 +371,8 @@ Page({
data1.unitid = lb_descript.desc.unitid; data1.unitid = lb_descript.desc.unitid;
data1.measure_id = lb_descript.id[0]; data1.measure_id = lb_descript.id[0];
} }
var urls = HOST + 'wechat.php?s=Home/del_vip' // 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)=>{ fetchPost(urls,data1,(err,res)=>{
if (res == 1 || res == 0) { if (res == 1 || res == 0) {
...@@ -411,7 +437,10 @@ Page({ ...@@ -411,7 +437,10 @@ Page({
that.setData({ that.setData({
flag: true flag: true
}) })
wx.removeStorageSync('lb_descript') wx.removeStorageSync('lb_descript');
wx.removeStorageSync('allUserinfo');
wx.removeStorageSync('g_id');
wx.removeStorageSync('param_t_openid');
} }
}) })
}, 2000) }, 2000)
...@@ -421,5 +450,14 @@ Page({ ...@@ -421,5 +450,14 @@ Page({
}) })
}) })
} }
} },
removeEmptyProperties:function (obj) {
// 将对象转换为 [key, value] 数组
const entries = Object.entries(obj);
// 过滤掉属性值为空字符串的属性
const filteredEntries = entries.filter(([key, value]) => value !== ""&&value != 0&&value != 'undefined'&&value != null&&value != 'null'&&value != 'NULL');
// 将过滤后的数组转换回对象
const filteredObj = Object.fromEntries(filteredEntries);
return filteredObj;
},
}) })
\ No newline at end of file
...@@ -43,7 +43,7 @@ Page({ ...@@ -43,7 +43,7 @@ Page({
select4: 0, select4: 0,
select5: 0, select5: 0,
select6: 0, select6: 0,
username1: '', ask_department: '',//单位
grade: '', //年级 grade: '', //年级
classGrade: '', //班级 classGrade: '', //班级
hosiptiaFlag: true, hosiptiaFlag: true,
...@@ -90,6 +90,17 @@ Page({ ...@@ -90,6 +90,17 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
var that = this; var that = this;
console.log('options', options)
if(options.otype && options.otype == '1') {
console.log(options.otype)
wx.setNavigationBarTitle({
title:'测评介绍'
})
} else {
wx.setNavigationBarTitle({
title:'录入信息'
})
}
var user = wx.getStorageSync("user"); var user = wx.getStorageSync("user");
that.setData({ that.setData({
ishow: options ishow: options
...@@ -127,7 +138,7 @@ Page({ ...@@ -127,7 +138,7 @@ Page({
}) })
} }
wx.setStorageSync('g_id', options.g_id) wx.setStorageSync('g_id', options.g_id)
} else if (otype == '1') { } else if (otype == '1'|| otype == '3') {
wx.setStorageSync('g_id', options.g_id) wx.setStorageSync('g_id', options.g_id)
that.setData({ that.setData({
is_yzm: options.is_yzm is_yzm: options.is_yzm
...@@ -431,7 +442,7 @@ Page({ ...@@ -431,7 +442,7 @@ Page({
data.sheqvNumber = that.data.sheqvNumber; data.sheqvNumber = that.data.sheqvNumber;
data.workNumber = that.data.workNumber; data.workNumber = that.data.workNumber;
data.idCard = that.data.idCard||''; data.idCard = that.data.idCard||'';
data.username1=that.data.username1||''; data.ask_department=that.data.ask_department||'';
data.select=that.data.select||0; data.select=that.data.select||0;
if (that.data.is_yzm == 1) { if (that.data.is_yzm == 1) {
data.yzm = that.data.yzm; data.yzm = that.data.yzm;
...@@ -439,7 +450,7 @@ Page({ ...@@ -439,7 +450,7 @@ Page({
// 新添加学历功能 // 新添加学历功能
data.edu = that.data.index||0; data.edu = that.data.index||0;
console.log('data',data) console.log('data',data)
if (data.name == '' || data.name == 'null' || data.sex == "null" || data.sex == "" || data.birthday == '' || data.birthday == 'null' || data.edu == 0||data.idCard==""||data.username1==""||data.select==0){ if (data.name == '' || data.name == 'null' || data.sex == "null" || data.sex == "" || data.birthday == '' || data.birthday == 'null' || data.edu == 0||data.idCard==""||data.ask_department==""||data.select==0){
that.setData({ that.setData({
payInfo: true payInfo: true
}) })
...@@ -631,7 +642,7 @@ Page({ ...@@ -631,7 +642,7 @@ Page({
that.setData({ that.setData({
username: res.info.name||'', username: res.info.name||'',
usernumber: essentialData.usernumber || '', usernumber: essentialData.usernumber || '',
username1: essentialData.username1 || '', ask_department: essentialData.ask_department || '',
select: essentialData.select || 0, select: essentialData.select || 0,
idCard:essentialData.idCard||'', idCard:essentialData.idCard||'',
index: res.info.cultural||0, index: res.info.cultural||0,
...@@ -780,7 +791,7 @@ Page({ ...@@ -780,7 +791,7 @@ Page({
// 单位名称 // 单位名称
inputChange1: function (e) { inputChange1: function (e) {
this.setData({ this.setData({
username1: e.detail.value, ask_department: e.detail.value,
}) })
}, },
inputChange3: function (e) { inputChange3: function (e) {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<text wx:if="{{unitid==1311}}" style="color:red;font-size:30rpx;">\n您所填写的内容绝对保密,不会对您的生活、学习、工作造成任何的影响,请您放心作答。 </text> <text wx:if="{{unitid==1311}}" style="color:red;font-size:30rpx;">\n您所填写的内容绝对保密,不会对您的生活、学习、工作造成任何的影响,请您放心作答。 </text>
</view> </view>
</view> </view>
<view hidden="{{ishow.otype == 1}}">
<view wx:if='{{hosiptiaFlag}}'> <view wx:if='{{hosiptiaFlag}}'>
<view class="content" wx:if='{{unitid ==1018}}'> <view class="content" wx:if='{{unitid ==1018}}'>
<view class="partyone">工号 <view class="partyone">工号
...@@ -116,7 +117,7 @@ ...@@ -116,7 +117,7 @@
</view> </view>
<view class="partyone"> <view class="partyone">
<block>单位名称</block> <block>单位名称</block>
<input type='text' placeholder='请输入' bindinput="inputChange1" value='{{username1}}'></input> <input type='text' placeholder='请输入' bindinput="inputChange1" value='{{ask_department}}'></input>
</view> </view>
<view class="partyone"> <view class="partyone">
身份证号 身份证号
...@@ -239,11 +240,10 @@ ...@@ -239,11 +240,10 @@
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="footer" bindtap="submit"> <view class="footer" bindtap="submit">
<button >开始</button> <button >开始</button>
</view> </view>
<view class='bottom-line'></view> <view class='bottom-line'></view>
</block> </block>
<view class='model-warp' hidden="{{hidden}}"> <view class='model-warp' hidden="{{hidden}}">
...@@ -252,7 +252,6 @@ ...@@ -252,7 +252,6 @@
<view class='model-txt-per model-t76'> <view class='model-txt-per model-t76'>
欢迎进入2020年度富士施乐员工心理健康体检 欢迎进入2020年度富士施乐员工心理健康体检
</view> </view>
<view class='model-btn-per' bindtap='confirm'>确定</view> <view class='model-btn-per' bindtap='confirm'>确定</view>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -61,6 +61,12 @@ Page({ ...@@ -61,6 +61,12 @@ Page({
idCard:'' idCard:''
}, },
onLoad: function(options) { onLoad: function(options) {
if(options.g_id) {
wx.setStorageSync('g_id',options.g_id);
}
if(options.paramTopenid) {
wx.setStorageSync('param_t_openid',options.paramTopenid);
}
var that = this; var that = this;
var info = wx.getStorageSync('tplbDetail'); var info = wx.getStorageSync('tplbDetail');
if (info.unitid == 737) { if (info.unitid == 737) {
...@@ -239,16 +245,23 @@ Page({ ...@@ -239,16 +245,23 @@ Page({
}) })
}, },
submit: function() { submit: function() {
var userOpenid = wx.getStorageSync('user').openid;
if(userOpenid == '' || userOpenid == 'undefined' || userOpenid == null) {
Api.alert("数据异常,请尝试重新进入小程序");
return false;
}
var paramtOpenid = wx.getStorageSync('param_t_openid');
if(paramtOpenid == '' || paramtOpenid == 'undefined' || paramtOpenid == null) {
Api.alert("请重新扫码");
return false;
}
var that = this; var that = this;
if (this.data.payInfo) { if (this.data.payInfo) {
this.setData({ this.setData({
payInfo: false payInfo: false
}) })
var unitid = wx.getStorageSync('data').unitid; var unitid = wx.getStorageSync('data').unitid;
// var authorize = wx.getStorageSync("weiLb"); // var authorize = wx.getStorageSync("weiLb");
var urlt = Api.HOST + 'wechat.php?s=Home/stinfo_two'; var urlt = Api.HOST + 'wechat.php?s=Home/stinfo_two';
var data = {}; var data = {};
var itemData = wx.getStorageSync("itemData"); var itemData = wx.getStorageSync("itemData");
...@@ -315,10 +328,11 @@ Page({ ...@@ -315,10 +328,11 @@ Page({
wx.showLoading({ wx.showLoading({
title: '请稍后', title: '请稍后',
}) })
Api.fetchPost(urlt, data, (err, res) => { wx.setStorageSync("allUserinfo", data);
// Api.fetchPost(urlt, data, (err, res) => {
wx.hideLoading() wx.hideLoading()
clearTimeout(timer1) clearTimeout(timer1)
if (res.ret == 1) { // if (res.ret == 1) {
if (that.data.lb_tz == '1') { if (that.data.lb_tz == '1') {
wx.navigateTo({ wx.navigateTo({
url: '/pages/dati01/dati01?tplb=1', url: '/pages/dati01/dati01?tplb=1',
...@@ -342,11 +356,10 @@ Page({ ...@@ -342,11 +356,10 @@ Page({
} }
}) })
} }
// } else {
} else { // Api.alert(res.msg);
Api.alert(res.msg); // }
} // });
});
} }
}, },
onUnload() {}, onUnload() {},
......
...@@ -68,8 +68,9 @@ Page({ ...@@ -68,8 +68,9 @@ Page({
}) })
}, },
lbTest(e) { lbTest(e) {
wx.setStorageSync('param_t_openid',e.currentTarget.dataset.t_openid);
let that = this; let that = this;
console.log(this.data.payInfo) // console.log(this.data.payInfo)
if (this.data.payInfo) { if (this.data.payInfo) {
this.setData({ payInfo: false }) this.setData({ payInfo: false })
var id = e.currentTarget.dataset.id; var id = e.currentTarget.dataset.id;
...@@ -96,7 +97,7 @@ Page({ ...@@ -96,7 +97,7 @@ Page({
Api.fetchPost(urls, data2, (err, res) => { Api.fetchPost(urls, data2, (err, res) => {
if (this.data.delbtn == -1) { if (this.data.delbtn == -1) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/info/info?otype=1&otype1=1&ishow=0&g_id='+res.info.g_id+'&is_yzm='+res.info.is_yzm, url: '/pages/info/info?otype=3&otype1=1&ishow=0&g_id='+res.info.g_id+'&is_yzm='+res.info.is_yzm,
success: function () { success: function () {
setTimeout(function () { setTimeout(function () {
that.setData({ payInfo: true }) that.setData({ payInfo: true })
......
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