feedback.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <!--mine/feedback/feedback.wxml-->
  4. <view class="box">
  5. <view class="tit">您的问题或建议:</view>
  6. <textarea type="text" name="text" placeholder="请简要描述你在使用产品过程中的问题和意见" placeholder-class="placeholder" class="textarea" @input="intText"></textarea>
  7. </view>
  8. <view class="box">
  9. <view class="tit">您的联系方式:</view>
  10. <input type="text" name="name" placeholder="姓名" placeholder-class="placeholder" class="ipt" @input="intName"></input>
  11. <input type="number" name="mobile" placeholder="手机号" placeholder-class="placeholder" class="ipt" @input="intMobile"></input>
  12. <view class="tip">请留下您的联系方式,以便我们能够方便了解问题以及您反馈问题结果。紧急问题可拨打{{phone ? phone : '客服电话'}},获得及时帮助</view>
  13. </view>
  14. <button class="submit" @tap="confirm">立即反馈</button>
  15. </view>
  16. </template>
  17. <script>
  18. // mine/feedback/feedback.js
  19. const app = getApp();
  20. const req = require("../../utils/request.js");
  21. export default {
  22. data() {
  23. return {
  24. phone: '',
  25. text: '',
  26. name: '',
  27. mobile: ''
  28. };
  29. },
  30. components: {},
  31. props: {},
  32. onLoad: function (options) {
  33. // this.getData();
  34. },
  35. methods: {
  36. intText(e) {
  37. this.setData({
  38. text: e.detail.value
  39. });
  40. },
  41. intName(e) {
  42. this.setData({
  43. name: e.detail.value
  44. });
  45. },
  46. intMobile(e) {
  47. this.setData({
  48. mobile: e.detail.value
  49. });
  50. },
  51. getData() {
  52. req.getRequest('/api/aboutAs', {}, res => {
  53. this.setData({
  54. phone: res.hotLine
  55. });
  56. });
  57. },
  58. confirm() {
  59. let that = this;
  60. if (!that.text) {
  61. req.msg('请简要描述你在使用产品过程中的问题和意见');
  62. return false;
  63. }
  64. if (!that.name) {
  65. req.msg('请输入您的姓名');
  66. return false;
  67. }
  68. if (!that.mobile) {
  69. req.msg('请输入您的手机号');
  70. return false;
  71. }
  72. req.postRequest('/admin/v2/user/feedback', {
  73. name: that.name,
  74. mobile: that.mobile,
  75. text: that.text
  76. }, res => {
  77. req.msg('您的问题反馈已提交,我们会尽快与您联系!');
  78. });
  79. }
  80. }
  81. };
  82. </script>
  83. <style>
  84. @import "./feedback.css";
  85. </style>