pointsRecord.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <!-- 积分记录 -->
  2. <template>
  3. <view id="pointsRecord">
  4. <view class="top-max-box">
  5. <img src="@/pages_student/images/icon_wd_jlf.png">
  6. <view>当前积分:</view>
  7. <view>{{recordNum}}</view>
  8. </view>
  9. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  10. <view class="for-info-box" v-for="(item,index) in infoList" :key="index" @click="goInfoPage(item)">
  11. <view class="left-box">
  12. <view>{{item.remark}}</view>
  13. <view>{{item.createTime}}</view>
  14. </view>
  15. <view class="right-box" :class="{'colorA':item.recordType.code == 1}">{{item.recordType.code==1?'+':'-'}}{{item.points}}</view>
  16. </view>
  17. <view class="get-null-box" v-if="getData.nullDataType">暂无更多数据</view>
  18. </scroll-view>
  19. </view>
  20. </template>
  21. <script>
  22. import { listMyApp,countMyApp } from '@/api/apiDemo/index.js'
  23. export default {
  24. data() {
  25. return {
  26. recordNum:"",
  27. infoList:[],
  28. //列表请求参数
  29. getData:{
  30. page:1,
  31. pageSize:20,
  32. getType:true,
  33. nullDataType:true,
  34. }
  35. }
  36. },
  37. onLoad() {
  38. this.clearData();
  39. this.countMyApp();
  40. this.getList();
  41. },
  42. methods: {
  43. //获取积分总数
  44. async countMyApp() {
  45. const {data} = await countMyApp()
  46. if(data.code == 200){
  47. if(data.data){
  48. this.recordNum = data.data;
  49. }else{
  50. this.recordNum = 0;
  51. }
  52. }
  53. },
  54. //清除
  55. clearData(){
  56. this.recordNum = "";
  57. this.infoList = [];
  58. this.getData.page = 1;
  59. this.getData.getType = true;
  60. this.getData.nullDataType = true;
  61. },
  62. //滚动事件
  63. scrollGet(){
  64. if(this.getData.getType){
  65. this.getData.page += 1;
  66. this.getList();
  67. }
  68. },
  69. //获取列表数据
  70. async getList(){
  71. let self = this;
  72. let obj = {
  73. pageNum:this.getData.page,
  74. pageSize:this.getData.pageSize,
  75. }
  76. const {data} = await listMyApp(obj)
  77. if(data.code==200){
  78. if(self.page==1){
  79. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  80. self.infoList = data.rows;
  81. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  82. self.infoList = data.rows;
  83. self.getData.getType = false;
  84. self.getData.nullDataType = true;
  85. }else{
  86. self.getData.getType = false;
  87. self.getData.nullDataType = true;
  88. }
  89. }else{
  90. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  91. self.infoList = self.infoList.concat(data.rows)
  92. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  93. self.infoList = self.infoList.concat(data.rows);
  94. self.getData.getType = false;
  95. self.getData.nullDataType = true;
  96. }else{
  97. self.getData.getType = false;
  98. self.getData.nullDataType = true;
  99. }
  100. }
  101. }
  102. },
  103. }
  104. }
  105. </script>
  106. <style lang="stylus" scoped>
  107. #pointsRecord{
  108. height:100%;
  109. width:100%;
  110. display flex;
  111. flex-direction column
  112. .top-max-box{
  113. height:100rpx;
  114. display flex
  115. background :#fff;
  116. margin-bottom:20rpx;
  117. img{
  118. height:30rpx;
  119. width:30rpx;
  120. margin:35rpx 35rpx 35rpx 20rpx;
  121. }
  122. view:nth-child(2){
  123. line-height:99rpx;
  124. font-size:30rpx;
  125. color: #999999;
  126. width:150rpx;
  127. }
  128. view:nth-child(3){
  129. flex:1;
  130. line-height:99rpx;
  131. font-size:30rpx;
  132. color: #333333;
  133. }
  134. }
  135. .info-max-box{
  136. flex:1;
  137. overflow: scroll
  138. .for-info-box:nth-child(1){
  139. border:none;
  140. }
  141. .for-info-box{
  142. background #fff
  143. // height:120rpx;
  144. border-top:1rpx solid #F5F5F5;
  145. display flex
  146. .left-box{
  147. margin-left:20rpx;
  148. flex:1;
  149. view:nth-child(1){
  150. width:500rpx;
  151. line-height: 30rpx;
  152. font-size: 28rpx;
  153. color: #333333;
  154. margin-top:23rpx;
  155. }
  156. view:nth-child(2){
  157. line-height: 20rpx;
  158. font-size: 26rpx;
  159. color: #999999;
  160. margin:23rpx 0;
  161. }
  162. }
  163. .right-box{
  164. width:200rpx;
  165. line-height:120rpx;
  166. font-size: 28rpx;
  167. text-align right;
  168. margin-right:20rpx;
  169. }
  170. .colorA{
  171. color:#12AE2B;
  172. }
  173. }
  174. .get-null-box{
  175. height:100rpx;
  176. line-height:100rpx;
  177. color:#999;
  178. text-align center
  179. }
  180. }
  181. }
  182. </style>