拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
2.7KB

  1. // package_first/pages/ProtectionSuggestion/ProtectionSuggestion.js
  2. // import { PostProcess } from 'XrFrame/xrFrameSystem';
  3. import { api_westreamSuggest,
  4. api_getUserInfo
  5. } from '../../../api/suggestion';
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. form : {
  12. content:''
  13. },
  14. dialogShow:false,
  15. userInfo:{},
  16. formRules: {
  17. content: {
  18. validator: function (value) {
  19. return value;
  20. },
  21. warning: false
  22. },
  23. },
  24. },
  25. /**
  26. * 生命周期函数--监听页面加载
  27. */
  28. onLoad(options) {
  29. },
  30. /**
  31. * 生命周期函数--监听页面初次渲染完成
  32. */
  33. onReady() {
  34. },
  35. /**
  36. * 生命周期函数--监听页面显示
  37. */
  38. onShow() {
  39. this.getUserInfo()
  40. },
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide() {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload() {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh() {
  55. },
  56. /**
  57. * 页面上拉触底事件的处理函数
  58. */
  59. onReachBottom() {
  60. },
  61. /**
  62. * 用户点击右上角分享
  63. */
  64. onShareAppMessage() {
  65. },
  66. // 关闭弹窗
  67. colseDialog(){
  68. console.log(111);
  69. wx.switchTab({
  70. url: '/pages/FirstPage/index',
  71. })
  72. },
  73. remarkInputAction(options){
  74. let content= options.detail.value
  75. this.setData({
  76. form:{
  77. content,
  78. }
  79. })
  80. },
  81. getUserInfo(){
  82. const tenantObj = wx.getStorageSync('tenant')
  83. const openid = wx.getStorageSync('openid')
  84. const data = {
  85. tenantId:tenantObj.tenantId,
  86. openid,
  87. }
  88. api_getUserInfo(data).then(res=>{
  89. let userInfo = res.data
  90. this.setData({
  91. userInfo,
  92. })
  93. })
  94. },
  95. submit(e){
  96. const tenantObj = wx.getStorageSync('tenant')
  97. const openid = wx.getStorageSync('openid')
  98. if(this.data.form.content == ''){
  99. wx.showToast({
  100. title: '还没提交相关建议',
  101. icon:'none'
  102. })
  103. }else{
  104. let data = {
  105. tenantId:tenantObj.tenantId,
  106. openid : openid,
  107. nickname:this.data.userInfo.nickname,
  108. suggestName:this.data.form.content
  109. }
  110. api_westreamSuggest(data).then(res=>{
  111. let dialogShow = true
  112. this.setData({
  113. dialogShow,
  114. })
  115. })
  116. }
  117. },
  118. })