feedback.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="container">
  3. <view class="title">问题描述</view>
  4. <view class="tui-cells">
  5. <textarea class="tui-textarea" placeholder="我希望加入XXXX功能,因为XX情况下,会出现XX异常" maxlength="500" placeholder-class="phcolor"
  6. v-model="desc" />
  7. <view class="textarea-counter">{{descNum}}/500</view>
  8. </view>
  9. <view class="title top64">联系邮箱</view>
  10. <input class="tui-input" placeholder-class="phcolor" placeholder="请输入邮箱" v-model="email" maxlength="20"></input>
  11. <view class="tui-ptop">
  12. <tui-button type="danger" shadow height="88rpx" shape="circle" @click="submit">提交反馈</tui-button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. const form = require("@/components/common/tui-validation/tui-validation.js")
  18. export default {
  19. computed:{
  20. descNum:function(){
  21. return this.desc.length
  22. }
  23. },
  24. onLoad(options) {
  25. },
  26. data() {
  27. return {
  28. desc:"",
  29. email:""
  30. }
  31. },
  32. methods: {
  33. submit(){
  34. let rules = [{
  35. name: "desc",
  36. rule: ["required", "minLength:8", "maxLength:500"],
  37. msg: ["请输入问题描述", "问题描述必须8个或以上字符", "问题描述不能超过500个字符"]
  38. }, {
  39. name: "email",
  40. rule: ["required", "isEmail"],
  41. msg: ["请输入邮箱", "请输入正确的邮箱"]
  42. }];
  43. let formData = {
  44. desc:this.desc,
  45. email:this.email
  46. }
  47. let checkRes = form.validation(formData, rules);
  48. if (!checkRes) {
  49. this.tui.request("/Home/AddFeedBack","POST",{
  50. Name: this.email,
  51. Subject: "问题反馈",
  52. Email: this.email,
  53. Message: this.desc
  54. }).then((res)=>{
  55. console.log(res)
  56. if (res.code == 100) {
  57. this.tui.toast('提交成功');
  58. this.desc="";
  59. this.email="";
  60. } else {
  61. this.tui.toast(res.message);
  62. }
  63. }).catch((res)=>{})
  64. } else {
  65. this.tui.toast(checkRes)
  66. }
  67. }
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh: function() {
  73. setTimeout(() => {
  74. uni.stopPullDownRefresh()
  75. }, 200);
  76. },
  77. }
  78. </script>
  79. <style>
  80. page {
  81. background: #fff;
  82. }
  83. .container {
  84. background-color: #fff;
  85. margin-top: 22rpx;
  86. padding: 30rpx;
  87. box-sizing: border-box;
  88. padding-bottom: 162rpx
  89. }
  90. .title {
  91. font-size: 30rpx;
  92. color: #666;
  93. padding-bottom: 32rpx;
  94. }
  95. .tui-cells {
  96. border: 1rpx solid #e6e6e6;
  97. border-radius: 4rpx;
  98. height: 280rpx;
  99. box-sizing: border-box;
  100. padding: 20rpx 20rpx 0 20rpx;
  101. }
  102. .tui-textarea {
  103. height: 210rpx;
  104. width: 100%;
  105. color: #666;
  106. font-size: 28rpx;
  107. }
  108. .pholder {
  109. color: #ccc;
  110. }
  111. .textarea-counter {
  112. font-size: 24rpx;
  113. color: #999;
  114. text-align: right;
  115. height: 40rpx;
  116. line-height: 40rpx;
  117. padding-top: 4rpx;
  118. }
  119. .top64 {
  120. margin-top: 64rpx;
  121. }
  122. .tui-input {
  123. font-size: 30rpx;
  124. height: 88rpx;
  125. border: 1rpx solid #e6e6e6;
  126. border-radius: 4rpx;
  127. padding: 0 25rpx;
  128. box-sizing: border-box;
  129. }
  130. .tui-ptop{
  131. padding-top: 80rpx;
  132. }
  133. </style>