index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // nova-tourism/pages/my/my-order/my-refund/refund-detail/index.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. statusBarHeight: 0,
  8. screenHeight: 0,
  9. customHeight: 0,
  10. bottomNavHeight: 0,
  11. contentHeight: 0,
  12. text: '',
  13. // 图片
  14. fileList: [],
  15. uptokenURL: '',
  16. domain: '',
  17. uploadURL: '',
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. const systemInfo = wx.getSystemInfoSync();
  24. const statusBarHeight = systemInfo.statusBarHeight || 0;
  25. const screenHeight = systemInfo.screenHeight || 0;
  26. const custom = wx.getMenuButtonBoundingClientRect();
  27. const customHeight = custom.height + 10 + 2 || 0;
  28. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  29. const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  30. this.setData({
  31. statusBarHeight,
  32. screenHeight,
  33. customHeight,
  34. bottomNavHeight,
  35. contentHeight
  36. });
  37. },
  38. /**
  39. * 生命周期函数--监听页面初次渲染完成
  40. */
  41. onReady: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面显示
  45. */
  46. onShow: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面隐藏
  50. */
  51. onHide: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面卸载
  55. */
  56. onUnload: function () {
  57. },
  58. /**
  59. * 页面相关事件处理函数--监听用户下拉动作
  60. */
  61. onPullDownRefresh: function () {
  62. },
  63. /**
  64. * 页面上拉触底事件的处理函数
  65. */
  66. onReachBottom: function () {
  67. },
  68. /**
  69. * 用户点击右上角分享
  70. */
  71. onShareAppMessage: function () {
  72. },
  73. // 添加本地图片
  74. async getUptoken() {
  75. let res = await Parse.Cloud.run('qiniu_uptoken', {
  76. company: company
  77. })
  78. this.setData({
  79. uptokenURL: res.uptoken,
  80. domain: res.domain,
  81. uploadURL: res.zoneUrl
  82. })
  83. console.log(this.data.uptokenURL, this.data.domain, this.data.uploadURL);
  84. },
  85. //获取图片数组
  86. picture(event) {
  87. console.log('event', event);
  88. let FileList = event.detail
  89. let url = []
  90. for (let i = 0; i < FileList.length; i++) {
  91. url.push(FileList[i].url)
  92. }
  93. this.setData({
  94. fileList: url
  95. })
  96. console.log('图片', this.data.fileList);
  97. },
  98. })