index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // pages/meeting/transfer/index.js
  2. import {
  3. turnUsername,
  4. turnMeetingSubmit
  5. } from '../../../utils/api/meeting'
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. appletUsername: '',
  12. userMsg: {},
  13. },
  14. preview(event) {
  15. let currentUrl = event.currentTarget.dataset.src
  16. wx.previewImage({
  17. current: currentUrl, // 当前显示图片的http链接
  18. urls: [currentUrl] // 需要预览的图片http链接列表
  19. })
  20. },
  21. getValue(e) {
  22. this.setData({
  23. appletUsername: e.detail.value
  24. });
  25. if (e.detail.value) {
  26. this.turnUsername()
  27. }
  28. },
  29. turnUsername() {
  30. let {
  31. appletUsername
  32. } = this.data
  33. turnUsername({
  34. appletUsername: appletUsername
  35. }).then(res => {
  36. this.setData({
  37. userMsg: res.data
  38. })
  39. })
  40. },
  41. submit() {
  42. let data = {
  43. userId: this.data.userMsg.userId,
  44. meetingRecordId: this.data.item.meetingRecordId,
  45. }
  46. wx.requestSubscribeMessage({
  47. tmplIds: ['mJs6TXjIFuwgPu2JOEIpu3lO9ym9rnai-schUPuLuok'],
  48. success(res) {
  49. turnMeetingSubmit(data).then(res => {
  50. wx.showToast({
  51. title: '操作成功',
  52. icon: 'none',
  53. duration: 800,
  54. mask: true,
  55. success: function () {
  56. setTimeout(function () {
  57. wx.switchTab({
  58. url: '/pages/home/home',
  59. })
  60. }, 800)
  61. }
  62. })
  63. })
  64. }
  65. })
  66. },
  67. /**
  68. * 生命周期函数--监听页面加载
  69. */
  70. onLoad(options) {
  71. if (options.item) {
  72. this.setData({
  73. item: JSON.parse(options.item)
  74. })
  75. }
  76. },
  77. /**
  78. * 生命周期函数--监听页面初次渲染完成
  79. */
  80. onReady() {
  81. },
  82. /**
  83. * 生命周期函数--监听页面显示
  84. */
  85. onShow() {
  86. },
  87. /**
  88. * 生命周期函数--监听页面隐藏
  89. */
  90. onHide() {
  91. },
  92. /**
  93. * 生命周期函数--监听页面卸载
  94. */
  95. onUnload() {
  96. },
  97. /**
  98. * 页面相关事件处理函数--监听用户下拉动作
  99. */
  100. onPullDownRefresh() {
  101. },
  102. /**
  103. * 页面上拉触底事件的处理函数
  104. */
  105. onReachBottom() {
  106. },
  107. /**
  108. * 用户点击右上角分享
  109. */
  110. onShareAppMessage() {
  111. }
  112. })