kf.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <image src="../../static/img/kfheader.png" mode=""></image>
  5. <view class="kf-info">
  6. <view class="">
  7. Json
  8. </view>
  9. <view class="">
  10. 在綫
  11. </view>
  12. </view>
  13. </view>
  14. <view class="" style="height: 40rpx;">
  15. </view>
  16. <view class="flex lt lt-left">
  17. <view class="lt-time">
  18. </view>
  19. <view class="lt-wrap">
  20. 您好,請問有什麽可以幫您?
  21. </view>
  22. </view>
  23. <view class="flex lt" v-for="item in list" :class="{'lt-right': item.type== 2}">
  24. <view class="lt-time">
  25. {{item.time}}
  26. </view>
  27. <view class="lt-wrap">
  28. {{item.content}}
  29. </view>
  30. </view>
  31. <view class="" style="height:120rpx;">
  32. </view>
  33. <view class="foot">
  34. <input class="input-text" placeholder="請輸入信息内容" type="text" v-model="inputValue" focus />
  35. <view class="sub" @click="sub">发送</view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { uptxt,getlineinfo } from '@/api/login.js'
  41. export default {
  42. data() {
  43. return {
  44. inputValue: '',
  45. list: [],
  46. subing: false
  47. }
  48. },
  49. onLoad() {
  50. this.getlineinfo()
  51. },
  52. onShow() {
  53. },
  54. onReachBottom() {
  55. this.getlineinfo()
  56. },
  57. onReady() {
  58. },
  59. methods: {
  60. sub() {
  61. let obj = this
  62. if(obj.subing) {
  63. return
  64. }
  65. if(obj.inputValue == '') {
  66. return obj.$api.msg('請輸入信息内容')
  67. }
  68. obj.subing = true
  69. uptxt({
  70. txt: obj.inputValue
  71. }).then(res => {
  72. console.log(res)
  73. obj.getlineinfo()
  74. obj.inputValue = ''
  75. obj.subing = false
  76. }).catch(err => {
  77. obj.subing = false
  78. })
  79. },
  80. getlineinfo() {
  81. getlineinfo().then(res => {
  82. console.log(res)
  83. this.list = res.data
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. page {
  91. height: 100%;
  92. background-color: #fff;
  93. }
  94. .foot {
  95. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  96. position: fixed;
  97. width: 100%;
  98. height: 100rpx;
  99. left: 0upx;
  100. bottom: 0;
  101. overflow: hidden;
  102. // background-color: red;
  103. background-color: #fff;
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. .input-text {
  108. line-height: 80rpx;
  109. height: 80rpx;
  110. width: 500rpx;
  111. // width: ;
  112. padding-left: 20rpx;
  113. border-radius: 20rpx;
  114. border: 1px solid #f5f5f5;
  115. margin-right: 40rpx;
  116. }
  117. .sub {
  118. width: 160rpx;
  119. height: 80rpx;
  120. line-height: 80rpx;
  121. background: linear-gradient(to left, #eeb80d, #ffe35b);
  122. text-align: center;
  123. border-radius: 20rpx;
  124. }
  125. }
  126. .lt-wrap {
  127. width: 514rpx;
  128. font-size: 28rpx;
  129. color: #707A8A;
  130. background-color: #f5f5f5;
  131. border-radius: 15rpx;
  132. padding: 10rpx 20rpx;
  133. }
  134. .lt {
  135. margin-bottom: 20rpx;
  136. padding: 0 40rpx;
  137. flex-direction: column;
  138. .lt-time {
  139. font-size: 28rpx;
  140. color: #FCD535;
  141. margin-bottom: 10rpx;
  142. }
  143. }
  144. .lt-right {
  145. // align-content: flex-end;
  146. align-items: flex-end;
  147. }
  148. .lt-left {
  149. align-items: flex-start;
  150. }
  151. </style>