ranking.vue 4.1 KB

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