suggest.vue 2.6 KB

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