index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. getValue(e) {
  15. this.setData({
  16. appletUsername: e.detail.value
  17. });
  18. if(e.detail.value){
  19. this.turnUsername()
  20. }
  21. },
  22. turnUsername() {
  23. let {
  24. appletUsername
  25. } = this.data
  26. turnUsername({
  27. appletUsername: appletUsername
  28. }).then(res => {
  29. this.setData({
  30. userMsg: res.data
  31. })
  32. })
  33. },
  34. submit() {
  35. let data = {
  36. userId: this.data.userMsg.userId,
  37. meetingRecordId: this.data.item.meetingRecordId,
  38. }
  39. wx.requestSubscribeMessage({
  40. tmplIds: ['mJs6TXjIFuwgPu2JOEIpu3lO9ym9rnai-schUPuLuok'],
  41. success(res) {
  42. turnMeetingSubmit(data).then(res => {
  43. wx.showToast({
  44. title: '操作成功',
  45. icon: 'none',
  46. duration: 800,
  47. mask: true,
  48. success: function () {
  49. setTimeout(function () {
  50. wx.switchTab({
  51. url: '/pages/home/home',
  52. })
  53. }, 800)
  54. }
  55. })
  56. })
  57. }
  58. })
  59. },
  60. /**
  61. * 生命周期函数--监听页面加载
  62. */
  63. onLoad(options) {
  64. if (options.item) {
  65. this.setData({
  66. item: JSON.parse(options.item)
  67. })
  68. }
  69. },
  70. /**
  71. * 生命周期函数--监听页面初次渲染完成
  72. */
  73. onReady() {
  74. },
  75. /**
  76. * 生命周期函数--监听页面显示
  77. */
  78. onShow() {
  79. },
  80. /**
  81. * 生命周期函数--监听页面隐藏
  82. */
  83. onHide() {
  84. },
  85. /**
  86. * 生命周期函数--监听页面卸载
  87. */
  88. onUnload() {
  89. },
  90. /**
  91. * 页面相关事件处理函数--监听用户下拉动作
  92. */
  93. onPullDownRefresh() {
  94. },
  95. /**
  96. * 页面上拉触底事件的处理函数
  97. */
  98. onReachBottom() {
  99. },
  100. /**
  101. * 用户点击右上角分享
  102. */
  103. onShareAppMessage() {
  104. }
  105. })