|
@ -0,0 +1,679 @@
|
|
|
var rowData = {};
|
|
|
var sn = ""; //记录sn码
|
|
|
var dataId = null;
|
|
|
var type = null;
|
|
|
var name = null;
|
|
|
var type = null;
|
|
|
var photoUrl = null;
|
|
|
var deviceId = null;
|
|
|
var oldSn = ""; //旧sn
|
|
|
var sncode = '';
|
|
|
var showDateDom1 = null;
|
|
|
var showDateDom2 = null;
|
|
|
var showDateDom3 = null;
|
|
|
var showDateDom4 = null;
|
|
|
var showDateDom5 = null;
|
|
|
var showDateDom6 = null;
|
|
|
var showDateDom7 = null;
|
|
|
var categoryCode = '';
|
|
|
var prescriptionCode;
|
|
|
var $szTime = $('.sz-time');
|
|
|
var d = dialog({
|
|
|
contentType: 'load',
|
|
|
skin: 'bk-popup'
|
|
|
}),
|
|
|
tips = ['早餐前血糖', '早餐后血糖', '午餐前血糖', '午餐后血糖', '晚餐前血糖', '晚餐后血糖', '睡前血糖'];
|
|
|
$(function() {
|
|
|
Request = GetRequest();
|
|
|
dataId = Request["id"];
|
|
|
deviceId = Request["deviceId"];
|
|
|
prescriptionCode = Request["prescriptionCode"];
|
|
|
categoryCode = Request["categoryCode"];
|
|
|
$('#member').val(window.localStorage.getItem('nowPatientName'));
|
|
|
getDeviceInfo(deviceId);
|
|
|
bindEvents();
|
|
|
if(dataId) {
|
|
|
$(document).attr("title", "编辑血糖仪");
|
|
|
initData(dataId);
|
|
|
$('.xt-time-list').show();
|
|
|
$("#bang-btn").html("保存");
|
|
|
showDateDom1 = $('#mobIn1');
|
|
|
showDateDom2 = $('#mobIn2');
|
|
|
showDateDom3 = $('#mobIn3');
|
|
|
showDateDom4 = $('#mobIn4');
|
|
|
showDateDom5 = $('#mobIn5');
|
|
|
showDateDom6 = $('#mobIn6');
|
|
|
showDateDom7 = $('#mobIn7');
|
|
|
} else {
|
|
|
$(document).attr("title", "新增血糖仪");
|
|
|
}
|
|
|
$("#bang-btn").addClass("active");
|
|
|
|
|
|
weixinSign();
|
|
|
});
|
|
|
|
|
|
function initData(dataId) {
|
|
|
var params = {};
|
|
|
params.id = dataId;
|
|
|
sendPost("patient/device/PatientDeviceInfo", params, "JSON", "GET",
|
|
|
function(res) {
|
|
|
if(res.msg) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
content: res.msg
|
|
|
}).show();
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备信息初始化失败!'
|
|
|
}).show();
|
|
|
}
|
|
|
},
|
|
|
function(res) {
|
|
|
if(res.status == 200) {
|
|
|
rowData = res.data;
|
|
|
oldSn = rowData.device.deviceSn;
|
|
|
$("#sncode").val(rowData.device.deviceSn);
|
|
|
sncode = rowData.device.deviceSn;
|
|
|
console.log(rowData);
|
|
|
var fasting = (rowData.time['fasting'].replace(/ /g, '')).split('-'),
|
|
|
afterBreakFast = (rowData.time['afterBreakFast'].replace(/ /g, '')).split('-'),
|
|
|
beforeLunch = (rowData.time['beforeLunch'].replace(/ /g, '')).split('-'),
|
|
|
afterLunch = (rowData.time['afterLunch'].replace(/ /g, '')).split('-'),
|
|
|
beforeDinner = (rowData.time['beforeDinner'].replace(/ /g, '')).split('-'),
|
|
|
afterDinner = (rowData.time['afterDinner'].replace(/ /g, '')).split('-'),
|
|
|
beforeSleep = (rowData.time['beforeSleep'].replace(/ /g, '')).split('-');
|
|
|
|
|
|
showDateDom1.val(fasting[0].substring(0,5) + '-' + fasting[1].substring(0,5));
|
|
|
showDateDom2.val(afterBreakFast[0].substring(0,5) + '-' + afterBreakFast[1].substring(0,5));
|
|
|
showDateDom3.val(beforeLunch[0].substring(0,5) + '-' + beforeLunch[1].substring(0,5));
|
|
|
showDateDom4.val(afterLunch[0].substring(0,5) + '-' + afterLunch[1].substring(0,5));
|
|
|
showDateDom5.val(beforeDinner[0].substring(0,5) + '-' + beforeDinner[1].substring(0,5));
|
|
|
showDateDom6.val(afterDinner[0].substring(0,5) + '-' + afterDinner[1].substring(0,5));
|
|
|
showDateDom7.val(beforeSleep[0].substring(0,5) + '-' + beforeSleep[1].substring(0,5));
|
|
|
loadTime();
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备信息初始化失败!'
|
|
|
}).show();
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
|
|
|
//判断值是否改变过
|
|
|
function isValueChange() {
|
|
|
var changeTagStr = $("#sncode").val();
|
|
|
if(oldSn != changeTagStr) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//绑定事件
|
|
|
function bindEvents() {
|
|
|
$('#sncode').on('click', function() {
|
|
|
$(this).focus();
|
|
|
});
|
|
|
//保存方法
|
|
|
$("#bang-btn").bind("click", function() {
|
|
|
if($(this).hasClass("active")) {
|
|
|
var snCode = $("#sncode").val();
|
|
|
if(snCode == null || snCode == "") {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '请输入设备的SN码进行绑定!'
|
|
|
}).show();
|
|
|
} else {
|
|
|
if(!dataId) {
|
|
|
$("#bang-btn").html("正在绑定").css("pointer-events", "none");
|
|
|
}
|
|
|
d.show();
|
|
|
checkSnBind(snCode, checkSuccess);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
$(".scanText").on('click', function(){
|
|
|
wx.scanQRCode({
|
|
|
desc: 'scanQRCode desc',
|
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
success: function (res) {
|
|
|
// 回调
|
|
|
var code = res.resultStr,
|
|
|
arr = code.split(",");//因为微信扫描条形码的时候,会带上这个码的类型,所以取数组后的码显示
|
|
|
|
|
|
$("#sncode").val(arr[1]);
|
|
|
},
|
|
|
error: function(res){
|
|
|
if(res.errMsg.indexOf('function_not_exist') > 0){
|
|
|
alert('版本过低请升级')
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function checkSnBind(snCode, checkSuccess) {
|
|
|
if (dataId && snCode == oldSn) {
|
|
|
addData(snCode);
|
|
|
} else {
|
|
|
var b = /^[0-9a-zA-Z]*$/g;
|
|
|
if(!b.test(snCode)) {
|
|
|
setTimeout(function() {
|
|
|
$("#bang-btn").html("立即绑定").css("pointer-events", "");
|
|
|
}, 3000);
|
|
|
d.close();
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '对不起,您输入的SN有误,请重新输入!'
|
|
|
}).show();
|
|
|
return false;
|
|
|
}
|
|
|
var params = {};
|
|
|
params.type = type;
|
|
|
params.device_sn = snCode;
|
|
|
$.ajax(server + "patient/device/PatientDeviceIdcard", {
|
|
|
data: params,
|
|
|
dataType: "JSON",
|
|
|
async: false,
|
|
|
type: "get",
|
|
|
timeout: 10000,
|
|
|
beforeSend: function(request) {
|
|
|
var userAgent = window.localStorage.getItem(agentName);
|
|
|
request.setRequestHeader("userAgent", userAgent);
|
|
|
},
|
|
|
error: function(res) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备SN校验失败!'
|
|
|
}).show();
|
|
|
setTimeout(function() {
|
|
|
$("#bang-btn").html("立即绑定").css("pointer-events", "");
|
|
|
d.close();
|
|
|
}, 3000);
|
|
|
},
|
|
|
success: function(res) {
|
|
|
setTimeout(function() {
|
|
|
$("#bang-btn").html("立即绑定").css("pointer-events", "");
|
|
|
d.close();
|
|
|
}, 3000);
|
|
|
if(res.status == 200) {
|
|
|
var name = "";
|
|
|
var others = null;
|
|
|
for(var j in res.data) {
|
|
|
name = res.data[j].name;
|
|
|
others = res.data[j].others
|
|
|
}
|
|
|
//没被绑定
|
|
|
if(name == "") {
|
|
|
$("#bang-btn").addClass("active");
|
|
|
if(dataId){
|
|
|
editSN(snCode);
|
|
|
} else {
|
|
|
if(checkSuccess != null) {
|
|
|
checkSuccess(snCode);
|
|
|
}
|
|
|
}
|
|
|
} else if(others != null && others == 1) {
|
|
|
// $("#bang-btn").removeClass("active");
|
|
|
//被绑定而且被别人绑定
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '该设备已被他人绑定,设备解绑后,方可再次绑定!'
|
|
|
}).show();
|
|
|
} else if(others != null && others == 0) {
|
|
|
// $("#bang-btn").removeClass("active");
|
|
|
if(deviceId == null || !deviceId || deviceId == "") {
|
|
|
//新增,编辑/被自己绑定
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '对不起,您已绑定过该设备,解绑后方可继续绑定!'
|
|
|
}).show();
|
|
|
} else {
|
|
|
if(dataId){
|
|
|
editSN(snCode);
|
|
|
} else {
|
|
|
if(checkSuccess != null) {
|
|
|
checkSuccess(snCode);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '该设备已被他人绑定,设备解绑后,方可再次绑定!'
|
|
|
}).show();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getDeviceInfo(deviceId) {
|
|
|
sendPost("/common/device/DeviceInfo?id=" + deviceId, {}, "JSON", "GET",
|
|
|
function(res) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备信息获取失败!'
|
|
|
}).show();
|
|
|
},
|
|
|
function(res) {
|
|
|
if(res.status == 200) {
|
|
|
var rowData1 = res.data;
|
|
|
type = rowData1.categoryCode;
|
|
|
name = rowData1.name;
|
|
|
photoUrl = getImgUrl(rowData1.photo);
|
|
|
$(".deviceName").html(name);
|
|
|
$(".div-xuetangyi-img img").attr("src", photoUrl);
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备信息获取失败!'
|
|
|
}).show();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
)
|
|
|
}
|
|
|
|
|
|
function checkSuccess(snCode) {
|
|
|
var name1 = "血糖仪-" + name;
|
|
|
var params = {};
|
|
|
params.deviceId = deviceId; //设备ID
|
|
|
params.deviceName = name1; //设备名称
|
|
|
params.deviceSn = snCode; //设备SN码
|
|
|
params.categoryCode = type; //设备分类 血糖仪1 血压计 2
|
|
|
params.userType = "-1"; //是否多用户
|
|
|
if(rowData.id) {
|
|
|
params.id = rowData.id;
|
|
|
}
|
|
|
sendPost("/patient/device/SavePatientDevice", {
|
|
|
"json": JSON.stringify(params)
|
|
|
}, "JSON", "post",
|
|
|
function(res) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备绑定失败!'
|
|
|
}).show();
|
|
|
},
|
|
|
function(res) {
|
|
|
if(res.status == 200) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '设备绑定成功!'
|
|
|
}).show();
|
|
|
setTimeout(function() {
|
|
|
window.location.href = 'view-shezhishijianduan.html?type=1&sncode=' + $('#sncode').val()+'&categoryCode='+type;
|
|
|
}, 500);
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: res.msg
|
|
|
}).show();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
|
|
|
function checkDate(v, index) {
|
|
|
if(v == '') {
|
|
|
switch(index) {
|
|
|
case 0:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 1:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 2:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 3:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 4:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 5:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
case 6:
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: tips[index]
|
|
|
}).show();
|
|
|
break;
|
|
|
}
|
|
|
d.close();
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
function editSN (snCode) {
|
|
|
var o = {};
|
|
|
o.deviceSN = oldSn;
|
|
|
o.newDeviceSN = snCode;
|
|
|
o.categoryCode = categoryCode;
|
|
|
o.userType = "-1"; //是否多用户
|
|
|
sendPost("patient/device/setBloodTime", o, "json", "get", null, function(res) {
|
|
|
d.close();
|
|
|
if(res.status == 200) {
|
|
|
addData(snCode);
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
bottom: true,
|
|
|
skin: 'bk-popup',
|
|
|
content: res.msg
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//添加数据
|
|
|
function addData(snCode) {
|
|
|
d.show();
|
|
|
var o = {},
|
|
|
isTrue = false,
|
|
|
isGo = false;
|
|
|
o.deviceSN = snCode;
|
|
|
o.userType = "-1"; //是否多用户
|
|
|
o.categoryCode = categoryCode;
|
|
|
$.each($szTime, function(index) {
|
|
|
var tArr = ($(this).val()).split('-');
|
|
|
if(!isTrue) {
|
|
|
isTrue = checkDate($(this).val(), index);
|
|
|
isGo = checkDate($(this).val(), index);
|
|
|
switch(index) {
|
|
|
case 0:
|
|
|
o.fastingStart = tArr[0] + ':00';
|
|
|
o.fastingEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 1:
|
|
|
o.afterBreakfastStart = tArr[0] + ':00';
|
|
|
o.afterBreakfastEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 2:
|
|
|
o.beforeLunchStart = tArr[0] + ':00';
|
|
|
o.beforeLunchEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 3:
|
|
|
o.afterLunchStart = tArr[0] + ':00';
|
|
|
o.afterLunchEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 4:
|
|
|
o.beforeDinnerStart = tArr[0] + ':00';
|
|
|
o.beforeDinnerEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 5:
|
|
|
o.afterDinnerStart = tArr[0] + ':00';
|
|
|
o.afterDinnerEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
case 6:
|
|
|
o.beforeSleepStart = tArr[0] + ':00';
|
|
|
o.beforeSleepEnd = tArr[1] + ':59';
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
if(!isGo) {
|
|
|
sendPost("patient/device/setBloodTime", o, "json", "get", null, function(res) {
|
|
|
d.close();
|
|
|
if(res.status == 200) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
bottom: true,
|
|
|
skin: 'bk-popup',
|
|
|
content: res.msg
|
|
|
}).show();
|
|
|
setTimeout(function() {
|
|
|
if(prescriptionCode){
|
|
|
window.history.go(-3);
|
|
|
}else{
|
|
|
window.location.href='my-equipments.html';
|
|
|
}
|
|
|
}, 500);
|
|
|
} else {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
bottom: true,
|
|
|
skin: 'bk-popup',
|
|
|
content: '保存失败'
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function loadTime() {
|
|
|
var iosSelect1 = null;
|
|
|
var iosSelect2 = null;
|
|
|
var iosSelect3 = null;
|
|
|
var iosSelect4 = null;
|
|
|
var iosSelect5 = null;
|
|
|
var iosSelect6 = null;
|
|
|
var iosSelect7 = null;
|
|
|
var starNum1 = 0;
|
|
|
var starNum2 = 0;
|
|
|
// 初始化时间
|
|
|
var now = new Date();
|
|
|
var nowHours = now.getHours();
|
|
|
var nowSeconds = now.getMinutes();
|
|
|
|
|
|
for(var i = 1; i <= 7; i++) {
|
|
|
var d = $('#mobIn' + i),
|
|
|
// d2 = $('#mobIn' + (i - 1)),
|
|
|
aArr = (d.val()).split('-');
|
|
|
d.attr('data-hours', (aArr[0].split(':'))[0]);
|
|
|
d.attr('data-seconds', (aArr[0].split(':'))[1]);
|
|
|
d.attr('data-thours', (aArr[1].split(':'))[0]);
|
|
|
d.attr('data-tseconds', (aArr[1].split(':'))[1]);
|
|
|
}
|
|
|
|
|
|
// 数据初始化
|
|
|
function cN(v) {
|
|
|
return v < 10 ? '0' + v : v;
|
|
|
}
|
|
|
|
|
|
function formatHours(s) {
|
|
|
var arr = [];
|
|
|
for(var i = s; i <= 23; i++) {
|
|
|
arr.push({
|
|
|
id: cN(i) + '',
|
|
|
value: cN(i)
|
|
|
});
|
|
|
}
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
function formatSeconds(s) {
|
|
|
var arr = [];
|
|
|
for(var i = s; i <= 59; i++) {
|
|
|
arr.push({
|
|
|
id: cN(i) + '',
|
|
|
value: cN(i)
|
|
|
});
|
|
|
}
|
|
|
return arr;
|
|
|
}
|
|
|
var hoursData = function(callback) {
|
|
|
callback(formatHours(starNum1));
|
|
|
};
|
|
|
var secondData = function(h, callback) {
|
|
|
callback(formatSeconds(starNum2))
|
|
|
};
|
|
|
|
|
|
var hoursTData = function(h, s, callback) {
|
|
|
h = parseInt(h);
|
|
|
callback(formatHours(h));
|
|
|
};
|
|
|
var secondTData = function(h, s, h1, callback) {
|
|
|
s = parseInt(s);
|
|
|
callback(formatSeconds(0))
|
|
|
};
|
|
|
for(var i = 1; i <= 7; i++) {
|
|
|
$('#mobIn' + i).on('click', function() {
|
|
|
var $me = $(this),
|
|
|
aArr = ($me.val()).split('-');
|
|
|
// d.attr('data-hours', (aArr[0].split(':'))[0]);
|
|
|
// d.attr('data-seconds', (aArr[0].split(':'))[1]);
|
|
|
// d.attr('data-thours', (aArr[1].split(':'))[0]);
|
|
|
// d.attr('data-tseconds', (aArr[1].split(':'))[1]);
|
|
|
|
|
|
var oneLevelId = parseInt(aArr[0].split(':')[0]);
|
|
|
var twoLevelId = parseInt(aArr[0].split(':')[1]);
|
|
|
var threeLevelId = parseInt(aArr[1].split(':')[0]);
|
|
|
var fourLevelId = parseInt(aArr[1].split(':')[1]);
|
|
|
|
|
|
var st = parseInt($me.attr('data-thours'));
|
|
|
var $n = $me.closest('.time-item').next(),
|
|
|
$p = $me.closest('.time-item').prev(),
|
|
|
ind = $me.closest('.time-item').index();
|
|
|
if($p.length) {
|
|
|
if(!$p.find('input').val()) {
|
|
|
dialog({
|
|
|
contentType: 'tipsbox',
|
|
|
skin: 'bk-popup',
|
|
|
bottom: true,
|
|
|
content: '请先选择上一个时间段!'
|
|
|
}).show();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if(ind == 0) {
|
|
|
starNum1 = 0;
|
|
|
starNum2 = 0;
|
|
|
} else {
|
|
|
var $p = $me.closest('.time-item').prev().find('input'),
|
|
|
pArr = ($p.val()).split('-');
|
|
|
starNum1 = parseInt(pArr[1].split(':')[0]);
|
|
|
starNum2 = parseInt('00');
|
|
|
}
|
|
|
new IosSelect(4, [hoursData, secondData, hoursTData, secondTData], {
|
|
|
title: '',
|
|
|
itemHeight: 35,
|
|
|
relation: [1, 1, 1, 1],
|
|
|
oneLevelId: oneLevelId,
|
|
|
twoLevelId: twoLevelId,
|
|
|
threeLevelId: threeLevelId,
|
|
|
fourLevelId: fourLevelId,
|
|
|
showLoading: true,
|
|
|
callback: function(selectOneObj, selectTwoObj, selectThreeObj, selectFourObj) {
|
|
|
$n.find('input').attr('data-hours', selectThreeObj.id);
|
|
|
$n.find('input').attr('data-seconds', selectFourObj.id);
|
|
|
$n.find('input').attr('data-thours', selectThreeObj.id);
|
|
|
$n.find('input').attr('data-tseconds', selectFourObj.id);
|
|
|
$me.attr('data-hours', selectOneObj.id);
|
|
|
$me.attr('data-seconds', selectTwoObj.id);
|
|
|
$me.attr('data-thours', selectThreeObj.id);
|
|
|
$me.attr('data-tseconds', selectFourObj.id);
|
|
|
starNum1 = parseInt(selectThreeObj.id);
|
|
|
starNum2 = parseInt(selectFourObj.id);
|
|
|
$me.val(selectOneObj.value + ':' + selectTwoObj.value + '-' + selectThreeObj.value + ':' + selectFourObj.value);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function weixinSign(){
|
|
|
//从后台那边获取签名等信息
|
|
|
var params = {};
|
|
|
var url1 = window.location.href;
|
|
|
params.pageUrl = url1;
|
|
|
$.ajax(server + "weixin/getSign", {
|
|
|
data: params,
|
|
|
dataType: "json",
|
|
|
type: "post",
|
|
|
success: function(res){
|
|
|
if (res.status == 200) {
|
|
|
var t = res.data.timestamp;
|
|
|
var noncestr = res.data.noncestr;
|
|
|
var signature = res.data.signature;
|
|
|
wx.config({
|
|
|
appId: appId, // 必填,公众号的唯一标识
|
|
|
timestamp: t, // 必填,生成签名的时间戳
|
|
|
nonceStr: noncestr, // 必填,生成签名的随机串
|
|
|
signature: signature,// 必填,签名,见附录1
|
|
|
jsApiList: [
|
|
|
'chooseImage',
|
|
|
'uploadImage',
|
|
|
'scanQRCode'
|
|
|
] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
});
|
|
|
|
|
|
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
|
|
|
wx.ready(function(){
|
|
|
wx.getNetworkType({
|
|
|
success: function (res) {
|
|
|
networkStatus = res.networkType; // 返回网络类型2g,3g,4g,wifi
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|