ranking.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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="position: relative;" class="floatBlck">
  35. <view style="width:150rpx;position: relative;" class="td" @click="show" :data-e="index">
  36. {{i.schoolName}}
  37. </view>
  38. <view :class="floatTd>9?'floatTd2':'floatTd'" v-if="floatTd==index">
  39. {{i.schoolName}}
  40. </view>
  41. </view>
  42. </uni-td>
  43. <uni-td>
  44. <view class="td" style="width:100rpx">
  45. {{i.views}}
  46. </view>
  47. </uni-td>
  48. <uni-td>
  49. <view class="td" style="width:100rpx">
  50. {{i.signNum}}
  51. </view>
  52. </uni-td>
  53. <uni-td>
  54. <view class="td" style="width:150rpx">
  55. {{i.act}}
  56. </view>
  57. </uni-td>
  58. </uni-tr>
  59. </view>
  60. </uni-table>
  61. <!-- </scroll-view> -->
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. navBarData: {
  70. title: '排行',
  71. btn: 0
  72. },
  73. floatTd: -1,
  74. arrlist: [],
  75. adv: {},
  76. topNum: 0
  77. };
  78. },
  79. onShareTimeline() {
  80. uni.share({
  81. provider: "weixin",
  82. scene: "WXSceneTimeline",
  83. type: 0,
  84. href: "http://uniapp.dcloud.io/",
  85. title: "uni-app分享",
  86. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  87. imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
  88. success: function(res) {
  89. console.log("success:" + JSON.stringify(res));
  90. },
  91. fail: function(err) {
  92. console.log("fail:" + JSON.stringify(err));
  93. }
  94. });
  95. },
  96. // 分享
  97. onShareAppMessage() {
  98. uni.share({
  99. provider: "weixin",
  100. scene: "WXSceneSession",
  101. type: 1,
  102. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  103. success: function(res) {
  104. console.log("success:" + JSON.stringify(res));
  105. },
  106. fail: function(err) {
  107. console.log("fail:" + JSON.stringify(err));
  108. }
  109. });
  110. },
  111. methods: {
  112. scrollYE(e) {
  113. if (e.detail.scrollTop >= 100) {
  114. this.topNum = 100
  115. console.log(this.topNum);
  116. }
  117. },
  118. getdata() {
  119. this.$request('/selectUserActivity', "get", {
  120. oid: this.$store.state.user.openid
  121. }).then(res => {
  122. // return console.log(res[0]);
  123. this.arrlist = res[0]
  124. this.arrlist.forEach(e => {
  125. // console.log(e);
  126. e.act = e.act.toFixed(0)
  127. })
  128. // this.arrlist.sort(function(a, b) {
  129. // return b.act - a.act
  130. // });
  131. })
  132. },
  133. show(e) {
  134. if (this.floatTd != -1) return
  135. let data = e.currentTarget.dataset.e
  136. // console.log(data);
  137. this.floatTd = data
  138. setTimeout(() => {
  139. this.floatTd = -1
  140. }, 1500);
  141. // uni.showToast({
  142. // title: data,
  143. // icon: 'none'
  144. // })
  145. },
  146. // getMag() {
  147. // this.$request('/selectAllMessage', "POST", {
  148. // oid: this.$store.state.user.openid
  149. // }).then(res => {
  150. // console.log('获取未读信息', res[0][0].msg);
  151. // let num = res[0][0].msg
  152. // this.msgn = num
  153. // if (num == 0) {
  154. // uni.hideTabBarRedDot({
  155. // index: 3
  156. // })
  157. // } else {
  158. // uni.setTabBarBadge({
  159. // index: 3,
  160. // text: num.toString()
  161. // })
  162. // }
  163. // })
  164. // },
  165. gotoHome() {
  166. // console.log(this.adv);
  167. // const web = this.classList[this.current];
  168. const url = this.adv.href
  169. uni.navigateTo({
  170. url: "/pages/skipone/skipone?item=" + encodeURIComponent(JSON.stringify(url))
  171. // url: "/pages/skipone/skipone?url=" + encodeURIComponent(JSON.stringify(url)),
  172. });
  173. },
  174. // 获取顶部大图
  175. getAdv() {
  176. this.$request('/selectAdvertisement', "get", {
  177. typ: 1
  178. }).then(res => {
  179. // console.log(res);
  180. this.adv = res[0][0]
  181. })
  182. }
  183. },
  184. onLoad() {
  185. this.getAdv()
  186. },
  187. onShow() {
  188. this.floatTd = -1
  189. // this.getMag()
  190. this.getAllMessage() // 调用app.js中的方法
  191. this.getdata()
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .ranking {
  197. display: flex;
  198. flex-direction: column;
  199. height: 100vh;
  200. width: 750rpx;
  201. .top {
  202. width: 750rpx;
  203. height: 288rpx;
  204. display: flex;
  205. margin-bottom: 20rpx;
  206. align-items: center;
  207. background-color: #fff;
  208. justify-content: center;
  209. image {
  210. height: 246rpx;
  211. width: 690rpx;
  212. border-radius: 10rpx;
  213. }
  214. }
  215. .scrollV {
  216. overflow: hidden;
  217. flex: 1;
  218. display: flex;
  219. width: 750rpx;
  220. position: relative;
  221. }
  222. }
  223. .table-header {
  224. position: sticky;
  225. left: 0;
  226. top: 0;
  227. z-index: 99999;
  228. background-color: #fff;
  229. }
  230. /deep/ .uni-table-tr {
  231. display: flex;
  232. }
  233. /deep/ .table--border {
  234. box-sizing: border-box;
  235. // border-right: 1px #000 solid;
  236. }
  237. /deep/ .uni-table-th {
  238. background-color: #F7FBFF;
  239. padding: 0px 0;
  240. height: 40px;
  241. line-height: 40px;
  242. padding-left: 20rpx;
  243. display: flex;
  244. flex-shrink: 0;
  245. }
  246. /deep/ .uni-table-td {
  247. padding: 0px 0;
  248. height: 40px;
  249. border-right: none;
  250. border-bottom: none;
  251. }
  252. /deep/ .uni-table-td:nth-child(1) {
  253. background-color: #F7FBFF;
  254. }
  255. .td {
  256. display: -webkit-box;
  257. word-break: break-all;
  258. text-overflow: ellipsis;
  259. overflow: hidden;
  260. -webkit-box-orient: vertical;
  261. -webkit-line-clamp: 1;
  262. height: 40px;
  263. padding-left: 20rpx;
  264. line-height: 40px;
  265. box-sizing: border-box;
  266. border-right: 1px #ebeef5 solid;
  267. border-bottom: 1px #ebeef5 solid;
  268. }
  269. .floatTd {
  270. position: absolute;
  271. top: 0;
  272. left: 0;
  273. min-height: 100%;
  274. width: 350rpx;
  275. white-space: wrap;
  276. display: flex;
  277. align-items: center;
  278. z-index: 999;
  279. background-color: #ccc;
  280. padding: 0 5px;
  281. }
  282. .floatTd2 {
  283. position: absolute;
  284. bottom: 0;
  285. left: 0;
  286. min-height: 100%;
  287. width: 350rpx;
  288. display: flex;
  289. align-items: center;
  290. z-index: 999;
  291. white-space: wrap;
  292. background-color: #ccc;
  293. padding: 0 5px;
  294. }
  295. </style>