feedback.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. const util = require("../../utils/util.js");
  22. export default {
  23. data() {
  24. return {
  25. phone: '',
  26. text: '',
  27. name: '',
  28. mobile: ''
  29. };
  30. },
  31. components: {},
  32. props: {},
  33. onLoad: function (options) {
  34. // this.getData();
  35. },
  36. methods: {
  37. intText(e) {
  38. this.setData({
  39. text: e.detail.value
  40. });
  41. },
  42. intName(e) {
  43. this.setData({
  44. name: e.detail.value
  45. });
  46. },
  47. intMobile(e) {
  48. this.setData({
  49. mobile: e.detail.value
  50. });
  51. },
  52. getData() {
  53. req.getRequest('/api/aboutAs', {}, res => {
  54. this.setData({
  55. phone: res.hotLine
  56. });
  57. });
  58. },
  59. confirm() {
  60. let that = this;
  61. if (!that.text) {
  62. req.msg('请简要描述你在使用产品过程中的问题和意见');
  63. return false;
  64. }
  65. if (!that.name) {
  66. req.msg('请输入您的姓名');
  67. return false;
  68. }
  69. if (!that.mobile) {
  70. req.msg('请输入您的手机号');
  71. return false;
  72. }
  73. if (!util.isMobile(that.mobile)) {
  74. req.msg('请输入正确的手机号');
  75. return false;
  76. }
  77. req.postRequest('/admin/v2/user/feedback', {
  78. name: that.name,
  79. mobile: that.mobile,
  80. text: that.text
  81. }, res => {
  82. req.msg('您的问题反馈已提交,我们会尽快与您联系!');
  83. setTimeout(()=>{
  84. uni.navigateBack()
  85. },1000)
  86. });
  87. }
  88. }
  89. };
  90. </script>
  91. <style>
  92. @import "./feedback.css";
  93. </style>