|
|
@@ -79,21 +79,35 @@ function updateChartCircularProgressBarOption(rscore_desc, rscore_value, that) {
|
|
|
if (chartCircularProgressBar) {
|
|
|
setOption(chartCircularProgressBar);
|
|
|
} else {
|
|
|
- that.selectComponent('#mychart-dom-gauge').init((canvas, width, height, dpr) => {
|
|
|
- const chart = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height,
|
|
|
- devicePixelRatio: dpr // new
|
|
|
- });
|
|
|
- canvas.setChart(chart);
|
|
|
- setOption(chart);
|
|
|
+ // 假设这段代码在小程序的某个函数中执行
|
|
|
+
|
|
|
+ // 创建查询对象
|
|
|
+ const query = wx.createSelectorQuery();
|
|
|
+
|
|
|
+ // 选择第一个id为mychart-dom-gauge的view
|
|
|
+ query.select('#mychart-dom-gauge').boundingClientRect(function (res) {
|
|
|
+ // 如果res不为null,则表示view存在
|
|
|
+ if (res) {
|
|
|
+ that.selectComponent('#mychart-dom-gauge').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setOption(chart);
|
|
|
|
|
|
- // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
- chartCircularProgressBar = chart;
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartCircularProgressBar = chart;
|
|
|
|
|
|
- // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
- return chart;
|
|
|
- });
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('view不存在');
|
|
|
+ }
|
|
|
+ }).exec(); // 执行查询
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -3033,7 +3047,7 @@ Page({
|
|
|
obj.device_class = resData[i].attributes.device_class;
|
|
|
obj.app_id = resData[i].attributes.app_id;
|
|
|
obj.app_name = resData[i].attributes.app_name;
|
|
|
- if (obj.entity_id && obj.state && checkState(obj.state) && obj.friendly_name && obj.domain) {
|
|
|
+ if (obj.entity_id && obj.state && obj.state == "playing" && obj.friendly_name && obj.domain) {
|
|
|
listMitvMediaPlayerTemp.push(obj);
|
|
|
}
|
|
|
obj.friendly_name1 = resData[i].attributes.friendly_name;
|
|
|
@@ -3585,7 +3599,7 @@ Page({
|
|
|
obj.device_class = resData[i].attributes.device_class;
|
|
|
obj.app_id = resData[i].attributes.app_id;
|
|
|
obj.app_name = resData[i].attributes.app_name;
|
|
|
- if (obj.entity_id && obj.state && checkState(obj.state) && obj.friendly_name && obj.domain) {
|
|
|
+ if (obj.entity_id && obj.state && obj.state == "playing" && obj.friendly_name && obj.domain) {
|
|
|
listMitvMediaPlayerTemp.push(obj);
|
|
|
}
|
|
|
obj.friendly_name1 = resData[i].attributes.friendly_name;
|