myInteractions.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. const app = require('../../utils/util.js');
  2. const tools = require('../../utils/tools.js');
  3. Page({
  4. data: {
  5. isshow1: false,
  6. isshow2: true,
  7. activebg: "#ffeae9",
  8. unactivebg: "#f2f2f2",
  9. mytip: "",
  10. listArr: []
  11. },
  12. // tab1
  13. tab1Show() {
  14. this.setData({
  15. isshow1: false,
  16. isshow2: true,
  17. activebg: "#ffeae9",
  18. unactivebg: "#f2f2f2"
  19. })
  20. },
  21. //tab2
  22. async tab2Show() {
  23. const sessionKey = await tools.checkSessionAndLogin();
  24. wx.request({
  25. url: app.globalData.publicUrl + '/wx/board/list',
  26. method: "post",
  27. data: {
  28. sessionKey: sessionKey
  29. },
  30. success: (res) => {
  31. if (res.data.code == 0) {
  32. if (res.data.list.length == 0) {
  33. wx.showModal({
  34. showCancel: false,
  35. content: "您还没有提问哦"
  36. })
  37. } else {
  38. this.setData({
  39. listArr: res.data.list,
  40. isshow1: true,
  41. isshow2: false,
  42. activebg: "#f2f2f2",
  43. unactivebg: "#ffeae9"
  44. })
  45. }
  46. } else {
  47. wx.showModal({
  48. showCancel: false,
  49. content: "您还没有提问哦"
  50. })
  51. }
  52. }
  53. })
  54. },
  55. // 去解答的详情页
  56. gojjDetails(e) {
  57. let id = e.currentTarget.dataset.item.id
  58. if (e.currentTarget.dataset.item.replyContent == "" || e.currentTarget.dataset.item.replyContent == null) {
  59. wx.showModal({
  60. showCancel: false,
  61. content: "您还没收到回复哦"
  62. })
  63. } else {
  64. wx.navigateTo({
  65. url: '/pages/myInteractionsDetais/myInteractionsDetais?id=' + id,
  66. })
  67. }
  68. },
  69. // 提交内容
  70. async bindFormSubmit(e) {
  71. let input_val = e.detail.value.textarea;
  72. const sessionKey = await tools.checkSessionAndLogin();
  73. if (input_val == "" || input_val == undefined) {
  74. wx.showToast({
  75. title: '反馈不能为空',
  76. icon: 'none',
  77. duration: 1000
  78. })
  79. return false;
  80. }
  81. wx.showLoading({
  82. mask: true,
  83. title: '加载中',
  84. })
  85. wx.request({
  86. url: app.globalData.publicUrl + '/wx/board/add',
  87. method: "post",
  88. data: {
  89. content: input_val,
  90. sessionKey: sessionKey
  91. },
  92. success: (res) => {
  93. wx.hideLoading()
  94. if (res.data.code == 0) {
  95. wx.showModal({
  96. showCancel: false,
  97. content: "提交成功",
  98. success: (res) => {
  99. if (res.confirm) {
  100. this.setData({
  101. mytip: ""
  102. })
  103. }
  104. }
  105. })
  106. }
  107. // else {
  108. // wx.showModal({
  109. // showCancel: false,
  110. // content: res.data.msg
  111. // })
  112. // }
  113. }
  114. })
  115. }
  116. })