帮你贷的小程序

feedback.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //logs.js
  2. const util = require('../../utils/util.js')
  3. // var util = require('../../utils/util.js');
  4. var app = getApp();
  5. //textarea.js
  6. Page({
  7. data: {
  8. height: 30,
  9. userInput: '',
  10. int_number: '100',
  11. list_number: '100',
  12. focus: false
  13. },
  14. bindButtonTap: function () {
  15. this.setData({
  16. focus: true
  17. })
  18. },
  19. bindFormSubmit: function (e) {
  20. var that = this, token = wx.getStorageSync('user').token, value = e.detail.value.textarea.replace(/(^\s*)|(\s*$)/g, "");
  21. if (value) {
  22. wx.request({
  23. url: app.globalData.HOST + '/user/wx/addMessage',
  24. method: 'POST',
  25. data: Object.assign({}, app.globalData.common, {
  26. token: token,
  27. content: value
  28. }),
  29. success: function (res) {
  30. if (res.data.errno == 0) {
  31. app.noticeModal('我们会及时处理,感谢您的反馈~', that.goMine)
  32. }
  33. }
  34. });
  35. }else{
  36. app.noticeModal('反馈内容不能为空')
  37. }
  38. },
  39. goMine () {
  40. wx.switchTab({
  41. url: '/pages/mine/mine'
  42. })
  43. },
  44. bindTextAreaBlur: function (e) {
  45. var that = this;
  46. var textvalue = e.detail.value, int_number = that.data.int_number, list_number = that.data.list_number,
  47. slen = '';
  48. var strlen = textvalue.length;
  49. int_number = strlen;
  50. if (int_number > list_number) {
  51. slen = textvalue.substr(0, list_number - 1);
  52. that.setData({
  53. userInput: slen
  54. })
  55. } else {
  56. var int_number = list_number - int_number;
  57. that.setData({
  58. int_number: int_number,
  59. })
  60. }
  61. }
  62. })