feedback.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="">
  3. <navbar :config="config" backColor="#333333"></navbar>
  4. <view class="zw-pages-content">
  5. <view class="select-box">
  6. <text>反馈主题</text>
  7. <view class="box-r">
  8. <u-input v-model="form.opinionTitle" placeholder="请填写反馈主题" />
  9. </view>
  10. </view>
  11. <view class="select-box">
  12. <text>反馈类型</text>
  13. <view class="box-r">
  14. <u-input v-model="form.opinionType" type="select" placeholder="请输入反馈类型" @click="show = true" />
  15. <u-action-sheet :list="actionSheetList" v-model="show"
  16. @click="actionSheetCallback"></u-action-sheet>
  17. </view>
  18. </view>
  19. <view class="upload-box">
  20. <u-input v-model="form.opinionContent" auto-height :height="200" maxlength="200" type="textarea"
  21. :clearable="false" placeholder="请填写要反馈的内容" />
  22. <view class="num"><text>{{form.opinionContent.length || 0}}</text> / 200</view>
  23. <view >
  24. <uploadImg closeTip imgCount="3" uploadImgCount="1" :imgArr="imgArr" :type="upimgtype" url=""
  25. @result="resultUrlone" @delImg="delImg"></uploadImg>
  26. </view>
  27. </view>
  28. <view class="select-box">
  29. <text>联系方式</text>
  30. <view class="box-r">
  31. <u-input v-model="form.opinionUserPhone" type="number" maxlength="11" placeholder="请输入手机号" />
  32. </view>
  33. </view>
  34. <view class="btn-box">
  35. <view class="btn" @click="confirm">确认反馈</view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. forEach
  43. } from 'mathjs';
  44. import uploadImg from '../../components/uploadImg/imgUpload.vue';
  45. import permision from "@/utils/permission.js"
  46. export default {
  47. components: {
  48. uploadImg,
  49. },
  50. data() {
  51. return {
  52. config: {
  53. back: true,
  54. title: '使用反馈',
  55. color: 'black',
  56. backgroundColor: [1, '#fff'],
  57. statusBarFontColor: 'black',
  58. },
  59. form: {
  60. opinionTitle: '',
  61. opinionType: '',
  62. opinionContent: '',
  63. opinionUserPhone: '',
  64. opinionImg: ''
  65. },
  66. imgArr: [],
  67. show: false,
  68. border: true,
  69. upimgtype: 'other',
  70. actionSheetList: [],
  71. };
  72. },
  73. onLoad() {
  74. this.getTypeOptions();
  75. },
  76. methods: {
  77. actionSheetCallback(index) {
  78. this.form.opinionType = this.actionSheetList[index].text;
  79. },
  80. //获取反馈类型
  81. getTypeOptions() {
  82. this.$yghttp.get('/dict/data/type/user_opinion_type').then((res) => {
  83. if (res && res.code == 200) {
  84. let data = res.data;
  85. this.actionSheetList = [];
  86. data.forEach((e) => {
  87. this.actionSheetList.push({
  88. text: e.dictValue,
  89. });
  90. });
  91. }
  92. });
  93. },
  94. confirm() {
  95. if (!this.form.opinionTitle) {
  96. uni.showToast({
  97. icon: 'none',
  98. title: '请填写意见标题',
  99. });
  100. return;
  101. }
  102. if (!this.form.opinionType) {
  103. uni.showToast({
  104. icon: 'none',
  105. title: '请选择类型',
  106. });
  107. return;
  108. }
  109. if (!this.form.opinionContent) {
  110. uni.showToast({
  111. icon: 'none',
  112. title: '请填写反馈内容',
  113. });
  114. return;
  115. }
  116. if (this.imgArr.length > 0) {
  117. this.form.opinionImg = this.imgArr.join(',')
  118. }
  119. this.$yghttp.post('/user/opinion/add', this.form).then((res) => {
  120. if (res && res.code == 200) {
  121. uni.showToast({
  122. icon: 'none',
  123. title: '提交成功',
  124. });
  125. this.form = {
  126. opinionTitle: '',
  127. opinionType: '',
  128. opinionContent: '',
  129. opinionUserPhone: '',
  130. opinionImg: '',
  131. };
  132. this.imgArr = []
  133. setTimeout(() => {
  134. uni.navigateBack()
  135. }, 300)
  136. }
  137. });
  138. },
  139. //上传身份证
  140. resultUrlone(e) {
  141. console.log('e', e);
  142. this.imgArr = e;
  143. },
  144. delImg(e) {
  145. this.imgArr = e;
  146. },
  147. },
  148. };
  149. </script>
  150. <style>
  151. page {
  152. background-color: #F8F8F8;
  153. }
  154. </style>
  155. <style lang="scss" scoped>
  156. .zw-pages-content {
  157. position: relative;
  158. padding: 0 28rpx;
  159. .select-box {
  160. display: flex;
  161. align-items: center;
  162. padding: 20rpx 40rpx 20rpx 50rpx;
  163. background-color: #fff;
  164. margin: 22rpx 0;
  165. border-radius: 20rpx;
  166. .box-r {
  167. display: flex;
  168. align-items: center;
  169. flex: 1;
  170. margin-left: 20rpx;
  171. }
  172. &>text {
  173. font-size: 30rpx;
  174. }
  175. }
  176. .upload-box {
  177. display: flex;
  178. flex-direction: column;
  179. margin: 22rpx 0;
  180. padding: 20rpx 40rpx 20rpx 50rpx;
  181. background-color: #fff;
  182. border-radius: 20rpx;
  183. // .upload-img {
  184. // // display: flex;
  185. // // justify-content: space-between;
  186. // // align-items: flex-end;
  187. // .upload-img-box {
  188. // flex: 1;
  189. // ::v-deep .upload-img-view {
  190. // min-width: 200rpx;
  191. // }
  192. // }
  193. // }
  194. .num {
  195. margin: 10rpx 0;
  196. margin-left: auto;
  197. color: #999999;
  198. font-size: 30rpx;
  199. &>text {
  200. color: #4FD1E5;
  201. }
  202. }
  203. }
  204. .btn-box {
  205. position: fixed;
  206. bottom: 0;
  207. left: 0;
  208. right: 0;
  209. padding: 20rpx;
  210. padding-bottom: 50rpx;
  211. .btn {
  212. width: 534rpx;
  213. height: 80rpx;
  214. margin: 0 auto;
  215. line-height: 80rpx;
  216. text-align: center;
  217. font-size: 30rpx;
  218. background: linear-gradient(17deg, #52d5e9 0%, #45c5da 100%) #3c66d9;
  219. color: #fff;
  220. border-radius: 10rpx;
  221. }
  222. }
  223. }
  224. </style>