feedback.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="feedback-wrapper">
  3. <view class="input-box">
  4. <textarea type="text" placeholder="请输入您要反馈的内容" v-model="con" />
  5. </view>
  6. <view class="input-box">
  7. <text class="info" selectable="false" space="false" decode="false">
  8. 上传图片
  9. </text>
  10. <u-upload action="http://www.example.com/upload" :file-list="[
  11. ]" max-count="1"></u-upload>
  12. </view>
  13. <view class="sub_btn" @click="subMit">
  14. <button class='modifyBnt' formType="submit">保存</button>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { serviceFeedBack, feedBackPost } from '@/api/kefu.js'
  20. export default {
  21. name: 'feedback',
  22. data () {
  23. return {
  24. name: '',
  25. phone: '',
  26. con: '',
  27. }
  28. },
  29. onLoad () {
  30. },
  31. methods: {
  32. subMit () {
  33. if (!this.name) {
  34. return this.$util.Tips({
  35. title: this.$t(`请输入姓名`)
  36. })
  37. }
  38. if (!this.phone || !(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.phone))) {
  39. return this.$util.Tips({
  40. title: this.$t(`请输入正确的手机号码`)
  41. })
  42. }
  43. if (!this.con) {
  44. return this.$util.Tips({
  45. title: this.$t(`请填写内容`)
  46. })
  47. }
  48. feedBackPost({
  49. rela_name: this.name,
  50. phone: this.phone,
  51. content: this.con
  52. }).then(res => {
  53. this.$util.Tips({
  54. title: res.msg,
  55. icon: 'success'
  56. }, {
  57. tab: 3
  58. })
  59. }).catch(function (res) {
  60. that.$util.Tips({ title: res });
  61. });
  62. }
  63. }
  64. }
  65. </script>
  66. <style scoped lang="scss">
  67. .feedback-wrapper{
  68. background: #fff;
  69. margin-top: 20rpx;
  70. padding: 30rpx;
  71. }
  72. .info{
  73. height: 44rpx;
  74. font-size: 28rpx;
  75. font-weight: 400;
  76. color: #999999;
  77. line-height: 44rpx;
  78. }
  79. .modifyBnt {
  80. width: 85%;
  81. margin: auto;
  82. margin-top: 50rpx;
  83. height: 84rpx;
  84. background: #B42A3E;
  85. border-radius: 8rpx;
  86. font-size: 32rpx;
  87. color: #fff;
  88. text-align: center;
  89. line-height: 84rpx;
  90. }
  91. </style>