myInteractions.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. console.log(res, "我是查到的列表")
  32. if (res.data.code == 0) {
  33. if (res.data.list.length == 0) {
  34. wx.showModal({
  35. showCancel: false,
  36. content: "您还没有提问哦"
  37. })
  38. } else {
  39. this.setData({
  40. listArr: res.data.list,
  41. isshow1: true,
  42. isshow2: false,
  43. activebg: "#f2f2f2",
  44. unactivebg: "#ffeae9"
  45. })
  46. }
  47. } else {
  48. wx.showModal({
  49. showCancel: false,
  50. content: "您还没有提问哦"
  51. })
  52. }
  53. }
  54. })
  55. },
  56. // 去解答的详情页
  57. gojjDetails(e) {
  58. let id = e.currentTarget.dataset.item.id
  59. if (e.currentTarget.dataset.item.replyContent == "" || e.currentTarget.dataset.item.replyContent == null) {
  60. wx.showModal({
  61. showCancel: false,
  62. content: "您还没收到回复哦"
  63. })
  64. } else {
  65. wx.navigateTo({
  66. url: '/pages/myInteractionsDetais/myInteractionsDetais?id=' + id,
  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. } else {
  107. wx.showModal({
  108. showCancel: false,
  109. content: res.data.msg
  110. })
  111. }
  112. }
  113. })
  114. }
  115. })