6.21提交

This commit is contained in:
zoujiandong
2025-06-21 17:43:26 +08:00
parent ce9158a8a0
commit 8f4ee464dc
7 changed files with 990 additions and 844 deletions
+47 -3
View File
@@ -11,6 +11,26 @@ Component({
});
},
},
paintFrom:{
type: String,
value:'',
observer(newval) {
this.setData({
paintFrom: newval
});
},
},
paintSrc:{
type: String,
value:'',
observer(newval) {
this.setData({
paintSrc: newval
});
this.initData();
},
}
},
ready(){
@@ -34,6 +54,7 @@ Component({
*/
data: {
showPaint:false,
paintFrom:'',
hasChoosedImg: false,
canvasWidth: 0,
showBars: false,
@@ -74,6 +95,29 @@ Component({
scope: false, // 是否有保存图片的权限
},
methods:{
initData(){
let that=this;
that.setData({
hasChoosedImg: true,
})
wx.getImageInfo({
src: this.data.paintSrc,
success: function (res) {
// 获取图片信息,主要为宽高,选择合适的自适应方式(将最大边完整显示)
console.log(res)
let [height, width] = [that.data.canvasWidth / res.width * res.height, that.data.canvasWidth];
if (height > that.data.windowHeight - 50) {
height = that.data.windowHeight - 50;
width = height / res.height * res.width;
}
that.setData({
canvasHeight: height,
canvasWidth: width,
background: res.path
});
}
})
},
hideTuya(){
this.setData({
showPaint:false,
@@ -93,7 +137,7 @@ Component({
// this.triggerEvent('confirmUpload')
// },
tapBtn: function (e) {
utils.tapBtn(e, this, 2);
utils.tapBtn(e, this, 2,this.data.paintFrom);
},
showBarsHandler(e) {
//this.tapBtn(e)
@@ -130,7 +174,7 @@ Component({
chooseImg() {
let that = this;
wx.chooseImage({
count:1,
count:1,
success: function (res) {
that.setData({
hasChoosedImg: true,
@@ -189,7 +233,7 @@ Component({
this.setData({
prevPosition: [e.touches[0].x, e.touches[0].y]
})
console.log(11111)
},
clearCanvas: function (e) {
+1 -1
View File
@@ -1,6 +1,6 @@
<!--painting-2.wxml-->
<van-overlay show="{{showPaint}}" z-index="99999999" >
<view class="upage" style="position:reltive;background-color: #000;height:100vh;" catch:tap="hideBarsHandler" >
<view class="upage" style="position:reltive;background-color: #000;height:100vh;" catch:tap="hideBarsHandler" wx:if="{{showPaint}}" >
<!-- <view class="ui-navigatorbar myclass colorCalss" >
<van-icon name="arrow-left" bindtap="hideTuya"
color="#fff"