share-btns.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. const { getQrcode } = require('../../utils/API.js')
  2. //Component Object
  3. Component({
  4. options: {
  5. multipleSlots: true
  6. },
  7. properties: {
  8. posterInfo: {
  9. type: Object,
  10. value: {}
  11. }
  12. },
  13. data: {
  14. actionSheetState: false
  15. },
  16. methods: {
  17. openActionSheet: function () {
  18. this.setData({
  19. actionSheetState: true
  20. })
  21. },
  22. closeActionSheet: function () {
  23. this.setData({
  24. actionSheetState: false
  25. })
  26. },
  27. toSharePoster: function() {
  28. let that = this
  29. let { id, scene, path, title, count, imageUrl, time } = this.data.posterInfo
  30. getQrcode('/user/genwxacode', {
  31. lottery_id: id,
  32. scene,
  33. page: path,
  34. is_hyaline: 1,
  35. width: 320
  36. }).then(result => {
  37. wx.showLoading({
  38. title: '生成中,请稍等',
  39. mask: true
  40. })
  41. wx.setStorage({
  42. key: 'POSTER_INFO',
  43. data: {
  44. qrcode: result.data,
  45. title: title + ' x ' + count,
  46. imageUrl,
  47. time
  48. },
  49. success: function() {
  50. wx.hideLoading()
  51. wx.navigateTo({
  52. url: '/pages/share-poster/share-poster',
  53. })
  54. }
  55. })
  56. }).catch(err => {
  57. wx.showToast({
  58. title: '生成失败:' + err.msg,
  59. icon: 'none'
  60. })
  61. })
  62. },
  63. joinOthers: function() {
  64. wx.switchTab({
  65. url: '/pages/index/index',
  66. })
  67. }
  68. }
  69. })