gui-submit-comment.vue 3.5 KB

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