50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
// packagecard/common/corpperimg/cropperimg.js
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
imgSrc: '',
|
|
scale: 1
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
imgSrc: options.imgSrc,
|
|
scale: options.scale
|
|
})
|
|
console.log(this.data.scale)
|
|
},
|
|
cropperDone(e) {
|
|
const {
|
|
src,
|
|
cropperData
|
|
} = e.detail;
|
|
let arr = getCurrentPages()
|
|
let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined
|
|
lastPage.setData({
|
|
imgTempSrc: src
|
|
})
|
|
},
|
|
|
|
cropperCancel() {
|
|
wx.navigateBack({})
|
|
},
|
|
|
|
cropperFail(e) {
|
|
const err = e.detail;
|
|
console.log(e);
|
|
wx.showToast({
|
|
title: '裁剪失败,请重试',
|
|
icon: 'none',
|
|
success() {
|
|
wx.navigateBack({})
|
|
}
|
|
})
|
|
}
|
|
}) |