From 63b253e0cf577c15a8f9638932cf47f08b0fdd50 Mon Sep 17 00:00:00 2001 From: song Date: Fri, 28 Jan 2022 16:10:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(WiFi=E4=BF=AE=E5=A4=8D):=20WiFi=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/components/Wifi/Wifi.vue | 7 +++ .../Evaluated/components/ProcessRestore.vue | 62 ++++++++++++------- .../wifi-binding/wifi-binding.vue | 4 +- 4 files changed, 48 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fd4818..21e0087 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ - | 日历定位;合并 | [ea3f937](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/ea3f937) - | 删除项目 | [00b886c](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/00b886c) - | 上传逻辑变化 | [3ff1dc2](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/3ff1dc2) + - | 上传正式版本 | [5539485](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/5539485) - | 设置界面基本信息板块开发 | [bbaded0](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/bbaded0) - | 设置小红点 | [9316bcb](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/9316bcb) - | 升级版本v3.1.0;tailwindcss添加class | [9ef05e1](https://101.201.226.163:50022/DIGITAL_MEDICAL/yanyuan/commits/9ef05e1) diff --git a/src/components/Wifi/Wifi.vue b/src/components/Wifi/Wifi.vue index ef9ca4e..2090d8b 100644 --- a/src/components/Wifi/Wifi.vue +++ b/src/components/Wifi/Wifi.vue @@ -23,6 +23,7 @@ export default { onLoad() {}, methods: { sendTCP() { + // this.$t.ui.showLoading('发送中...'); console.log('发送'); if (!this.tcp) { this.tcp = wx.createTCPSocket(); @@ -34,8 +35,11 @@ export default { }); console.log('链接this.tcp', this.tcp); this.tcp.write(`#${this.name}:${this.password}$`); + this.tcp.write(`#${this.name}:${this.password}$`); console.log('write-this.tcp', this.tcp); + this.tcp.onMessage((message, remoteInfo, localInfo) => { + // this.$t.ui.hideLoading(); console.log(message, remoteInfo, localInfo); // 如果成功,关掉 tcp 返回上一页 // this.tcp = null; @@ -45,6 +49,9 @@ export default { this.$t.page.openPage('/pagesYanyuan/hold-all/hold-all'); } }); + // setTimeout(() => { + // this.$t.ui.hideLoading(); + // }, 10000); }, }, }; diff --git a/src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue b/src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue index 1a71d3f..e473ea0 100644 --- a/src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue +++ b/src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue @@ -64,11 +64,10 @@ export default { context.drawImage(res.tempFilePath, 0, 0, width, 450); context.draw(true); // 绘制路径 - // points.forEach(item => { - // that.drawPath(item, width); - // }); - console.log('points: ', points); - that.drawPath(points, width); + const arr = that.setPoints(points); + arr.forEach(item => { + that.drawPath(item, width); + }); }, fail(error) { console.error('图片加载失败:', error); @@ -84,24 +83,26 @@ export default { const data = this.generatePathData(str); const ctx = this.context; - this.timers.push( - setTimeout(() => { - if (!this.trainResult.points || this.trainResult.points.length === 0) { - return; - } - ctx.beginPath(); - ctx.setLineWidth(3); - ctx.setStrokeStyle('#1890ff'); - const x = (+data[0][0] * width) / 155; - const y = (+data[0][1] * 450) / 194; - ctx.moveTo(x, y); - if (data.length === 1) { - // 如果只有1个点 就画个小圆圈 - ctx.arc(x, y, 2, 0, Math.PI * 2, false); - ctx.fill(); - } - }, +data[0][2]), - ); + if (data[0][3] === 1) { + this.timers.push( + setTimeout(() => { + if (!this.trainResult.points || this.trainResult.points.length === 0) { + return; + } + ctx.beginPath(); + ctx.setLineWidth(3); + ctx.setStrokeStyle('#1890ff'); + const x = (+data[0][0] * width) / 155; + const y = (+data[0][1] * 450) / 194; + ctx.moveTo(x, y); + if (data.length === 1) { + // 如果只有1个点 就画个小圆圈 + ctx.arc(x, y, 2, 0, Math.PI * 2, false); + ctx.fill(); + } + }, +data[0][2]), + ); + } for (let i = 1, len = data.length; i < len; i++) { if (!this.trainResult.points || this.trainResult.points.length === 0) return; @@ -120,7 +121,6 @@ export default { ctx.stroke(); ctx.draw(true); } - ctx.closePath(); // }, +data[i][2]), }, this.getIntervalTime(+data[i][2], +str.operateTime, +data[0][2])), @@ -158,6 +158,20 @@ export default { return time; }, + // 处理返回得points + setPoints(points) { + if (!points || !points.length) return; + let result = []; + points.forEach(point => { + if (point.sign === 1) { + result.push([point]); + } else { + result[result.length - 1].push(point); + } + }); + return result; + }, + /** * 生成绘制每段路径的数据 * @param {string} str 每条路径的数据"x,y,time;x,y,time" diff --git a/src/pagesYanyuan/wifi-binding/wifi-binding.vue b/src/pagesYanyuan/wifi-binding/wifi-binding.vue index 5871f15..4310fd0 100644 --- a/src/pagesYanyuan/wifi-binding/wifi-binding.vue +++ b/src/pagesYanyuan/wifi-binding/wifi-binding.vue @@ -18,8 +18,8 @@ 联网说明: 1.长按点读笔,进入配网模式 - 2.切换手机wifi,连接ccsens_pen - 3.输入wifi名和密码,点击配置 + 2.切换手机wifi,连接ccsens_pen,输入密码ccsens123 + 3.输入wifi名和密码,点击确定 4.配网成功后,点读笔有灯闪烁