GroupPraise.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="group-praise">
  3. <!-- 广播 -->
  4. <div class="group-praise__broadcast">
  5. <i class="group-praise__broadcast--icon icon_transport transport-laba1"></i>
  6. <div class="group-praise__broadcastListWrap">
  7. <ul class="group-praise__broadcastList" :class="{marquee_top:animate}" :style="{transform:'translateY('+(0.375*n)+'rem)'}">
  8. <li
  9. v-for="(item,i) in evaluateUserList"
  10. :key="i"
  11. >【{{item[0]}}】配送人员「{{item[1]}}」 {{item[2]}}</li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="group-praise__content">
  16. <div class="group-praise__circle">
  17. <header class="group-praise__title">NO.2</header>
  18. <div class="group-praise__circleContent" v-if="evaluateGroutList[1]">
  19. <p class="group-praise__circleName ellipsis">{{evaluateGroutList[1][1]}}</p>
  20. <p class="group-praise__circlePercent">{{evaluateGroutList[1][4]}}%</p>
  21. </div>
  22. </div>
  23. <div class="group-praise__circle--win">
  24. <header class="group-praise__title">NO.1</header>
  25. <div class="group-praise__circleContent" v-if="evaluateGroutList[0]">
  26. <p class="group-praise__circleName ellipsis">{{evaluateGroutList[0][1]}}</p>
  27. <p class="group-praise__circlePercent">{{evaluateGroutList[0][4]}}%</p>
  28. </div>
  29. </div>
  30. <div class="group-praise__circle">
  31. <header class="group-praise__title">NO.3</header>
  32. <div class="group-praise__circleContent" v-if="evaluateGroutList[2]">
  33. <p class="group-praise__circleName ellipsis">{{evaluateGroutList[2][1]}}</p>
  34. <p class="group-praise__circlePercent">{{evaluateGroutList[2][4]}}%</p>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { post, timer2 } from './../http/http'
  42. export default {
  43. name: 'GroupPraise',
  44. inject: ['hospitalId'],
  45. data () {
  46. return {
  47. allData: {},
  48. fontSize: parseFloat(document.querySelector('html').style.fontSize),
  49. timer: null,
  50. animate: false,
  51. timer1: null,
  52. n: 0,
  53. evaluateGroutList: [], // 小组排名(无序)
  54. evaluateUserList: [], // 滚动数据
  55. disY: 0.375, // 滚动数据偏移量
  56. disHeight: 0, // 滚动数据高度
  57. isShow: true // 滚动数据显示隐藏
  58. }
  59. },
  60. methods: {
  61. // 无限滚动
  62. scrollInfinite () {
  63. clearTimeout(this.timer1)
  64. this.timer1 = setTimeout(() => {
  65. this.showMarquee()
  66. this.scrollInfinite()
  67. }, 2000)
  68. },
  69. // 处理数组方法
  70. showMarquee () {
  71. this.animate = true
  72. this.n--
  73. if (this.n === -(this.evaluateUserList.length)) {
  74. this.animate = false
  75. this.n = 0
  76. }
  77. },
  78. // 近30天小组好评排行
  79. async getGroupPraise () {
  80. const srartTime = this.$moment()
  81. .subtract(29, 'days')
  82. .format('YYYY-MM-DD') // 近三十天
  83. const endTime = this.$moment().format('YYYY-MM-DD') // 今天
  84. const result = await post(
  85. `/largeScreen/getData/groupEvaluateRanking/${this.hospitalId}`,
  86. { srartTime, endTime }
  87. )
  88. this.evaluateGroutList = result.evaluateGroutList
  89. this.evaluateGroutList.sort((a, b) => b[4] - a[4]) // 排行从高往低排序
  90. this.evaluateUserList = result.evaluateUserList
  91. this.polling()
  92. if (this.evaluateUserList.length > 0) {
  93. this.evaluateUserList = [...this.evaluateUserList, this.evaluateUserList[0]]
  94. this.scrollInfinite()
  95. }
  96. },
  97. // 轮询请求
  98. polling () {
  99. clearTimeout(this.timer)
  100. this.timer = setTimeout(() => {
  101. this.getGroupPraise()
  102. }, timer2)
  103. }
  104. },
  105. mounted () {
  106. this.getGroupPraise()
  107. },
  108. beforeDestroy () {
  109. clearTimeout(this.timer)
  110. clearTimeout(this.timer1)
  111. }
  112. }
  113. </script>
  114. <style lang="less">
  115. .group-praise {
  116. height: 2.7125rem;
  117. padding-top: 0.2rem;
  118. padding-bottom: 0.375rem;
  119. .group-praise__broadcast {
  120. height: 0.4rem;
  121. background-color: rgba(255, 255, 255, 0.2);
  122. border: solid 1px rgba(255, 255, 255, 0.2);
  123. display: flex;
  124. align-items: center;
  125. .group-praise__broadcast--icon {
  126. font-size: 0.275rem;
  127. color: #2496d2;
  128. margin-left: 0.1rem;
  129. }
  130. .group-praise__broadcastListWrap {
  131. flex: 1;
  132. height: 0.375rem;
  133. line-height: 0.375rem;
  134. padding-left: 0.2rem;
  135. padding-right: 0.1rem;
  136. overflow: hidden;
  137. .group-praise__broadcastList {
  138. &.marquee_top {
  139. transition: all 1s;
  140. }
  141. li {
  142. word-break: break-all;
  143. }
  144. }
  145. }
  146. }
  147. .group-praise__content {
  148. display: flex;
  149. justify-content: center;
  150. .group-praise__title {
  151. color: #c2ab70;
  152. font-size: 0.2rem;
  153. font-weight: 700;
  154. text-align: center;
  155. }
  156. .group-praise__circleContent {
  157. color: #fff;
  158. font-size: 0.175rem;
  159. height: 0.875rem;
  160. display: flex;
  161. align-items: center;
  162. justify-content: center;
  163. flex-direction: column;
  164. line-height: 1.3em;
  165. text-align: center;
  166. .group-praise__circleName {
  167. width: 0.725rem;
  168. }
  169. }
  170. .group-praise__circle {
  171. width: 1.2rem;
  172. height: 1.2rem;
  173. margin-top: 0.4rem;
  174. position: relative;
  175. &::after {
  176. content: "";
  177. opacity: 0.5;
  178. width: 100%;
  179. height: 100%;
  180. background: url("./../assets/img/image_no2.png") no-repeat;
  181. background-size: 100%;
  182. position: absolute;
  183. left: 0;
  184. top: 0;
  185. }
  186. }
  187. .group-praise__circle--win {
  188. width: 1.7625rem;
  189. height: 1.6875rem;
  190. margin: 0.05rem 0.1375rem 0;
  191. position: relative;
  192. &::after {
  193. content: "";
  194. position: absolute;
  195. left: 0;
  196. top: 0;
  197. opacity: 0.5;
  198. width: 100%;
  199. height: 100%;
  200. background: url("./../assets/img/image_no1.png") no-repeat;
  201. background-size: 100%;
  202. }
  203. .group-praise__circleContent {
  204. margin-top: 0.1rem;
  205. }
  206. }
  207. }
  208. }
  209. </style>