feedback.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view style="padding: 30rpx 0;">
  5. <text>请选择您要反馈的问题类型:</text>
  6. </view>
  7. <radio-group class="block" @change="RadioChange">
  8. <view class="radioBox">
  9. <view class="radioItem" :class="data.type==item.type?'checkBorder':'defalutBorder'" v-for="(item,index) in typeList" :key="index">
  10. <label class="flex" >
  11. <view class="">
  12. <radio style="transform: scale(.7);" class="round blue" :class="data.type===item.type?'checked':''" :checked="data.type==item.type?true:false"
  13. :value="item.type"></radio>
  14. </view>
  15. <view class="text-left padding-left-20 flex" style="flex-direction: column;justify-content: center;">
  16. {{item.title}}
  17. </view>
  18. </label>
  19. </view>
  20. </view>
  21. </radio-group>
  22. <view class="area">
  23. <view >
  24. <textarea @input="input" :value="data.question" maxlength="120" placeholder="请描述您的问题,以便我们尽快为您处理"></textarea>
  25. <view class="text-right text-df text-gray padding-bottom-10">
  26. {{data.question.length}} / 120
  27. </view>
  28. </view>
  29. <view class="imgArea">
  30. <view class="padding-bottom-20">
  31. <text class="">请提供相关问题的截图或照片(最多四张)</text>
  32. </view>
  33. <view class="cu-form-group" style="padding: 20rpx 0 0 0;">
  34. <view class="grid col-3 grid-square flex-sub">
  35. <view class="bg-img" v-for="(item,index) in imgList" :key="index" @click="viewImage(index)" >
  36. <image :src="imgList[index]" mode="aspectFill"></image>
  37. <view class="cu-tag bg-red" @click.stop="DelImg(index)" >
  38. <text class='cuIcon-close'></text>
  39. </view>
  40. </view>
  41. <view class="solids" @click="chooseImage" v-if="imgList.length<4">
  42. <text class='cuIcon-add ' style="font-size: 60rpx;color: #c9c9c9;"></text>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- <u-upload @on-choose-complete="chooseImage" :auto-upload="false" width="194" height="194" :action="action" max-count="4" :file-list="fileList" ></u-upload> -->
  47. </view>
  48. </view>
  49. <view class="bg-white" style="height: 150rpx;">
  50. </view>
  51. </view>
  52. <view class="bg-white margin-top-20 footer-fixed" @click="sumit">
  53. <view class="flex flex-direction padding-sm">
  54. <button class="radius cu-btn bg-blue" style="padding: 45rpx;">提交反馈</button>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. var app = getApp();
  61. export default {
  62. data() {
  63. return {
  64. //图片回显
  65. imgList:[],
  66. data:{
  67. member_id:'',
  68. question:'',
  69. image_base64:[],
  70. type:"1",
  71. },
  72. //选择项列表
  73. typeList:[
  74. {
  75. title:'功能异常:功能故障或不可用',
  76. type:'1'
  77. },
  78. {
  79. title:'产品建议:用的不爽,我有建议',
  80. type:'2'
  81. },
  82. {
  83. title:'安全密码:密码,故障等',
  84. type:'3'
  85. },
  86. {
  87. title:'其他问题',
  88. type:'4'
  89. },
  90. ],
  91. }
  92. },
  93. methods: {
  94. //选择反馈类型
  95. RadioChange(e){
  96. this.data.type=e.detail.value
  97. },
  98. /**输入问题描述
  99. * @param {Object} e
  100. */
  101. input(e){
  102. this.data.question=e.detail.value
  103. },
  104. sumit(){
  105. if (this.$isEmpty(this.data.question)) {
  106. uni.showToast({
  107. title:"问题描述不能为空",
  108. icon:"none"
  109. })
  110. return
  111. }
  112. if (this.data.question.length<3) {
  113. uni.showToast({
  114. title:"问题描述不能少于三个字",
  115. icon:"none"
  116. })
  117. return
  118. }
  119. if (this.$isEmpty(this.data.image_base64)) {
  120. uni.showToast({
  121. title:"请提供相关截图",
  122. icon:"none"
  123. })
  124. return
  125. }
  126. this.data.member_id='19478'
  127. console.log(this.data)
  128. },
  129. /**
  130. * 上传问题截图
  131. */
  132. chooseImage() {
  133. let that=this
  134. uni.chooseImage({
  135. count: 4-this.imgList.length,
  136. sizeType: ['original', 'compressed'],
  137. sourceType: ['album'],
  138. success: (res) => {
  139. const tempFilePaths = res.tempFilePaths;
  140. for (let index in tempFilePaths) {
  141. //图片回显
  142. that.imgList.push(tempFilePaths[index])
  143. //图片转为base64的图片
  144. uni.getFileSystemManager().readFile({
  145. filePath: tempFilePaths[index],
  146. //选择图片返回的相对路径
  147. encoding: 'base64',
  148. //编码格式
  149. success: res => {
  150. //成功的回调
  151. that.data.image_base64.push('data:image/jpeg;base64,' + res.data)
  152. }
  153. });
  154. }
  155. }
  156. });
  157. },
  158. /*预览图片*/
  159. viewImage(index) {
  160. uni.previewImage({
  161. urls: this.imgList,
  162. current: index
  163. });
  164. },
  165. /*删除图片*/
  166. DelImg(index) {
  167. uni.showModal({
  168. title: '提示',
  169. content: '确定要删除这张照片吗?',
  170. cancelText: '取消',
  171. confirmText: '确定',
  172. success: res => {
  173. if (res.confirm) {
  174. this.imgList.splice(index, 1)
  175. }
  176. }
  177. })
  178. },
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. .page{
  184. background-color: #FFFFFF;
  185. min-height: 100vh;
  186. }
  187. view{
  188. box-sizing: border-box;
  189. }
  190. .commit{
  191. color: #fff;
  192. font-size: 28upx;
  193. text-align: center;
  194. line-height: 88upx;
  195. margin: 0 20upx;
  196. width: 690upx;
  197. height:88upx;
  198. background:#59a5f0;
  199. border-radius:25px;
  200. margin-bottom: 50upx;
  201. position: absolute;
  202. left: 0;
  203. right: 0;
  204. bottom: 0;
  205. }
  206. .content{
  207. margin: 0 26rpx;
  208. .radioBox{
  209. padding-top: 10rpx;
  210. .radioItem{
  211. padding: 18rpx;
  212. margin-bottom: 15rpx;
  213. border-radius: 10rpx;
  214. }
  215. .defalutBorder{
  216. border: 1rpx solid #d1d1d1;
  217. }
  218. .checkBorder{
  219. border: 1rpx solid #59a5f0;
  220. color: #59a5f0;
  221. }
  222. }
  223. .area{
  224. margin-top: 20rpx;
  225. padding: 20rpx;
  226. border-radius: 12rpx;
  227. border: 1rpx solid #d1d1d1;
  228. textarea{
  229. width: 100%;
  230. line-height: 50rpx;
  231. }
  232. .imgArea{
  233. border-top: 1rpx solid #d1d1d1;
  234. padding-top: 30rpx;
  235. }
  236. }
  237. }
  238. </style>