made.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // pages/customized/made/made.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. dataPositionObj:{
  8. top:'156rpx',
  9. left:'286rpx',
  10. // width:'100rpx',
  11. },
  12. propSize:{
  13. top:'8cm',
  14. right:'8cm',
  15. bottom: '8cm',
  16. left:'8cm',
  17. },
  18. obverseImg: '/images/customized/cup_black_big.png',/*正面 */
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. console.log(this.data.obverseImg,"dd")
  25. let canvasBg = this.data.obverseImg;
  26. wx.getSystemInfo({
  27. success: function (res) {
  28. let rpx = res.windowWidth / 750;
  29. console.log(res.windowWidth)
  30. const ctx = wx.createCanvasContext('madeContent');
  31. ctx.drawImage(canvasBg, 0, 0, 750 * rpx, 588 * rpx)
  32. ctx.draw()
  33. },
  34. })
  35. },
  36. /**
  37. * 生命周期函数--监听页面初次渲染完成
  38. */
  39. onReady: function () {
  40. // console.log('页面开始准备中')
  41. const ctx = wx.createCanvasContext('madeBox');
  42. // Canvas.SetLeft(ctx, '10rpx');
  43. },
  44. /**
  45. * 生命周期函数--监听页面显示
  46. */
  47. onShow: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面隐藏
  51. */
  52. onHide: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function () {
  58. },
  59. /**
  60. * 页面相关事件处理函数--监听用户下拉动作
  61. */
  62. onPullDownRefresh: function () {
  63. },
  64. /**
  65. * 页面上拉触底事件的处理函数
  66. */
  67. onReachBottom: function () {
  68. },
  69. /**
  70. * 用户点击右上角分享
  71. */
  72. onShareAppMessage: function () {
  73. }
  74. })