suggest.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <uni-card class="box" :isFull="true" title="反馈意见" :thumbnail="contentIcon">
  4. <textarea v-model="data.content" placeholder="您的反馈对我们非常重要,请在此输入."></textarea>
  5. </uni-card>
  6. <uni-card class="box" :isFull="true" title="联系方式" :thumbnail="contactIcon">
  7. <input v-model="data.contact" placeholder="手机 QQ或e-mail,方便我们联系您" />
  8. </uni-card>
  9. <button class="submit-btn" @click="submit">提交</button>
  10. </view>
  11. </template>
  12. <script>
  13. import uniCard from '@/components/uni-card/uni-card.vue';
  14. export default {
  15. components:{
  16. uniCard
  17. },
  18. data() {
  19. return {
  20. data: {
  21. imgList: [],
  22. content: "",
  23. contact: ""
  24. },
  25. contentIcon: require("./icons/suggestion.png"),
  26. contactIcon: require("./icons/contact.png"),
  27. imgListIcon: require("./icons/image.png")
  28. }
  29. },
  30. methods: {
  31. chooseImage() {
  32. let _self = this;
  33. uni.chooseImage({
  34. sizeType: ['compressed', 'original'],
  35. sourceType: ['album', 'camera'],
  36. success: function(res) {
  37. _self.data.imgList = _self.data.imgList.concat(res.tempFiles)
  38. },
  39. fail: function(err) {
  40. console.log(err);
  41. }
  42. });
  43. },
  44. removeImage(index) {
  45. this.data.imgList.splice(index, 1)
  46. },
  47. previewImage(index) {
  48. uni.previewImage({
  49. current: index,
  50. urls: this.data.imgList.map(r => r.path)
  51. });
  52. },
  53. submit() {
  54. this.$emit("submit", this.data)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .box {
  61. margin-bottom: 20rpx;
  62. }
  63. .imgs {
  64. position: relative;
  65. display: inline-flex;
  66. flex-wrap: wrap;
  67. margin: 10rpx;
  68. width: 150rpx;
  69. height: 150rpx;
  70. .img {
  71. width: 100%;
  72. height: 100%;
  73. border-radius: 10rpx;
  74. border: 1rpx solid #ebebeb;
  75. }
  76. .remove {
  77. line-height: 30rpx;
  78. text-align: center;
  79. border-radius: 10rpx;
  80. position: absolute;
  81. right: 0rpx;
  82. top: 0rpx;
  83. width: 30rpx;
  84. height: 30rpx;
  85. font-weight: bold;
  86. background-color: #e53c25;
  87. }
  88. .add-img {
  89. background-color: #f0f0f0;
  90. }
  91. }
  92. .submit-btn {
  93. background-color: #49abe8;
  94. margin: 20rpx 0;
  95. }
  96. </style>