chatRoom.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="chat-room">
  3. <view class="chat-list">
  4. <view class="chat-item" v-for="(item,index) in list" :key="index">
  5. <view class="chat-msg">
  6. {{item.msg}}
  7. </view>
  8. <view class="head">
  9. </view>
  10. </view>
  11. </view>
  12. <view class="tool-box">
  13. <view class="input-box">
  14. <input class="input" type="text" confirm-type="send" @confirm="send" placeholder="请输入" v-model="value" />
  15. <image class="btn" src="../../static/emoji.png" mode=""></image>
  16. <image class="btn" src="../../static/add.png" mode="" @click="this.show = !this.show"></image>
  17. </view>
  18. <view class="box" v-if="show">
  19. <view class="item">
  20. <image class="icon" src="../../static/picture.png" mode=""></image>
  21. <view class="label">
  22. 照片
  23. </view>
  24. </view>
  25. <view class="item">
  26. <image class="icon" src="../../static/camera.png" mode=""></image>
  27. <view class="label">
  28. 拍照
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. show: false,
  40. value:'',
  41. list:[
  42. {
  43. type:'me',
  44. msg:'你好,为什么我的加油时不能使用'
  45. }
  46. ]
  47. }
  48. },
  49. methods: {
  50. send() {
  51. console.log(this.value);
  52. this.list.push(
  53. {
  54. type:'me',
  55. msg:this.value
  56. }
  57. )
  58. this.value = ''
  59. }
  60. },
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .chat-room {
  65. background: #F9F9F9;
  66. min-height: 100vh;
  67. padding: 0 30rpx 120rpx;
  68. .chat-list{
  69. display: flex;
  70. flex-direction: column;
  71. .chat-item{
  72. display: flex;
  73. align-items: center;
  74. align-self: flex-end;
  75. margin-bottom: 35rpx;
  76. .chat-msg{
  77. padding: 20rpx 40rpx;
  78. font-size: 28rpx;
  79. line-height: 38rpx;
  80. background: $uni-color-primary;
  81. border-radius: 40rpx 40rpx 0rpx 40rpx;
  82. color: #fff;
  83. margin: 0 30rpx;
  84. max-width: 460rpx;
  85. word-break: break-all;
  86. }
  87. .head{
  88. width: 92rpx;
  89. height: 92rpx;
  90. text-align: center;
  91. line-height: 92rpx;
  92. border-radius: 50%;
  93. background-color: #568FFF;
  94. color: #fff;
  95. }
  96. }
  97. }
  98. .tool-box{
  99. padding: 0 30rpx;
  100. position: fixed;
  101. bottom: 0%;
  102. left: 0;
  103. width: 750rpx;
  104. box-sizing: border-box;
  105. background: #fff;
  106. .input-box {
  107. display: flex;
  108. align-items: center;
  109. padding: 8rpx 0;
  110. .input {
  111. height: 80rpx;
  112. line-height: 80rpx;
  113. border-radius: 40rpx;
  114. background: #F9F9F9;
  115. padding-left: 30rpx;
  116. flex: 1;
  117. }
  118. .btn {
  119. width: 48rpx;
  120. height: 48rpx;
  121. margin: 0 10rpx;
  122. }
  123. }
  124. .box{
  125. display: flex;
  126. .item{
  127. display: flex;
  128. flex-direction: column;
  129. align-items: center;
  130. padding: 25rpx;
  131. .icon{
  132. width: 48rpx;
  133. height: 48rpx;
  134. }
  135. .label{
  136. font-size: 24rpx;
  137. color: #707070;
  138. margin-top: 10rpx;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. </style>