|
@@ -4,6 +4,7 @@ const { BtCmd } = require('../../../devices/bluetooth/bt_cmd');
|
|
|
import EventManager from '../../../utils/event_bus'
|
|
|
import { EnumCmdEvent, CmdEvent } from '../../../devices/cmd_key_event';
|
|
|
import js_md5 from '../../../utils/js_md5';
|
|
|
+import store from '../../../utils/store';
|
|
|
const { BtHelper } = require('../../../devices/bt_helper');
|
|
|
|
|
|
Page({
|
|
@@ -132,7 +133,7 @@ Page({
|
|
|
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
- console.error('读取 .bin 文件失败:', err);
|
|
|
+ console.error('读取 .bin 文件失败2:', err);
|
|
|
},
|
|
|
});
|
|
|
// 651kb的
|
|
@@ -171,7 +172,8 @@ Page({
|
|
|
})
|
|
|
// app.globalData.imgSrc = obj.url;
|
|
|
console.log("裁剪壁纸:", res);
|
|
|
- _this.data._imgUrl = _this.data._imgTopPic ?? res.url
|
|
|
+ _this.data._imgUrl = res.url
|
|
|
+ _this.data._imgTopPic = res.url
|
|
|
fs.readFile({
|
|
|
filePath: _this.data._imgUrl,
|
|
|
encoding: '', // 不指定编码以获取原始二进制数据
|
|
@@ -213,6 +215,11 @@ Page({
|
|
|
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
+ s
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.showToast({
|
|
|
+ title: '读取该图片失败',
|
|
|
+ })
|
|
|
console.error('读取 .bin 文件失败:', err);
|
|
|
},
|
|
|
});
|
|
@@ -418,7 +425,7 @@ Page({
|
|
|
successSend() {
|
|
|
let _this = this
|
|
|
wx.showModal({
|
|
|
- title: '上传壁纸成功',
|
|
|
+ title: '保存壁纸成功',
|
|
|
showCancel: false,
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
@@ -426,7 +433,7 @@ Page({
|
|
|
// 获取上一级页面实例
|
|
|
const prevPage = pages[pages.length - 2];
|
|
|
// 传递参数
|
|
|
- prevPage.updateTopImg(_this.data._imgUrl)
|
|
|
+ prevPage.updateTopImg(_this.data._imgTopPic)
|
|
|
wx.navigateBack({
|
|
|
delta: 1,
|
|
|
})
|
|
@@ -468,6 +475,26 @@ Page({
|
|
|
});
|
|
|
that.data._imgTopPic = image.pic
|
|
|
},
|
|
|
+ disconnect(event) {
|
|
|
+ let _this = this;
|
|
|
+ console.log("断开连接", event.commonValue, event.deviceId);
|
|
|
+ if (event.commonValue === "offline") {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '设备断开连接,请重新连接设备',
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 设备断开连接,请重新连接设备
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
@@ -496,6 +523,9 @@ Page({
|
|
|
console.log("裁剪页:", name, value, kind)
|
|
|
|
|
|
switch (name) {
|
|
|
+ case EnumCmdEvent.onoffline:
|
|
|
+ _this.disconnect(event)
|
|
|
+ break;
|
|
|
case EnumCmdEvent.wallpaper:
|
|
|
//0x78
|
|
|
// 小程序:0x78, 1。 开启壁纸
|