studentList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  4. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  5. @refresherrestore="onRestore">
  6. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  7. :key="index" class="class-card">
  8. <view class="class-content" slot="head" style="padding-top: 10px;">
  9. <span class="class-name" style="font-size: 36rpx;">{{item.studentName}}</span>
  10. <span v-if="item.headNum == -1" class="class-info-text" style="color:red;margin-left:10px;">资料不全</span><!-- -->
  11. </view>
  12. <view class="class-content" slot="body" style="display: flex;justify-content: space-between;">
  13. <view>
  14. <view class="class-info-text">家长姓名:{{item.fatherName}}</view>
  15. <view class="class-info-text">性别:{{item.sex}}</view>
  16. <view class="class-info-text">年龄:{{item.age}}岁</view>
  17. <view class="class-info-text">生日:{{item.birthday}}</view>
  18. <view class="class-info-text">联系方式:{{item.phone}}</view>
  19. </view>
  20. <view style="display: flex;align-items: flex-end;">
  21. <u-button type="warning" :custom-style="{background: mainColor}" size="mini" shape="circle" :ripple="true" @click="handleUpdateClassClick(item)">修改</u-button>
  22. </view>
  23. </view>
  24. </u-card>
  25. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  26. </scroll-view>
  27. <view class="handle-fix-box">
  28. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToSubscribelForm()">新增学员</u-button>
  29. </view>
  30. <u-top-tips ref="uTips"></u-top-tips>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. mapGetters
  36. } from 'vuex'
  37. const NET = require('@/utils/request')
  38. const API = require('@/config/api')
  39. export default {
  40. computed: {
  41. ...mapGetters([
  42. 'mainColor',
  43. 'customStyle',
  44. ])
  45. },
  46. data() {
  47. return {
  48. triggered: false,
  49. isOver: false,
  50. pageIndex: 1,
  51. tableList: [],
  52. }
  53. },
  54. onShow() {
  55. this.tableList = Object.assign([],this.$options.data().tabList)
  56. this.getTableList()
  57. },
  58. methods: {
  59. // 下拉刷新
  60. onRefresh() {
  61. this.triggered = true
  62. this.isOver = false
  63. this.pageIndex = 1
  64. this.tableList = []
  65. this.getTableList()
  66. },
  67. // 重置下拉刷新状态
  68. onRestore() {
  69. this.triggered = 'restore'
  70. this.triggered = false
  71. },
  72. // 懒加载
  73. handleLoadMore() {
  74. if (!this.isOver) {
  75. this.pageIndex++
  76. this.getTableList()
  77. }
  78. },
  79. // 获取列表数据
  80. getTableList() {
  81. NET.request(API.getStudentList, {
  82. page: this.pageIndex,
  83. size: 10,
  84. }, 'POST').then(res => {
  85. this.triggered = false
  86. this.tableList = this.tableList.concat(res.data.row)
  87. this.isOver = res.data.row.length != 10
  88. })
  89. },
  90. // 修改学员信息
  91. handleUpdateClassClick(item) {
  92. uni.navigateTo({
  93. url: '/pagesMember/subscribelForm?info=' + encodeURIComponent(JSON.stringify(item))
  94. });
  95. },
  96. // 跳转预定表单
  97. goToSubscribelForm() {
  98. uni.navigateTo({
  99. url: '/pagesMember/subscribelForm?id=' + this.classId
  100. });
  101. }
  102. },
  103. }
  104. </script>
  105. <style>
  106. page {
  107. width: 100%;
  108. height: 100%;
  109. background-color: #f7f7f7;
  110. }
  111. </style>
  112. <style lang="scss" scoped>
  113. @import "@/static/css/themes.scss";
  114. .content {
  115. width: 100%;
  116. float: left;
  117. .scroll-box {
  118. width: 100%;
  119. height: calc(100vh - 60px);
  120. padding-bottom: 10px;
  121. box-sizing: border-box;
  122. .class-card {
  123. .class-content {
  124. padding: 5px 15px;
  125. }
  126. .class-name {
  127. height: 20px;
  128. display: inline-block;
  129. font-weight: bold;
  130. font-size: 14px;
  131. line-height: 20px;
  132. }
  133. .class-info-text {
  134. color: #999999;
  135. margin-bottom: 5px;
  136. }
  137. }
  138. }
  139. }
  140. </style>