index.vue 4.1 KB

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