|
@@ -31,12 +31,36 @@ Page({
|
|
nvabarData: {
|
|
nvabarData: {
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
title: '壁纸设置', //导航栏 中间的标题
|
|
title: '壁纸设置', //导航栏 中间的标题
|
|
|
|
+ callback() {
|
|
|
|
+ if (_imageBuffer) {
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '保存图片中,确定要中断退出吗?',
|
|
|
|
+ content: '',
|
|
|
|
+ complete: (res) => {
|
|
|
|
+ if (res.cancel) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ BtHelper.getInstance().endImage(0)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ wx.navigateBack({
|
|
|
|
+ delta: 1,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
},
|
|
},
|
|
src: '',
|
|
src: '',
|
|
showCrop: false,
|
|
showCrop: false,
|
|
width: 250,//宽度
|
|
width: 250,//宽度
|
|
height: 250,//高度
|
|
height: 250,//高度
|
|
_imageBuffer: null,
|
|
_imageBuffer: null,
|
|
|
|
+ progressPercent: 60,
|
|
|
|
+ intervalId: 60,
|
|
|
|
|
|
}, footerTap() {
|
|
}, footerTap() {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -50,10 +74,29 @@ Page({
|
|
console.log(res.tempFiles[0].tempFilePath)
|
|
console.log(res.tempFiles[0].tempFilePath)
|
|
console.log(res.tempFiles[0].size)
|
|
console.log(res.tempFiles[0].size)
|
|
|
|
|
|
- that.setData({
|
|
|
|
- imageSrc: res.tempFiles[0].tempFilePath, // 图片路径
|
|
|
|
- showCrop: true
|
|
|
|
|
|
+ // that.setData({
|
|
|
|
+ // imageSrc: res.tempFiles[0].tempFilePath, // 图片路径
|
|
|
|
+ // showCrop: true
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ // wx.editImage({
|
|
|
|
+ // src: res.tempFiles[0].tempFilePath, // 图片路径
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ wx.getImageInfo({
|
|
|
|
+ src: res.tempFiles[0].tempFilePath,
|
|
|
|
+ success(res) {
|
|
|
|
+ console.log(res)
|
|
|
|
+ wx.cropImage({
|
|
|
|
+ src: res.path,// 图片路径
|
|
|
|
+ cropScale: '1:1', // 裁剪比例
|
|
|
|
+ success(res) {
|
|
|
|
+ console.log(res)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -145,9 +188,28 @@ Page({
|
|
},
|
|
},
|
|
sendImage(imageBuffer) {
|
|
sendImage(imageBuffer) {
|
|
let chunkSize = 20;
|
|
let chunkSize = 20;
|
|
|
|
+ let _this = this
|
|
|
|
+ let progress = 0;
|
|
|
|
+
|
|
|
|
+ _this.setData({
|
|
|
|
+ progress: 0,
|
|
|
|
+ progressPercent: 0
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 定时器,每100毫秒执行一次
|
|
|
|
+ _this.intervalId = setInterval(function () {
|
|
|
|
+ if (progress >= 100) {
|
|
|
|
+ clearInterval(_this.intervalId); // 停止定时器
|
|
|
|
+ } else {
|
|
|
|
+ progress += 1; // 每次增加1%
|
|
|
|
+ _this.setData({
|
|
|
|
+ progressPercent: progress
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 100);
|
|
|
|
+
|
|
for (let i = 0; i < imageBuffer.length; i += chunkSize) {
|
|
for (let i = 0; i < imageBuffer.length; i += chunkSize) {
|
|
const chunk = imageBuffer.slice(i, i + chunkSize);
|
|
const chunk = imageBuffer.slice(i, i + chunkSize);
|
|
- // this.sendImage(chunk);
|
|
|
|
BtHelper.wallPaperData(chunk)
|
|
BtHelper.wallPaperData(chunk)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -172,7 +234,7 @@ Page({
|
|
let kind = event.kind;
|
|
let kind = event.kind;
|
|
if (otaCmd === 1 && kind == 1) {
|
|
if (otaCmd === 1 && kind == 1) {
|
|
// 开始发送
|
|
// 开始发送
|
|
- _this.sendOtaData()
|
|
|
|
|
|
+ _this.sendImage()
|
|
} else if (otaCmd === 0 && kind == 1) {
|
|
} else if (otaCmd === 0 && kind == 1) {
|
|
// 发送结束
|
|
// 发送结束
|
|
_this.endEnd()
|
|
_this.endEnd()
|