scorelist.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="score">
  3. <!-- 搜索 -->
  4. <view class="mb5 stfixed">
  5. <!-- :tablist="tablist" -->
  6. <search @getSearch="getSearch"></search>
  7. </view>
  8. <da-list :roles="roles" :datalist='list' :wtdt="wtdt" :datype="datype" @getDetail='getDetail'></da-list>
  9. </view>
  10. </template>
  11. <script>
  12. import {getDeptList} from "@/api/mine/mine.js"
  13. import {getscoreListFn} from "@/api/mine/score.js"
  14. import daList from "@/mine/components/list/list.vue"
  15. import search from "@/mine/components/search/search.vue"
  16. export default {
  17. data(){
  18. return{
  19. sucimg:require("@/mine/static/score/ncheck.png"),
  20. wtdt:'',
  21. datype:3,
  22. reachflag:true,
  23. list:[],
  24. roles:this.$store.state.user.choseroles,
  25. tablist:[],
  26. schoolId:'',
  27. pageSize:10,
  28. pageNum:1,
  29. }
  30. },
  31. components:{
  32. daList,search
  33. },
  34. onUnload() {
  35. uni.$off('refreshscorelist')
  36. },
  37. onLoad: function() {
  38. uni.$on('refreshscorelist', (e) => {
  39. this.reachflag = true;
  40. this.pageNum = 1;
  41. this.list = [];
  42. this.getscoreListFn();
  43. })
  44. this.getscoreListFn()
  45. },
  46. onReachBottom() {
  47. if (this.reachflag) {
  48. this.pageNum++
  49. this.getscoreListFn()
  50. }
  51. },
  52. methods:{
  53. getSearch(e){
  54. this.scoreTime=e;
  55. this.reachflag = true;
  56. this.pageNum = 1;
  57. this.list = [];
  58. this.getscoreListFn();
  59. },
  60. getscoreListFn(){
  61. var params={
  62. pageSize:this.pageSize,
  63. pageNum:this.pageNum,
  64. }
  65. if(this.scoreTime){
  66. params.scoreTime=this.scoreTime
  67. }
  68. var role=this.$store.state.user.choseroles;
  69. if(role!='school'){
  70. params['params[role]']=role
  71. }
  72. getscoreListFn(params).then(res=>{
  73. if(res.code==200){
  74. if (res.rows.length < this.pageSize) {
  75. this.reachflag = false
  76. this.wtdt = '到底了~';
  77. } else {
  78. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  79. if (num < res.total) {
  80. this.reachflag = true
  81. this.wtdt = '上拉加载更多'
  82. } else {
  83. this.reachflag = false
  84. this.wtdt = '到底了~';
  85. }
  86. }
  87. if (this.pageNum == 1) {
  88. this.list = res.rows;
  89. } else {
  90. this.list = this.list.concat(res.rows)
  91. }
  92. }else{
  93. this.$toast(res.msg)
  94. }
  95. })
  96. },
  97. getclassListFn(id){
  98. var that=this;
  99. getDeptList(id).then(res=>{
  100. if(res.code==200){
  101. that.tablist = res.data.map(v => {
  102. return {
  103. className: v.deptName,
  104. classId: v.deptId,
  105. schoolId:v.parentId
  106. }
  107. })
  108. that.classId=res.data[0].deptId;
  109. that.formdata.subjectClassId=that.classId;
  110. that.formdata.subjectClass=res.data[0].deptName;
  111. that.schoolId=res.data[0].parentId;
  112. that.dataflag=true;
  113. that.getCourselistFn()
  114. }else{
  115. that.$toast(res.msg)
  116. }
  117. })
  118. },
  119. getDetail(id){
  120. this.$tab.navigateTo('/mine/pages/release/details?id='+id)
  121. },
  122. },
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .stfixed{position: fixed;left: 0;top: 0;right: 0;background-color: #f1f1f1;z-index: 2;}
  127. .score{padding: 110rpx 36rpx 20rpx;}
  128. </style>