service.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="service">
  3. <view class="service_ul">
  4. <scroll-view scroll-y="true" refresher-default-style="none" @scrolltoupper="scrolltoupper" refresher-background="rgba(255,255,255,0)" id="scrollview" scroll-with-animation class="scroll-view" :scroll-top="scrollTop" :scroll-into-view="indexId">
  5. <view id="msglistview">
  6. <view class="service_ul_li" v-for="(item,index) in list" :key="index" >
  7. <view class="service_ul_left flexs" v-if="index % 2 == 0" :id="'index' + index">
  8. <view class="service_ul_left_ttx">这次工作很重要</view>
  9. <view class="service_ul_li_img">
  10. <image src="/static/logo.png" mode="aspectFill"></image>
  11. </view>
  12. </view>
  13. <view class="service_ul_right flexs" v-else>
  14. <view class="service_ul_li_img">
  15. <image src="/static/logo.png" mode="aspectFill"></image>
  16. </view>
  17. <view class="service_ul_right_txt">您还有其他交代吗您还有其他交代吗您还有其他交代吗?</view>
  18. </view>
  19. </view>
  20. </view>
  21. </scroll-view>
  22. </view>
  23. <view class="service_footer flex">
  24. <view class="service_footer_ipt flexs">
  25. <textarea auto-height maxlength="-1" v-model="keyword" @focus="changefocus" :focus="focus" hold-keyboard @confirm="submitSend" fixed confirm-type="send" />
  26. </view>
  27. <!-- <view class="service_footer_send center" @click="submitSend">发送</view> -->
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. keyword:'',
  36. focus:true,
  37. indexId:'index0',
  38. scrollTop:40,
  39. list:[0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//
  40. };
  41. },
  42. methods:{
  43. scrolltoupper (e) {
  44. console.log(e);
  45. this.list = [0,...this.list]
  46. },
  47. changefocus () {
  48. let u = navigator.userAgent, app = navigator.appVersion;
  49. let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
  50. if(isAndroid){
  51. setTimeout(function() {
  52. document.activeElement.scrollIntoViewIfNeeded();
  53. document.activeElement.scrollIntoView();
  54. }, 500);
  55. }
  56. },
  57. //获取页面高度
  58. getHeight () {
  59. setTimeout(()=>{
  60. let that = this
  61. let query = uni.createSelectorQuery()
  62. query.select('#scrollview').boundingClientRect()
  63. query.select('#msglistview').boundingClientRect()
  64. query.exec((res) => {
  65. if(res[1].height > res[0].height){
  66. that.scrollTop = res[1].height
  67. }
  68. })
  69. },100)
  70. },
  71. submitSend () {
  72. this.list.push(0)
  73. this.indexId = 'index' + (this.list.length - 1)
  74. this.focus = true
  75. this.keyword = ''
  76. this.getHeight()
  77. }
  78. },
  79. onLoad() {
  80. this.getHeight()
  81. setInterval(()=>{
  82. this.list.push(0)
  83. this.getHeight()
  84. },3000)
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. #msglistview {
  90. overflow: hidden;
  91. }
  92. .service_ul {
  93. // padding-right: 30rpx;
  94. }
  95. .scroll-view {
  96. width: 770rpx;
  97. overflow: hidden;
  98. padding: 0 0 0 30rpx;
  99. background: #FAFAFA;
  100. height: calc(100vh - 98rpx - 44px);
  101. .service_ul_left {
  102. display: flex;
  103. justify-content: flex-end;
  104. }
  105. .service_ul_left_ttx {
  106. padding: 20rpx;
  107. font-size: 32rpx;
  108. position: relative;
  109. background: #95EC69;
  110. border-radius: 10rpx;
  111. margin-right: 20rpx;
  112. &::after {
  113. content: '';
  114. top: 50%;
  115. right: -17rpx;
  116. transform: translateY(-50%);
  117. position: absolute;
  118. border-width: 9rpx;
  119. border-color: transparent transparent transparent #95EC69;
  120. border-style: dotted dotted dotted solid;
  121. }
  122. }
  123. .service_ul_right_txt {
  124. padding: 20rpx;
  125. font-size: 32rpx;
  126. position: relative;
  127. background: #FFFFFF;
  128. border-radius: 10rpx;
  129. margin-left: 20rpx;
  130. &::after {
  131. content: '';
  132. top: 50%;
  133. left: -17rpx;
  134. transform: translateY(-50%);
  135. position: absolute;
  136. border-width: 9rpx;
  137. border-color: transparent #FFFFFF transparent transparent ;
  138. border-style: dotted dotted dotted solid;
  139. }
  140. }
  141. .service_ul_li {
  142. padding-right: 50rpx;
  143. margin-bottom: 40rpx;
  144. &:first-child {
  145. margin-top: 40rpx;
  146. }
  147. }
  148. .service_ul_li_img {
  149. width: 80rpx;
  150. height: 80rpx;
  151. flex-shrink: 0;
  152. image {
  153. border-radius: 4rpx;
  154. }
  155. }
  156. }
  157. .service_footer {
  158. width: 100%;
  159. position: fixed;
  160. bottom: 0;
  161. background: #FFFFFF;
  162. padding: 20rpx 0 20rpx 30rpx;
  163. .service_footer_ipt {
  164. width: 605rpx;
  165. min-height: 56rpx;
  166. padding: 10rpx 20rpx;
  167. background: #FAFAFA;
  168. border-radius: 28rpx;
  169. }
  170. .service_footer_send {
  171. font-size: 28rpx;
  172. flex: 1;
  173. height: 56rpx;
  174. }
  175. }
  176. </style>