|
@@ -21,8 +21,48 @@ let chartSnoringLine;//打鼾
|
|
|
let chartApneaLine;//呼吸暂停
|
|
let chartApneaLine;//呼吸暂停
|
|
|
let chartTimeWaterfall;//深浅睡眠
|
|
let chartTimeWaterfall;//深浅睡眠
|
|
|
|
|
|
|
|
-// 圈圈
|
|
|
|
|
|
|
+// 圈圈>90分极好(绿色)
|
|
|
|
|
+// > 75分,(浅绿色)良好
|
|
|
|
|
+// 各项睡眠监测数据统计 > 60分,较差(黄色)
|
|
|
|
|
+// < 60分,很差(红色)
|
|
|
function setChartCircularProgressBarOption(chart, data = {}) {
|
|
function setChartCircularProgressBarOption(chart, data = {}) {
|
|
|
|
|
+ var rscore_value = data?.rscore_value || 0;
|
|
|
|
|
+ var checkList = [{
|
|
|
|
|
+ title: "极好",
|
|
|
|
|
+ titleColor: "#0BC3AA",
|
|
|
|
|
+ startColor: "#0AB1C3",
|
|
|
|
|
+ centerColor: "#0BC3AA",
|
|
|
|
|
+ endColor: "#36E1CA",
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: "良好",
|
|
|
|
|
+ titleColor: "#9C43FF",
|
|
|
|
|
+ startColor: "#8D25FF",
|
|
|
|
|
+ centerColor: "#A631FF",
|
|
|
|
|
+ endColor: "#FF8FF0",
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: "较差",
|
|
|
|
|
+ titleColor: "#FF8F4E",
|
|
|
|
|
+ startColor: "#EE8B52",
|
|
|
|
|
+ centerColor: "#FAA472",
|
|
|
|
|
+ endColor: "#FAA472",
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: "很差",
|
|
|
|
|
+ titleColor: "#FB717B",
|
|
|
|
|
+ startColor: "#FB717B",
|
|
|
|
|
+ centerColor: "#FB717B",
|
|
|
|
|
+ endColor: "#FF98A0",
|
|
|
|
|
+ }];
|
|
|
|
|
+ var checkData = checkList[0];
|
|
|
|
|
+ if (rscore_value >= 90 && rscore_value <= 100) {
|
|
|
|
|
+ checkData = checkList[0];
|
|
|
|
|
+ } else if (rscore_value >= 75 && rscore_value < 90) {
|
|
|
|
|
+ checkData = checkList[1];
|
|
|
|
|
+ } else if (rscore_value >= 60 && rscore_value < 75) {
|
|
|
|
|
+ checkData = checkList[2];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ checkData = checkList[3];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
var option = {
|
|
var option = {
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
@@ -55,16 +95,16 @@ function setChartCircularProgressBarOption(chart, data = {}) {
|
|
|
colorStops: [
|
|
colorStops: [
|
|
|
{
|
|
{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
- color: '#8D25FF' // 0% 处的颜色
|
|
|
|
|
|
|
+ color: checkData.startColor // 0% 处的颜色
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
offset: 0.5,
|
|
offset: 0.5,
|
|
|
- color: '#A631FF' // 100% 处的颜色
|
|
|
|
|
|
|
+ color: checkData.centerColor // 100% 处的颜色
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
offset: 1,
|
|
offset: 1,
|
|
|
- color: '#FF8FF0' // 100% 处的颜色
|
|
|
|
|
|
|
+ color: checkData.endColor // 100% 处的颜色
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
global: false // 缺省为 false
|
|
global: false // 缺省为 false
|
|
@@ -90,7 +130,7 @@ function setChartCircularProgressBarOption(chart, data = {}) {
|
|
|
show: false,
|
|
show: false,
|
|
|
},
|
|
},
|
|
|
title: {
|
|
title: {
|
|
|
- color: '#6C6970',
|
|
|
|
|
|
|
+ color: checkData.titleColor,
|
|
|
offsetCenter: [0, '-36%'],
|
|
offsetCenter: [0, '-36%'],
|
|
|
lineHeight: 15,
|
|
lineHeight: 15,
|
|
|
fontSize: 15,
|
|
fontSize: 15,
|
|
@@ -110,13 +150,13 @@ function setChartCircularProgressBarOption(chart, data = {}) {
|
|
|
value: {
|
|
value: {
|
|
|
fontSize: 30,
|
|
fontSize: 30,
|
|
|
fontWeight: 'bolder',
|
|
fontWeight: 'bolder',
|
|
|
- color: '#333333'
|
|
|
|
|
|
|
+ color: checkData.titleColor
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data: [
|
|
data: [
|
|
|
{
|
|
{
|
|
|
- name: data?.rscore_desc || '无',
|
|
|
|
|
|
|
+ name: data?.rscore_desc || checkData.title || '无',
|
|
|
value: data?.rscore_value || 0
|
|
value: data?.rscore_value || 0
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
@@ -731,8 +771,6 @@ function setSnoringOption(chart, data1 = [], data2 = [],) {
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
type: 'value',
|
|
type: 'value',
|
|
|
- max: 24,
|
|
|
|
|
- min: 0,
|
|
|
|
|
show: false,
|
|
show: false,
|
|
|
},
|
|
},
|
|
|
series: [{
|
|
series: [{
|
|
@@ -849,8 +887,6 @@ function setApneaOption(chart, data1 = [], data2 = [],) {
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
type: 'value',
|
|
type: 'value',
|
|
|
- max: 24,
|
|
|
|
|
- min: 0,
|
|
|
|
|
show: false,
|
|
show: false,
|
|
|
},
|
|
},
|
|
|
series: [{
|
|
series: [{
|
|
@@ -922,7 +958,7 @@ function renderItem(params, api) {
|
|
|
api.value(1) + (api.value(2) - api.value(1)) / 2,
|
|
api.value(1) + (api.value(2) - api.value(1)) / 2,
|
|
|
categoryIndex
|
|
categoryIndex
|
|
|
])[1]; // 取中间点的y坐标
|
|
])[1]; // 取中间点的y坐标
|
|
|
- var height = api.size([0, 1])[1] * 0.6;
|
|
|
|
|
|
|
+ var height = api.size([0, 1])[1] * 1;
|
|
|
var width = endX - startX;
|
|
var width = endX - startX;
|
|
|
|
|
|
|
|
// 创建一个矩形
|
|
// 创建一个矩形
|
|
@@ -964,7 +1000,7 @@ function setTimeWaterfallOption(chart, startTime = new Date().getTime(), data =
|
|
|
var option =
|
|
var option =
|
|
|
option = {
|
|
option = {
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
- show:true,
|
|
|
|
|
|
|
+ show: true,
|
|
|
formatter: function (params) {
|
|
formatter: function (params) {
|
|
|
return params.marker + params.name + ': ' + params.value[3] + ' m';
|
|
return params.marker + params.name + ': ' + params.value[3] + ' m';
|
|
|
}
|
|
}
|
|
@@ -978,11 +1014,11 @@ function setTimeWaterfallOption(chart, startTime = new Date().getTime(), data =
|
|
|
grid: {
|
|
grid: {
|
|
|
top: 0,
|
|
top: 0,
|
|
|
bottom: 0,
|
|
bottom: 0,
|
|
|
- height:210,
|
|
|
|
|
|
|
+ height: 160,
|
|
|
containLabel: false
|
|
containLabel: false
|
|
|
},
|
|
},
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
- type: 'value',
|
|
|
|
|
|
|
+ type: 'value',
|
|
|
scale: true,
|
|
scale: true,
|
|
|
splitLine: {
|
|
splitLine: {
|
|
|
show: false // 是否显示刻度线
|
|
show: false // 是否显示刻度线
|
|
@@ -2011,7 +2047,7 @@ Page({
|
|
|
// onInit: initChartTimeWaterfall
|
|
// onInit: initChartTimeWaterfall
|
|
|
},
|
|
},
|
|
|
header: false,
|
|
header: false,
|
|
|
- showAuthorizedDialog:false,
|
|
|
|
|
|
|
+ showAuthorizedDialog: false,
|
|
|
nowDate: [{ //日历的初始化数据
|
|
nowDate: [{ //日历的初始化数据
|
|
|
month: 'current',
|
|
month: 'current',
|
|
|
day: new Date().getDate(),
|
|
day: new Date().getDate(),
|
|
@@ -2841,7 +2877,7 @@ Page({
|
|
|
// console.log('ress.data.results.rin_duration=' + ress.data.results.rin_duration);
|
|
// console.log('ress.data.results.rin_duration=' + ress.data.results.rin_duration);
|
|
|
// console.log('ress.data.results.rawake_duration=' + ress.data.results.rawake_duration);
|
|
// console.log('ress.data.results.rawake_duration=' + ress.data.results.rawake_duration);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // initChartTimeWaterfall();
|
|
|
that.calculateTheDurationOfDeepSleep();
|
|
that.calculateTheDurationOfDeepSleep();
|
|
|
// updateTimeWaterfall([that.convertTimeToHoursAndMinutes(ress.data.results.rawake_duration, 2),
|
|
// updateTimeWaterfall([that.convertTimeToHoursAndMinutes(ress.data.results.rawake_duration, 2),
|
|
|
// that.convertTimeToHoursAndMinutes(ress.data.results.rin_duration, 2),
|
|
// that.convertTimeToHoursAndMinutes(ress.data.results.rin_duration, 2),
|
|
@@ -4267,10 +4303,10 @@ Page({
|
|
|
// 初始化变量 reportDate
|
|
// 初始化变量 reportDate
|
|
|
// let dateString = '2024/09/14 23:20:00';
|
|
// let dateString = '2024/09/14 23:20:00';
|
|
|
let dateString = `${that.data.reportDate.replaceAll("-", "/")} ${that.data.rgobed_time + ":00"}`;
|
|
let dateString = `${that.data.reportDate.replaceAll("-", "/")} ${that.data.rgobed_time + ":00"}`;
|
|
|
- let date = new Date(dateString);
|
|
|
|
|
|
|
+ let date = new Date(dateString);
|
|
|
let startTime = date.getTime(); // 基准时间,这里设为午夜开始
|
|
let startTime = date.getTime(); // 基准时间,这里设为午夜开始
|
|
|
console.log("时间=》", timestampToHHMM(startTime));
|
|
console.log("时间=》", timestampToHHMM(startTime));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let currentTime = startTime;
|
|
let currentTime = startTime;
|
|
|
let currentState = sleepData[0];
|
|
let currentState = sleepData[0];
|
|
|
let timePeriods = [];
|
|
let timePeriods = [];
|
|
@@ -4349,11 +4385,11 @@ Page({
|
|
|
this.showData();
|
|
this.showData();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- showData() {
|
|
|
|
|
- let userInfo = wx.getStorageSync("userInfo") || {};
|
|
|
|
|
- let hotelcodeTemp = userInfo.hotel;
|
|
|
|
|
- let roomcodeTemp = userInfo.room;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ showData() {
|
|
|
|
|
+ let hotelcodeTemp = wx.getStorageSync("hotelEmpower");
|
|
|
|
|
+ let roomcodeTemp = wx.getStorageSync("roomEmpower");
|
|
|
|
|
+ // hotelcodeTemp = wx.getStorageSync('res').result.split('|')[0];
|
|
|
|
|
+ // roomcodeTemp = wx.getStorageSync('res').result.split('|')[1];
|
|
|
this.getData(null, hotelcodeTemp, roomcodeTemp, null);
|
|
this.getData(null, hotelcodeTemp, roomcodeTemp, null);
|
|
|
// 设置canvas的宽高
|
|
// 设置canvas的宽高
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -4373,12 +4409,7 @@ Page({
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
*/
|
|
|
- onShow: function (options) {
|
|
|
|
|
- const app = getApp();
|
|
|
|
|
- app.globalData.selectedTabIndex = 2;
|
|
|
|
|
- this.getTabBar().setData({
|
|
|
|
|
- selected: 2
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ onShow: function () {
|
|
|
var that = this;
|
|
var that = this;
|
|
|
console.log("that.data.month + 1", that.data.month + 1)
|
|
console.log("that.data.month + 1", that.data.month + 1)
|
|
|
var clickDate = String(that.data.year) + String(that.data.month) + String(that.data.date)
|
|
var clickDate = String(that.data.year) + String(that.data.month) + String(that.data.date)
|
|
@@ -4391,13 +4422,20 @@ Page({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
- onLoad(option) {
|
|
|
|
|
|
|
+ onLoad(options) {
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ if (options.rpids) {
|
|
|
|
|
+ that.setData({
|
|
|
|
|
+ reportId: options.rpids
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
// var that = this;
|
|
// var that = this;
|
|
|
// console.log("data页面");
|
|
// console.log("data页面");
|
|
|
// wx.clearStorage();
|
|
// wx.clearStorage();
|
|
|
// console.log('option.res=' + JSON.stringify(wx.getStorageSync('res')));
|
|
// console.log('option.res=' + JSON.stringify(wx.getStorageSync('res')));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// if (!wx.getStorageSync('res') || !wx.getStorageSync('res').result) {
|
|
// if (!wx.getStorageSync('res') || !wx.getStorageSync('res').result) {
|
|
|
// wx.showModal({
|
|
// wx.showModal({
|
|
|
// title: '提示',
|
|
// title: '提示',
|
|
@@ -4424,7 +4462,7 @@ Page({
|
|
|
// })
|
|
// })
|
|
|
// }, 2000) // 设置延时时间,单位为毫秒
|
|
// }, 2000) // 设置延时时间,单位为毫秒
|
|
|
// }
|
|
// }
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// else if(!this.data.home_room.includes(wx.getStorageSync('res').result)){
|
|
// else if(!this.data.home_room.includes(wx.getStorageSync('res').result)){
|
|
|
// wx.showModal({
|
|
// wx.showModal({
|