index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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.feedbackMessage" class="feedback-textare" /></view>
  8. <view class="feedback-title"><text>联系方式</text></view>
  9. <view class="feedback-body"><input class="feedback-input" v-model="sendDate.userEmail" 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. feedbackMessage: '',
  23. userEmail: ''
  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.feedbackMessage = 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. if (!this.sendDate.feedbackMessage) {
  78. uni.showToast({
  79. icon: 'none',
  80. title: '请输入反馈内容'
  81. });
  82. return;
  83. }
  84. if (!this.sendDate.userEmail) {
  85. uni.showToast({
  86. icon: 'none',
  87. title: '请填写联系方式'
  88. });
  89. return;
  90. }
  91. this.$queue.showLoading('加载中...');
  92. this.$Request.postJson('/app/shop/userFeedback', {
  93. shopId:uni.getStorageSync("shopId"),
  94. userEmail: this.sendDate.userEmail,
  95. feedbackMessage: this.sendDate.feedbackMessage,
  96. // state: 2
  97. }).then(res => {
  98. if (res.code === 0) {
  99. uni.showToast({
  100. title: '提交成功'
  101. });
  102. setTimeout(function() {
  103. uni.navigateBack();
  104. }, 1000);
  105. } else {
  106. uni.hideLoading();
  107. uni.showModal({
  108. showCancel: false,
  109. title: '提交失败',
  110. feedbackMessage: res.msg
  111. });
  112. }
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style>
  119. @font-face {
  120. font-family: uniicons;
  121. font-weight: normal;
  122. font-style: normal;
  123. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  124. }
  125. page {
  126. background-color: #F5F5F5 !important;
  127. }
  128. view {
  129. font-size: 28upx;
  130. }
  131. /*问题反馈*/
  132. .feedback-title {
  133. display: flex;
  134. flex-direction: row;
  135. justify-content: space-between;
  136. align-items: center;
  137. padding: 20upx;
  138. color: #8f8f94;
  139. font-size: 28upx;
  140. }
  141. .feedback-star-view.feedback-title {
  142. justify-content: flex-start;
  143. margin: 0;
  144. }
  145. .feedback-body {
  146. font-size: 32upx;
  147. padding: 16upx;
  148. margin: 16upx;
  149. border-radius: 16upx;
  150. background: #FFFFFF;
  151. /* color: #FFF; */
  152. }
  153. .feedback-textare {
  154. height: 200upx;
  155. font-size: 34upx;
  156. line-height: 50upx;
  157. width: 100%;
  158. box-sizing: border-box;
  159. padding: 20upx 30upx 0;
  160. }
  161. .feedback-input {
  162. font-size: 32upx;
  163. height: 60upx;
  164. /* padding: 15upx 20upx; */
  165. line-height: 60upx;
  166. }
  167. .feedback-submit {
  168. background: #FFAF5E;
  169. /* color: #ffffff; */
  170. margin: 20upx;
  171. margin-top: 32upx;
  172. }
  173. </style>