From 813604a4c48c274794c0a344aed63cf8f4389e54 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Thu, 9 Mar 2023 09:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E4=BD=8D=E8=AF=B7=E6=B1=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/package/pointsStatus/pointsStatus.js | 25 ++++++++++++---------- weapp/utils/getApiUrl.js | 3 +++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/weapp/package/pointsStatus/pointsStatus.js b/weapp/package/pointsStatus/pointsStatus.js index d83b990..ab85df9 100644 --- a/weapp/package/pointsStatus/pointsStatus.js +++ b/weapp/package/pointsStatus/pointsStatus.js @@ -1,5 +1,5 @@ // package/pointsStatus/pointsStatus.js -import { getProjectGraph, getDeployPoints } from "../../utils/getApiUrl"; +import { getProjectGraph, getDeployPoints, getProjectPoints } from "../../utils/getApiUrl"; import { Request } from "../../common"; Page({ @@ -19,21 +19,24 @@ Page({ wx.showLoading({ title: '加载中...' }); Request.get(getProjectGraph(projectId)).then(res => { if (res) { - Request.get(getDeployPoints(res.id)).then(pointsRes => { - that.setData({ - image: res.graph, - allPoints: pointsRes.allPoints, - setedPoints: pointsRes.setedPoints.map(p => ({ - ...p, - position: JSON.parse(p.position), - pointInfo: pointsRes.allPoints.find(a => a.id === p.pointId), - })), + Request.get(getDeployPoints(res.id)).then(deployPointsRes => { + Request.get(getProjectPoints(projectId)).then(allPointRes => { + wx.hideLoading(); + that.setData({ + image: res.graph, + allPoints: allPointRes, + setedPoints: deployPointsRes.map(p => ({ + ...p, + position: JSON.parse(p.position), + pointInfo: allPointRes.find(a => a.id === p.pointId), + })), + }) }) }) } else { + wx.hideLoading(); // 未布设 } - wx.hideLoading() }) }, diff --git a/weapp/utils/getApiUrl.js b/weapp/utils/getApiUrl.js index 002c778..1e61553 100644 --- a/weapp/utils/getApiUrl.js +++ b/weapp/utils/getApiUrl.js @@ -20,6 +20,9 @@ exports.getProjectGraph = (projectId) => { exports.getDeployPoints = (pictureId) => { return `/picture/${pictureId}/deploy/points` } +exports.getProjectPoints = (projectId) => { + return `/project/${projectId}/all/points` +} // 获取巡检计划 exports.getPatrolPlan = () => {