first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,162 @@
// user/sharingCourtesy/sharingCourtesy.js
const app = getApp();
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
Page({
/**
* 页面的初始数据
*/
data: {
system: app.globalData.system, //设备相关信息
pageTitle: "分享有礼", //头部标题
isBack: true,//显示返回
isTips: false,//弹出窗口
fileName: "",//图片地址
},
// 保存图片
/**
* 获取canvas外围view宽高,然后把通过计算图片在canvas中的位置,最后绘制到canvas中
* 如果用户同意授权时在调用canvasToTempFilePath把canvas中的内容生成图片,再通过saveImageToPhotosAlbum方法
* 把图片保存的用户相册
*/
async preservationImg() {
var that = this
wx.previewImage({
current: that.data.fileName, // 当前显示图片的http链接
urls: [that.data.fileName] // 需要预览的图片http链接列表
})
// let album = await model.getauth.albumAuthorization()
// this.tips()
// // 获取外节点信息把宽高赋给需要绘制的图片
// wx.createSelectorQuery().select('.share_img_con_b').fields({
// dataset: true,
// size: true,
// scrollOffset: true,
// properties: ['scrollX', 'scrollY']
// }, function (res) {
// var ctx = wx.createCanvasContext('testCanvas');
// ctx.drawImage('/static/img/15639450.png', 0, 0, res.width, res.height);
// ctx.drawImage(that.data.fileName, (res.width) / 2 - 77, (res.height) * 0.74 - 77, 154, 154);
// ctx.draw();
// }).exec()
// // 用户同意授权
// if (album == "ok") {
// setTimeout(() => {
// // 生成图片
// wx.canvasToTempFilePath({
// canvasId: 'testCanvas',
// fileType: 'jpg',
// success: function (res) {
// // 保存图片
// wx.saveImageToPhotosAlbum({
// filePath: res.tempFilePath,
// success(res) {
// wx.showToast({
// title: '保存成功',
// icon: 'none',
// duration: 2000
// });
// },
// fail() {
// wx.hideLoading()
// }
// })
// }
// })
// }, 500)
// return
// } else {
// wx.showModal({
// title: '你拒绝了授权',
// content: '是否打开权限表重新授权',
// success(res) {
// if (res.confirm) {
// wx.openSetting()
// }
// }
// })
// }
// 用户取消授权时,提示用户自主截图
// wx.showToast({
// title: '您已取消授权请自主截屏保存二维码',
// icon: 'none',
// duration: 2000
// })
},
// 弹窗
tips() {
this.setData({
isTips: !this.data.isTips
})
},
// 获取二维码图片
/**
* 获取获取全局唯一的文件管理器,然后把拿到的小程序二维码去掉空格去掉转移字符串
* 然后转换成二进制编码,使用writeFileSync方法把图片临时存到本地
*/
getCode() {
var that = this
http.http.request2({ url: `${http.api.getWxaqrCode}`, method: "POST", data: { path: "/pages/startUp/startUp" } })
.then(res => {
that.setData({
fileName: res.data.data
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getCode()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})