gui-submit-comment.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <gui-popup
  3. ref="guipopupforsubcomment"
  4. position="bottom"
  5. :canCloseByShade="true"
  6. @close="closePop"
  7. :zIndex="zIndex">
  8. <view class="gui-comments gui-bg-white"
  9. @tap.stop.prevent="stopfun">
  10. <text class="gui-comments-at gui-block-text"
  11. :style="{color:atColor}"
  12. v-if="comment.at != ''">@ {{comment.at}}</text>
  13. <view style="height:20rpx;"
  14. v-if="comment.at == ''"></view>
  15. <view
  16. class="gui-flex gui-rows gui-nowrap gui-space-between">
  17. <view class="gui-comments-img gui-relative"
  18. v-if="comment.img != ''">
  19. <image :src="comment.img"
  20. class="gui-comments-img-in"
  21. mode="widthFix"></image>
  22. <text class="gui-comments-img-remove gui-icons"
  23. @tap="removeImg"
  24. :style="{color:removeBtnColor}">&#xe78a;</text>
  25. </view>
  26. <textarea :show-confirm-bar="false"
  27. cursor-spacing="200" v-model="comment.content"
  28. class="gui-comments-textarea gui-border-box gui-bg-gray"
  29. :placeholder="placeholder" />
  30. </view>
  31. <view class="gui-flex gui-rows gui-space-between gui-align-items-center">
  32. <text class="gui-comments-btns gui-icons gui-color-gray"
  33. @tap="selectImg" v-if="isImg">&#xe63d;</text>
  34. <text class="gui-comments-btns" v-if="!isImg"></text>
  35. <view class="gui-comments-submit"
  36. hover-class="gui-tap">
  37. <text class="gui-comments-btns gui-comments-submit gui-icons"
  38. :style="{color:submitColor}"
  39. @tap="submit">提交</text>
  40. </view>
  41. </view>
  42. <view class="">
  43. <gui-iphone-bottom></gui-iphone-bottom>
  44. </view>
  45. </view>
  46. </gui-popup>
  47. </template>
  48. <script>
  49. export default{
  50. name : "gui-submit-comment",
  51. props : {
  52. placeholder : { type : String, default : "说点什么吧"},
  53. isImg : { type : Boolean, default : true},
  54. atColor : { type : String, default : '#008AFF'},
  55. submitColor : { type : String, default : '#008AFF'},
  56. removeBtnColor : { type : String, default : '#FF0036'},
  57. zIndex : { type : Number, default : 999}
  58. },
  59. data() {
  60. return {
  61. comment : {img:'', content:'',at:''}
  62. }
  63. },
  64. methods:{
  65. open : function(){
  66. this.$refs.guipopupforsubcomment.open();
  67. },
  68. close : function(){
  69. this.$refs.guipopupforsubcomment.close();
  70. this.$emit('close');
  71. },
  72. closePop : function(){
  73. this.$emit('close');
  74. },
  75. stopfun : function(e){
  76. e.stopPropagation();
  77. return null;
  78. },
  79. submit : function () {
  80. this.$emit('submit', this.comment);
  81. this.close();
  82. this.comment = {img:'', content:'',at:''}
  83. },
  84. selectImg : function(){
  85. uni.chooseImage({
  86. count:1,
  87. success:(res)=>{this.comment.img = res.tempFilePaths[0];}
  88. });
  89. },
  90. removeImg : function () {
  91. this.comment.img = '';
  92. },
  93. setAt : function(name){
  94. this.comment.at = name;
  95. },
  96. setContent : function (content) {
  97. this.comment.content = content;
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped>
  103. .gui-comments{padding:10rpx 30rpx;}
  104. .gui-comments-at{line-height:80rpx; height:80rpx; font-size:28rpx; font-weight:bold;}
  105. .gui-comments-textarea{width:200rpx; border-radius:8rpx; padding:15rpx; font-size:26rpx; line-height:36rpx; height:160rpx; flex:1;}
  106. .gui-comments-img{width:160rpx; height:160rpx; margin-right:25rpx; font-size:0; overflow:hidden; border-radius:8rpx;}
  107. .gui-comments-img-in{width:160rpx;}
  108. .gui-comments-img-remove{width:60rpx; height:60rpx; line-height:60rpx; position:absolute; right:0; top:0; text-align:center; font-size:50rpx; color:#FF0036;}
  109. .gui-comments-btns{width:96rpx; height:80rpx; line-height:80rpx; font-size:44rpx;}
  110. .gui-comments-submit{width:180rpx; text-align:right; font-size:28rpx;}
  111. </style>