suggest.vue 2.5 KB

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