index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view>
  3. <!--/*
  4. ***HotApp云笔记,基于HotApp小程序统计云后台
  5. ***免费云后台申请地址 https://weixin.hotapp.cn/cloud
  6. ***API 文档地址:https://weixin.hotapp.cn/api
  7. ***小程序技术讨论QQ群:173063969
  8. */-->
  9. <!-- 用户反馈 -->
  10. <form @submit="onSubmit" @reset="">
  11. <view class="container">
  12. <view class="row text_box">
  13. <textarea class="text" name="content" :value="content" placeholder="请输入您的反馈" />
  14. </view>
  15. <view class="row btn_box">
  16. <button formType="submit" class="submit">提交反馈</button>
  17. </view>
  18. <view class="row version">
  19. <view class="txt">版本1.0</view>
  20. <view class="txt">本小程序基于HotApp小程序统计云后台开发</view>
  21. </view>
  22. </view>
  23. </form>
  24. </view>
  25. </template>
  26. <script>
  27. /*
  28. ***HotApp云笔记,基于HotApp小程序统计云后台
  29. ***免费云后台申请地址 https://weixin.hotapp.cn/cloud
  30. ***API 文档地址:https://weixin.hotapp.cn/api
  31. ***小程序技术讨论QQ群:173063969
  32. */
  33. var app = getApp();
  34. export default {
  35. data() {
  36. return {
  37. content: ''
  38. };
  39. },
  40. methods: {
  41. onSubmit: function (event) {
  42. if (!event.detail.value.content) {
  43. uni.showToast({
  44. title: '请填写反馈内容'
  45. });
  46. return;
  47. }
  48. var that = this;
  49. this.setData({
  50. content: event.detail.value.content
  51. });
  52. var now = Date.parse(new Date());
  53. var key = app.globalData.hotapp.getPrefix('feedback');
  54. app.globalData.hotapp.post(key, this.content, function (res) {
  55. if (res.ret == 0) {
  56. uni.showToast({
  57. title: '提交成功'
  58. });
  59. uni.redirectTo({
  60. url: '../index/index'
  61. });
  62. } else {
  63. uni.showToast({
  64. title: '提交失败'
  65. });
  66. }
  67. });
  68. }
  69. }
  70. };
  71. </script>
  72. <style>
  73. @import './index.css';
  74. </style>