index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="page" style="background-color: #ffffff;">
  3. <view class="feedback-title">
  4. <text>问题和意见</text>
  5. <text @tap="chooseMsg">快速键入</text>
  6. </view>
  7. <view class="feedback-body"><textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content"
  8. class="feedback-textare" /></view>
  9. <view class="feedback-title"><text>联系方式</text></view>
  10. <view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact" placeholder="方便我们联系你 " />
  11. </view>
  12. <button style="" class="feedback-submit" @tap="send">提交</button>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视,丑哭了', '偶发性崩溃'],
  20. stars: [1, 2, 3, 4, 5],
  21. imageList: [],
  22. sendDate: {
  23. score: 5,
  24. content: '',
  25. contact: ''
  26. }
  27. };
  28. },
  29. onLoad() {
  30. let deviceInfo = {
  31. appid: plus.runtime.appid,
  32. imei: plus.device.imei, //设备标识
  33. p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  34. md: plus.device.model, //设备型号
  35. app_version: plus.runtime.version,
  36. plus_version: plus.runtime.innerVersion, //基座版本号
  37. os: plus.os.version,
  38. net: '' + plus.networkinfo.getCurrentType()
  39. };
  40. this.sendDate = Object.assign(deviceInfo, this.sendDate);
  41. },
  42. methods: {
  43. close(e) {
  44. this.imageList.splice(e, 1);
  45. },
  46. chooseMsg() {
  47. //快速输入
  48. uni.showActionSheet({
  49. itemList: this.msgContents,
  50. success: res => {
  51. this.sendDate.content = this.msgContents[res.tapIndex];
  52. }
  53. });
  54. },
  55. chooseImg() {
  56. //选择图片
  57. uni.chooseImage({
  58. sourceType: ['camera', 'album'],
  59. sizeType: 'compressed',
  60. count: 8 - this.imageList.length,
  61. success: res => {
  62. this.imageList = this.imageList.concat(res.tempFilePaths);
  63. }
  64. });
  65. },
  66. chooseStar(e) {
  67. //点击评星
  68. this.sendDate.score = e;
  69. },
  70. previewImage() {
  71. //预览图片
  72. uni.previewImage({
  73. urls: this.imageList
  74. });
  75. },
  76. send() {
  77. //发送反馈
  78. console.log(JSON.stringify(this.sendDate));
  79. if (!this.sendDate.content) {
  80. uni.showToast({
  81. icon: 'none',
  82. title: '请输入反馈内容'
  83. });
  84. return;
  85. }
  86. if (!this.sendDate.contact) {
  87. uni.showToast({
  88. icon: 'none',
  89. title: '请填写QQ或邮箱'
  90. });
  91. return;
  92. }
  93. this.$queue.showLoading('加载中...');
  94. this.$Request.postJson('/app/message/insertMessage', {
  95. title: this.sendDate.contact,
  96. content: JSON.stringify(this.sendDate),
  97. state: 2
  98. }).then(res => {
  99. if (res.code === 0) {
  100. uni.showToast({
  101. title: '投诉成功'
  102. });
  103. setTimeout(function() {
  104. uni.navigateBack();
  105. }, 1000);
  106. } else {
  107. uni.hideLoading();
  108. uni.showModal({
  109. showCancel: false,
  110. title: '投诉失败',
  111. content: res.msg
  112. });
  113. }
  114. });
  115. }
  116. }
  117. };
  118. </script>
  119. <style>
  120. @font-face {
  121. font-family: uniicons;
  122. font-weight: normal;
  123. font-style: normal;
  124. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  125. }
  126. page {
  127. background-color: #F5F5F5 !important;
  128. }
  129. view {
  130. font-size: 28upx;
  131. }
  132. /*问题反馈*/
  133. .feedback-title {
  134. display: flex;
  135. flex-direction: row;
  136. justify-content: space-between;
  137. align-items: center;
  138. padding: 20upx;
  139. color: #8f8f94;
  140. font-size: 28upx;
  141. }
  142. .feedback-star-view.feedback-title {
  143. justify-content: flex-start;
  144. margin: 0;
  145. }
  146. .feedback-body {
  147. font-size: 32upx;
  148. padding: 16upx;
  149. margin: 16upx;
  150. border-radius: 16upx;
  151. background: #FFFFFF;
  152. /* color: #FFF; */
  153. }
  154. .feedback-textare {
  155. height: 200upx;
  156. font-size: 34upx;
  157. line-height: 50upx;
  158. width: 100%;
  159. box-sizing: border-box;
  160. padding: 20upx 30upx 0;
  161. }
  162. .feedback-input {
  163. font-size: 32upx;
  164. height: 60upx;
  165. padding: 15upx 20upx;
  166. line-height: 60upx;
  167. }
  168. .feedback-submit {
  169. background: #00B88F;
  170. color: #ffffff;
  171. margin: 20upx;
  172. margin-top: 32upx;
  173. }
  174. </style>