feedback.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.feedbackType==item.feedbackType?'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.feedbackType===item.feedbackType?'checked':''" :checked="data.feedbackType==item.feedbackType?true:false"
  13. :value="item.feedbackType"></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.content" maxlength="120" placeholder="请描述您的问题,以便我们尽快为您处理"></textarea>
  25. <view class="text-right text-df text-gray padding-bottom-10">
  26. {{data.content.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-4 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 @click="submit" class=" footer-fixed cu-btn base-bg-color flex " style="padding: 45rpx;" :style="{marginBottom:safeAreaBottom}">
  53. 提交反馈
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. var app = getApp();
  59. export default {
  60. data() {
  61. return {
  62. //图片回显
  63. imgList:[],
  64. data:{
  65. name:'',
  66. content:'',
  67. images:'',
  68. feedbackType:"0",
  69. },
  70. //选择项列表
  71. typeList:[
  72. {
  73. title:'功能异常:功能故障或不可用',
  74. feedbackType:'0'
  75. },
  76. {
  77. title:'产品建议:用的不爽,我有建议',
  78. feedbackType:'1'
  79. },
  80. {
  81. title:'安全密码:密码,故障等',
  82. feedbackType:'2'
  83. },
  84. {
  85. title:'其他问题',
  86. feedbackType:'3'
  87. },
  88. ],
  89. }
  90. },
  91. computed: {
  92. //ios底部安全区域
  93. safeAreaBottom() {
  94. let info = uni.getSystemInfoSync()
  95. let safe = 20
  96. if (
  97. info &&
  98. ['devtools', 'ios'].includes(info.platform) &&
  99. info.statusBarHeight > safe
  100. ) {
  101. return info.statusBarHeight - safe+'px'
  102. }
  103. return 0
  104. }
  105. },
  106. methods: {
  107. //选择反馈类型
  108. RadioChange(e){
  109. this.data.feedbackType=e.detail.value
  110. },
  111. /**输入问题描述
  112. * @param {Object} e
  113. */
  114. input(e){
  115. this.data.content=e.detail.value
  116. },
  117. sumit(){
  118. this.data.agnecyId=this.$cache.get('agencyId')
  119. if (this.$cache.get('loginType')==this.$loginType.STAFF) {
  120. let userInfo=getApp().globalData.userInfo
  121. this.data.openId=userInfo.openId
  122. this.data.name=userInfo.realName
  123. this.data.phone=userInfo.phone
  124. }else if(this.$cache.get('loginType')==this.$loginType.ENTERPRISE){
  125. this.data.name=this.$cache.get('enterpriseName')
  126. }
  127. this.data.images=this.imgList.join(',')
  128. if (this.$isEmpty(this.data.content)) {
  129. uni.showToast({
  130. title:"问题描述不能为空",
  131. icon:"none"
  132. })
  133. return
  134. }
  135. if (this.data.content.length<3) {
  136. uni.showToast({
  137. title:"问题描述不能少于三个字",
  138. icon:"none"
  139. })
  140. return
  141. }
  142. if (this.$isEmpty(this.data.images)) {
  143. uni.showToast({
  144. title:"请提供相关截图",
  145. icon:"none"
  146. })
  147. return
  148. }
  149. this.$api.feedback.submit(this.data).then(res=>{
  150. if (res.success) {
  151. this.$showModel('提交成功,感谢您的反馈!',false).then(res=>{
  152. uni.navigateBack({
  153. delta:1
  154. })
  155. })
  156. }
  157. })
  158. },
  159. /**
  160. * 上传问题截图
  161. */
  162. chooseImage() {
  163. let that=this
  164. uni.chooseImage({
  165. count: 4-this.imgList.length,
  166. sizeType: ['original', 'compressed'],
  167. sourceType: ['album'],
  168. success: (res) => {
  169. const tempFilePaths = res.tempFilePaths;
  170. for (let index in tempFilePaths) {
  171. that.$api.uploadFile.submit(tempFilePaths[index]).then(res=>{
  172. that.imgList.push(res.data)
  173. })
  174. }
  175. }
  176. });
  177. },
  178. /*预览图片*/
  179. viewImage(index) {
  180. uni.previewImage({
  181. urls: this.imgList,
  182. current: index
  183. });
  184. },
  185. /*删除图片*/
  186. DelImg(index) {
  187. uni.showModal({
  188. title: '提示',
  189. content: '确定要删除这张照片吗?',
  190. cancelText: '取消',
  191. confirmText: '确定',
  192. success: res => {
  193. if (res.confirm) {
  194. this.imgList.splice(index, 1)
  195. }
  196. }
  197. })
  198. },
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. .page{
  204. background-color: #FFFFFF;
  205. min-height: 100vh;
  206. }
  207. view{
  208. box-sizing: border-box;
  209. }
  210. .commit{
  211. color: #fff;
  212. font-size: 28upx;
  213. text-align: center;
  214. line-height: 88upx;
  215. margin: 0 20upx;
  216. width: 690upx;
  217. height:88upx;
  218. background:$base-color;
  219. border-radius:25px;
  220. margin-bottom: 50upx;
  221. position: absolute;
  222. left: 0;
  223. right: 0;
  224. bottom: 0;
  225. }
  226. .content{
  227. margin: 0 26rpx;
  228. .radioBox{
  229. padding-top: 10rpx;
  230. .radioItem{
  231. padding: 18rpx;
  232. margin-bottom: 15rpx;
  233. border-radius: 10rpx;
  234. }
  235. .defalutBorder{
  236. border: 1rpx solid #d1d1d1;
  237. }
  238. .checkBorder{
  239. border: 1rpx solid $base-color;
  240. color: $base-color;
  241. }
  242. }
  243. .area{
  244. margin-top: 20rpx;
  245. padding: 20rpx;
  246. border-radius: 12rpx;
  247. border: 1rpx solid #d1d1d1;
  248. textarea{
  249. width: 100%;
  250. line-height: 50rpx;
  251. }
  252. .imgArea{
  253. border-top: 1rpx solid #d1d1d1;
  254. padding-top: 30rpx;
  255. }
  256. }
  257. }
  258. </style>