feedback.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="page">
  3. <view class="feedback-title">
  4. <text>问题和意见</text>
  5. <text class="feedback-quick" @tap="chooseMsg">快速键入 <text class="iconfont iconxia"></text></text>
  6. </view>
  7. <view class="feedback-body">
  8. <textarea placeholder="请详细描述您的问题和意见..." v-model="sendDate.content" class="feedback-textare" />
  9. </view>
  10. <view class="feedback-title">
  11. <text>图片(选填,提供问题截图,总大小10M以下)</text>
  12. </view>
  13. <view class="feedback-body feedback-uploader oa-uploader">
  14. <view class="uni-uploader">
  15. <view class="uni-uploader-head">
  16. <view class="uni-uploader-title">点击预览图片</view>
  17. <view class="uni-uploader-info">{{ imageList.length }}/9</view>
  18. </view>
  19. <view class="uni-uploader-body">
  20. <view class="uni-uploader__files">
  21. <block v-for="(image, index) in imageList" :key="index">
  22. <view class="uni-uploader__file" style="position: relative;">
  23. <oa-image class="uni-uploader__img" :src="image"></oa-image>
  24. <view class="close-view" @tap="close(index)" :class="'bg-' + themeColor.name">x</view>
  25. </view>
  26. </block>
  27. <view class="uni-uploader__input-box" v-if="imageList.length < 9">
  28. <view class="uni-uploader__input" @tap="uploadImage"></view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="feedback-title">
  35. <text>反馈类型</text>
  36. </view>
  37. <view class="feedback-body">
  38. <radio-group @change="handleFeedbackTypeChange">
  39. <label
  40. class="gender-item"
  41. v-for="(item, index) in feedbackType"
  42. :key="index"
  43. >
  44. <radio
  45. class="gender-item-radio"
  46. :color="themeColor.color"
  47. :value="item.value"
  48. :checked="item.value === sendDate.type"
  49. />
  50. <text class="gender-item-text">{{ item.name }}</text>
  51. </label>
  52. </radio-group>
  53. </view>
  54. <view class="feedback-title">
  55. <text>QQ/邮箱/手机号</text>
  56. </view>
  57. <view class="feedback-body">
  58. <input
  59. class="feedback-input"
  60. v-model="sendDate.contact_way"
  61. placeholder="(选填,方便我们联系您 )"
  62. />
  63. </view>
  64. <button
  65. class="confirm-btn"
  66. :class="'bg-' + themeColor.name"
  67. :disabled="btnLoading"
  68. :loading="btnLoading"
  69. @tap="send"
  70. >
  71. 提交
  72. </button>
  73. <view class="feedback-title">
  74. <text>反馈结果可在设置 -> 意见反馈 -> 点击列表后查看!</text>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { opinionCreate } from '@/api/userInfo';
  80. export default {
  81. data() {
  82. return {
  83. msgContents: [
  84. '界面显示错乱',
  85. '启动缓慢,卡出翔了',
  86. 'UI无法直视,丑哭了',
  87. '偶发性崩溃'
  88. ],
  89. stars: [1, 2, 3, 4, 5],
  90. imageList: [],
  91. feedbackType: [
  92. {
  93. value: '1',
  94. name: '功能建议'
  95. },
  96. {
  97. value: '2',
  98. name: 'BUG反馈'
  99. },
  100. {
  101. value: '3',
  102. name: '业务咨询'
  103. }
  104. ],
  105. sendDate: {
  106. type: '1',
  107. covers: '',
  108. content: '',
  109. contact_way: ''
  110. },
  111. btnLoading: false
  112. };
  113. },
  114. onShow() {
  115. uni.setNavigationBarColor({
  116. frontColor: '#ffffff',
  117. backgroundColor: this.themeColor.color,
  118. animation: {
  119. duration: 400,
  120. timingFunc: 'easeIn'
  121. }
  122. })
  123. },
  124. methods: {
  125. // 监听反馈类型事件
  126. handleFeedbackTypeChange(e) {
  127. this.sendDate.type = e.detail.value;
  128. },
  129. // 打开相册选图
  130. uploadImage() {
  131. const _this = this;
  132. uni.chooseImage({
  133. count: 9, // 最多一次可以选择的图片张数
  134. sizeType: ['compressed'],
  135. sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机
  136. success: function(res) {
  137. if (_this.imageList.length + res.tempFiles.length > 9) {
  138. _this.$mHelper.toast('不要贪心哦,最多只可上传9张照片');
  139. return;
  140. }
  141. _this.handleUploadFile(res.tempFilePaths);
  142. }
  143. });
  144. },
  145. // 依次上传图片
  146. handleUploadFile(data) {
  147. this.$mHelper.toast('上传成功');
  148. },
  149. // 删除已选中图片
  150. close(e) {
  151. this.imageList.splice(e, 1);
  152. },
  153. // 快速输入
  154. chooseMsg() {
  155. uni.showActionSheet({
  156. itemList: this.msgContents,
  157. success: res => {
  158. this.sendDate.content = this.msgContents[res.tapIndex];
  159. }
  160. });
  161. },
  162. // 发送反馈
  163. async send() {
  164. this.$mHelper.toast('意见反馈成功');
  165. }
  166. }
  167. };
  168. </script>
  169. <style lang="scss">
  170. page {
  171. background-color: $page-color-base;
  172. }
  173. /*问题反馈*/
  174. .feedback-title {
  175. display: flex;
  176. flex-direction: row;
  177. justify-content: space-between;
  178. align-items: center;
  179. padding: $spacing-base;
  180. margin-top: $spacing-base;
  181. font-size: $font-base;
  182. }
  183. .feedback-star-view.feedback-title {
  184. justify-content: flex-start;
  185. margin: 0;
  186. }
  187. .feedback-quick {
  188. position: relative;
  189. padding-right: 40upx;
  190. .iconfont {
  191. font-size: $font-sm;
  192. }
  193. }
  194. .feedback-body {
  195. background: $color-white;
  196. padding: $spacing-sm $spacing-base;
  197. .gender-item {
  198. margin-right: 20upx;
  199. .gender-item-text {
  200. padding-left: 10upx;
  201. }
  202. radio .wx-radio-input.wx-radio-input-checked {
  203. background: $uni-color-primary;
  204. border-color: $uni-color-primary;
  205. }
  206. }
  207. }
  208. .feedback-textare {
  209. height: 200upx;
  210. font-size: 34upx;
  211. line-height: 50upx;
  212. width: 100%;
  213. box-sizing: border-box;
  214. padding: 20upx 30upx 0;
  215. }
  216. .feedback-input {
  217. font-size: 28upx;
  218. height: 72upx;
  219. min-height: 50upx;
  220. padding: 15upx 20upx;
  221. line-height: 72upx;
  222. }
  223. .feedback-uploader {
  224. padding: 22upx 20upx;
  225. }
  226. </style>