establish.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // pages/mine/wxml/establish/establish.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. textareaVal:''
  9. },
  10. //上传
  11. formSubmit: function(e) {
  12. var _this = this;
  13. var auction_way = "";
  14. if (e.detail.value.name !== "" && _this.data.textareaVal !== '') {
  15. wx.request({
  16. url: app.globalData.prodUrl + 'web-pm/wx/pm/create_live_room',
  17. header: {
  18. 'ydw-token': wx.getStorageSync('key').ydw_token
  19. },
  20. data: {
  21. name: e.detail.value.name,
  22. content: _this.data.textareaVal,
  23. },
  24. success: function(data) {
  25. //console.log(data)
  26. if (data.data.success) {
  27. wx.showToast({
  28. title: '上传拍卖会成功!',
  29. icon: 'none',
  30. duration: 3000,
  31. success: function () {
  32. setTimeout(function () {
  33. wx.navigateBack({
  34. delta: 1,
  35. success: function () {
  36. }
  37. });
  38. }, 2000)
  39. }
  40. });
  41. }
  42. }
  43. })
  44. } else {
  45. if (e.detail.value.name == "") {
  46. wx.showToast({
  47. title: '拍卖会名称不得为空!',
  48. icon: 'none',
  49. duration: 2000
  50. })
  51. } else if (_this.data.textareaVal == '') {
  52. wx.showToast({
  53. title: '拍卖会描述不得为空!',
  54. icon: 'none',
  55. duration: 2000
  56. })
  57. }
  58. }
  59. },
  60. /**
  61. * 生命周期函数--监听页面加载
  62. */
  63. onLoad: function(options) {
  64. //console.log(options)
  65. var _this =this
  66. wx.request({
  67. url: app.globalData.prodUrl + 'web-pm/wx/pm/get_live_room',
  68. header: {
  69. 'ydw-token': wx.getStorageSync('key').ydw_token
  70. },
  71. data: {
  72. live_room_id: options.kid
  73. },
  74. success: function (data) {
  75. //console.log(data.data.liveroom)
  76. },
  77. });
  78. },
  79. bindTextAreaBlur: function (e) {
  80. this.setData({
  81. textareaVal: e.detail.value
  82. })
  83. },
  84. /**
  85. * 生命周期函数--监听页面初次渲染完成
  86. */
  87. onReady: function() {
  88. },
  89. /**
  90. * 生命周期函数--监听页面显示
  91. */
  92. onShow: function() {
  93. },
  94. /**
  95. * 生命周期函数--监听页面隐藏
  96. */
  97. onHide: function() {
  98. },
  99. /**
  100. * 生命周期函数--监听页面卸载
  101. */
  102. onUnload: function() {
  103. },
  104. /**
  105. * 页面相关事件处理函数--监听用户下拉动作
  106. */
  107. onPullDownRefresh: function() {
  108. },
  109. /**
  110. * 页面上拉触底事件的处理函数
  111. */
  112. onReachBottom: function() {
  113. }
  114. })