ranking.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. onShareTimeline() {
  74. uni.share({
  75. provider: "weixin",
  76. scene: "WXSceneTimeline",
  77. type: 0,
  78. href: "http://uniapp.dcloud.io/",
  79. title: "uni-app分享",
  80. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  81. imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
  82. success: function(res) {
  83. console.log("success:" + JSON.stringify(res));
  84. },
  85. fail: function(err) {
  86. console.log("fail:" + JSON.stringify(err));
  87. }
  88. });
  89. },
  90. // 分享
  91. onShareAppMessage() {
  92. uni.share({
  93. provider: "weixin",
  94. scene: "WXSceneSession",
  95. type: 1,
  96. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  97. success: function(res) {
  98. console.log("success:" + JSON.stringify(res));
  99. },
  100. fail: function(err) {
  101. console.log("fail:" + JSON.stringify(err));
  102. }
  103. });
  104. },
  105. methods: {
  106. scrollYE(e) {
  107. if (e.detail.scrollTop >= 100) {
  108. this.topNum = 100
  109. console.log(this.topNum);
  110. }
  111. },
  112. getdata() {
  113. this.$request('/selectUserActivity', "get", {
  114. oid: this.$store.state.user.openid
  115. }).then(res => {
  116. // return console.log(res[0]);
  117. this.arrlist = res[0]
  118. this.arrlist.forEach(e => {
  119. // console.log(e);
  120. e.act = e.act.toFixed(0)
  121. })
  122. // this.arrlist.sort(function(a, b) {
  123. // return b.act - a.act
  124. // });
  125. })
  126. },
  127. show(e) {
  128. let data = e.currentTarget.dataset.e
  129. // console.log(data);
  130. uni.showToast({
  131. title: data,
  132. icon: 'none'
  133. })
  134. },
  135. // getMag() {
  136. // this.$request('/selectAllMessage', "POST", {
  137. // oid: this.$store.state.user.openid
  138. // }).then(res => {
  139. // console.log('获取未读信息', res[0][0].msg);
  140. // let num = res[0][0].msg
  141. // this.msgn = num
  142. // if (num == 0) {
  143. // uni.hideTabBarRedDot({
  144. // index: 3
  145. // })
  146. // } else {
  147. // uni.setTabBarBadge({
  148. // index: 3,
  149. // text: num.toString()
  150. // })
  151. // }
  152. // })
  153. // },
  154. gotoHome() {
  155. // console.log(this.adv);
  156. // const web = this.classList[this.current];
  157. const url = this.adv.href
  158. uni.navigateTo({
  159. url: "/pages/skipone/skipone?item=" + encodeURIComponent(JSON.stringify(url))
  160. // url: "/pages/skipone/skipone?url=" + encodeURIComponent(JSON.stringify(url)),
  161. });
  162. },
  163. // 获取顶部大图
  164. getAdv() {
  165. this.$request('/selectAdvertisement', "get", {
  166. typ: 1
  167. }).then(res => {
  168. // console.log(res);
  169. this.adv = res[0][0]
  170. })
  171. }
  172. },
  173. onLoad() {
  174. this.getAdv()
  175. },
  176. onShow() {
  177. // this.getMag()
  178. this.getAllMessage() // 调用app.js中的方法
  179. this.getdata()
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .ranking {
  185. display: flex;
  186. flex-direction: column;
  187. height: 100vh;
  188. width: 750rpx;
  189. .top {
  190. width: 750rpx;
  191. height: 288rpx;
  192. display: flex;
  193. margin-bottom: 20rpx;
  194. align-items: center;
  195. background-color: #fff;
  196. justify-content: center;
  197. image {
  198. height: 246rpx;
  199. width: 690rpx;
  200. border-radius: 10rpx;
  201. }
  202. }
  203. .scrollV {
  204. overflow: hidden;
  205. flex: 1;
  206. display: flex;
  207. width: 750rpx;
  208. position: relative;
  209. }
  210. }
  211. .table-header {
  212. position: sticky;
  213. left: 0;
  214. top: 0;
  215. z-index: 99999;
  216. background-color: #fff;
  217. }
  218. /deep/ .uni-table-tr {
  219. display: flex;
  220. }
  221. /deep/ .table--border {
  222. box-sizing: border-box;
  223. // border-right: 1px #000 solid;
  224. }
  225. /deep/ .uni-table-th {
  226. background-color: #F7FBFF;
  227. padding: 0px 0;
  228. height: 40px;
  229. line-height: 40px;
  230. padding-left: 20rpx;
  231. display: flex;
  232. flex-shrink: 0;
  233. }
  234. /deep/ .uni-table-td {
  235. padding: 0px 0;
  236. height: 40px;
  237. border-right: none;
  238. border-bottom: none;
  239. }
  240. /deep/ .uni-table-td:nth-child(1) {
  241. background-color: #F7FBFF;
  242. }
  243. .td {
  244. display: -webkit-box;
  245. word-break: break-all;
  246. text-overflow: ellipsis;
  247. overflow: hidden;
  248. -webkit-box-orient: vertical;
  249. -webkit-line-clamp: 1;
  250. height: 40px;
  251. padding-left: 20rpx;
  252. line-height: 40px;
  253. box-sizing: border-box;
  254. border-right: 1px #ebeef5 solid;
  255. border-bottom: 1px #ebeef5 solid;
  256. }
  257. </style>