ranking.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="ranking">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="top">
  5. <image :src="adv.img" mode="aspectFill" @click="gotoHome">
  6. </image>
  7. </view>
  8. <view class="scrollV">
  9. <!-- <scroll-view style="flex: 1;" @scroll='scrollYE' :scroll-top="topNum" scroll-y="true"> -->
  10. <uni-table border stripe emptyText="暂无更多数据">
  11. <view class="table-header">
  12. <uni-tr>
  13. <uni-th width="100rpx" align="left">序号</uni-th>
  14. <uni-th width="150rpx" align="left">姓名</uni-th>
  15. <uni-th width="150rpx" align="left">单位</uni-th>
  16. <uni-th width="100rpx" align="left">课程</uni-th>
  17. <uni-th width="100rpx" align="left">活动</uni-th>
  18. <uni-th width="150rpx" align="left">活跃度</uni-th>
  19. </uni-tr>
  20. </view>
  21. <view class="warper">
  22. <uni-tr v-for="(i,index) in arrlist" :key="i.openid">
  23. <uni-td>
  24. <view class="td" style="width:100rpx">
  25. {{index + 1}}
  26. </view>
  27. </uni-td>
  28. <uni-td>
  29. <view style="width:150rpx" class="td" @click="show" :data-e="i.username">
  30. {{ i.username }}
  31. </view>
  32. </uni-td>
  33. <uni-td>
  34. <view style="width:150rpx" class="td" @click="show" :data-e="i.schoolName">
  35. {{i.schoolName}}
  36. </view>
  37. </uni-td>
  38. <uni-td>
  39. <view class="td" style="width:100rpx">
  40. {{i.views}}
  41. </view>
  42. </uni-td>
  43. <uni-td>
  44. <view class="td" style="width:100rpx">
  45. {{i.signNum}}
  46. </view>
  47. </uni-td>
  48. <uni-td>
  49. <view class="td" style="width:150rpx">
  50. {{i.act}}
  51. </view>
  52. </uni-td>
  53. </uni-tr>
  54. </view>
  55. </uni-table>
  56. <!-- </scroll-view> -->
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. navBarData: {
  65. title: '排行',
  66. btn: 0
  67. },
  68. arrlist: [],
  69. adv: {},
  70. topNum: 0
  71. };
  72. },
  73. methods: {
  74. scrollYE(e) {
  75. if (e.detail.scrollTop >= 100) {
  76. this.topNum = 100
  77. console.log(this.topNum);
  78. }
  79. },
  80. getdata() {
  81. this.$request('/selectUserActivity', "get", {
  82. oid: this.$store.state.user.openid
  83. }).then(res => {
  84. // return console.log(res[0]);
  85. this.arrlist = res[0]
  86. this.arrlist.forEach(e => {
  87. // console.log(e);
  88. e.act = e.act.toFixed(0)
  89. })
  90. // this.arrlist.sort(function(a, b) {
  91. // return b.act - a.act
  92. // });
  93. })
  94. },
  95. show(e) {
  96. let data = e.currentTarget.dataset.e
  97. // console.log(data);
  98. uni.showToast({
  99. title: data,
  100. icon: 'none'
  101. })
  102. },
  103. getMag() {
  104. this.$request('/selectAllMessage', "POST", {
  105. oid: this.$store.state.user.openid
  106. }).then(res => {
  107. console.log('获取未读信息', res[0][0].msg);
  108. let num = res[0][0].msg
  109. this.msgn = num
  110. if (num == 0) {
  111. uni.hideTabBarRedDot({
  112. index: 3
  113. })
  114. } else {
  115. uni.setTabBarBadge({
  116. index: 3,
  117. text: num.toString()
  118. })
  119. }
  120. })
  121. },
  122. gotoHome() {
  123. // console.log(this.adv);
  124. // const web = this.classList[this.current];
  125. const url = this.adv.href
  126. uni.navigateTo({
  127. url: "/pages/skipone/skipone?item=" + encodeURIComponent(JSON.stringify(url))
  128. // url: "/pages/skipone/skipone?url=" + encodeURIComponent(JSON.stringify(url)),
  129. });
  130. },
  131. // 获取顶部大图
  132. getAdv() {
  133. this.$request('/selectAdvertisement', "get", {
  134. typ: 1
  135. }).then(res => {
  136. // console.log(res);
  137. this.adv = res[0][0]
  138. })
  139. }
  140. },
  141. onLoad() {
  142. this.getAdv()
  143. },
  144. onShow() {
  145. // this.getMag()
  146. this.getAllMessage() // 调用app.js中的方法
  147. this.getdata()
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .ranking {
  153. display: flex;
  154. flex-direction: column;
  155. height: 100vh;
  156. width: 750rpx;
  157. .top {
  158. width: 750rpx;
  159. height: 288rpx;
  160. display: flex;
  161. margin-bottom: 20rpx;
  162. align-items: center;
  163. background-color: #fff;
  164. justify-content: center;
  165. image {
  166. height: 246rpx;
  167. width: 690rpx;
  168. border-radius: 10rpx;
  169. }
  170. }
  171. .scrollV {
  172. overflow: hidden;
  173. flex: 1;
  174. display: flex;
  175. width: 750rpx;
  176. position: relative;
  177. }
  178. }
  179. .table-header {
  180. position: sticky;
  181. left: 0;
  182. top: 0;
  183. z-index: 99999;
  184. background-color: #fff;
  185. }
  186. /deep/ .uni-table-tr {
  187. display: flex;
  188. }
  189. /deep/ .table--border {
  190. box-sizing: border-box;
  191. // border-right: 1px #000 solid;
  192. }
  193. /deep/ .uni-table-th {
  194. background-color: #F7FBFF;
  195. padding: 0px 0;
  196. height: 40px;
  197. line-height: 40px;
  198. padding-left: 20rpx;
  199. display: flex;
  200. flex-shrink: 0;
  201. }
  202. /deep/ .uni-table-td {
  203. padding: 0px 0;
  204. height: 40px;
  205. border-right: none;
  206. border-bottom: none;
  207. }
  208. /deep/ .uni-table-td:nth-child(1) {
  209. background-color: #F7FBFF;
  210. }
  211. .td {
  212. display: -webkit-box;
  213. word-break: break-all;
  214. text-overflow: ellipsis;
  215. overflow: hidden;
  216. -webkit-box-orient: vertical;
  217. -webkit-line-clamp: 1;
  218. height: 40px;
  219. padding-left: 20rpx;
  220. line-height: 40px;
  221. box-sizing: border-box;
  222. border-right: 1px #ebeef5 solid;
  223. border-bottom: 1px #ebeef5 solid;
  224. }
  225. </style>