104 lines
1.9 KiB
JavaScript
104 lines
1.9 KiB
JavaScript
// pages/share/share.js
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
imgPath: '',
|
|
imgData: {
|
|
background: '#eee',
|
|
width: '654rpx',
|
|
height: '400rpx',
|
|
borderRadius: '20rpx',
|
|
views: [
|
|
{
|
|
type: 'image',
|
|
url:
|
|
'https://qhyxpicoss.kujiale.com/r/2017/12/04/L3D123I45VHNYULVSAEYCV3P3X6888_3200x2400.jpg@!70q',
|
|
css: {
|
|
top: '48rpx',
|
|
right: '48rpx',
|
|
width: '192rpx',
|
|
height: '192rpx',
|
|
},
|
|
},
|
|
{
|
|
type: 'text',
|
|
text: 'borderWidth',
|
|
css: {
|
|
bottom: '40rpx',
|
|
right: '200rpx',
|
|
color: 'green',
|
|
borderWidth: '2rpx',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
|
|
onImgOK(e) {
|
|
console.log('img:')
|
|
console.log(e.detail.path)
|
|
this.setData({
|
|
imgPath: e.detail.path
|
|
})
|
|
},
|
|
|
|
onImgErr(err) {
|
|
console.log(err)
|
|
},
|
|
|
|
saveImage() {
|
|
console.log('???')
|
|
wx.saveImageToPhotosAlbum({
|
|
filePath: this.data.imgPath,
|
|
success:function() {
|
|
console.log('成功保存')
|
|
},
|
|
fail: function(err) {
|
|
console.log(err)
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {},
|
|
})
|