feedback.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!-- 意见反馈 -->
  2. <template>
  3. <view class="wrap">
  4. <view class="textarea-box">
  5. <textarea class="textarea" maxlength=300 placeholder='请输入问题描述,点击下方“+”号提交截图,帮助我们更快定位您的问题'
  6. placeholder-class="placeholder" @input="sumfontnum"></textarea>
  7. <view class="num"><text>{{fontNum}}</text>/300</view>
  8. </view>
  9. <view class="input-box">
  10. <input type="text" value="" class="input" placeholder="请输入联系方式" placeholder-class="placeholder" />
  11. </view>
  12. <view class="img-container">
  13. <view class="note-image-box">
  14. <view class="note-image-item" v-for="(item,index) in imageLists" :key="index">
  15. <view class="close-icon" @click="del(index)">
  16. <image src="../../../static/del-img.png" mode=""></image>
  17. </view>
  18. <view class="image-box" @click="previewImg(index)">
  19. <image :src="item.url" class="img" mode="aspectFill"></image>
  20. </view>
  21. </view>
  22. <view v-if="imageLists.length < 9" class="note-image-item" @click="addImage">
  23. <image src="../../../static/upload.png" class="add-img" mode="aspectFill"></image>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="btn-box">
  28. <button type="default" class="active">提交反馈</button>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. fontNum: 0,
  37. imageLists: [], //存放图片数组
  38. }
  39. },
  40. methods: {
  41. // 限制文本框字数
  42. sumfontnum(e) {
  43. console.log(e)
  44. this.fontNum = e.detail.value.length
  45. },
  46. //删除图片
  47. del(index) {
  48. this.imageLists.splice(index, 1)
  49. },
  50. //添加图片
  51. addImage() {
  52. const count = 9 - this.imageLists.length
  53. uni.chooseImage({
  54. count: count,
  55. success: res => {
  56. let tempfilepaths = res.tempFilePaths
  57. tempfilepaths.forEach((item, index) => {
  58. // 处理h5多选的情况
  59. if (index < count) {
  60. this.imageLists.push({
  61. url: item
  62. })
  63. }
  64. })
  65. }
  66. })
  67. },
  68. //查看图片
  69. previewImg(index){
  70. let urls = []
  71. for(let i = 0;i < this.imageLists.length;i++){
  72. urls.push(this.imageLists[i].url)
  73. }
  74. uni.previewImage({
  75. current:index,
  76. urls:urls,
  77. })
  78. },
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. @import "./feedback.css";
  84. </style>