studentInfo.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="type != 1"
  4. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  5. @refresherrestore="onRestore">
  6. <u-cell-group>
  7. <u-cell-item :arrow="false" :title-style="{width: '100%'}">
  8. <view slot="title" style="display: flex;justify-content: center;">
  9. <u-avatar :src="studentInfo.studentImg || studentInfo.url" size="140"></u-avatar>
  10. </view>
  11. </u-cell-item>
  12. <u-cell-item title="学生姓名" :value="studentInfo.studentName || studentInfo.name" :arrow="false"></u-cell-item>
  13. <u-cell-item title="家长姓名" :value="studentInfo.fatherName || studentInfo.parentName" :arrow="false"></u-cell-item>
  14. <u-cell-item title="学生性别" :value="studentInfo.sex" :arrow="false"></u-cell-item>
  15. <u-cell-item title="学生年龄" :value="studentInfo.age" :arrow="false"></u-cell-item>
  16. <u-cell-item title="手机号码" :value="studentInfo.phone" :arrow="false"></u-cell-item>
  17. <u-cell-item title="剩余课时" :value="studentInfo.residue" :arrow="false"></u-cell-item>
  18. <u-cell-item title="过期时间" :value="studentInfo.expireTime" :arrow="false"></u-cell-item>
  19. <u-cell-item :title="type == 1 ? '成长历程' : '沟通记录'" :arrow="false" :title-style="{fontSize: '16px',fontWeight: 'bold'}"></u-cell-item>
  20. <u-cell-item :title="type == 1 ? item.name : item.coachName" :value="item.time" :label="item.content" :arrow="false"
  21. v-for="(item, index1) in tableList" :key="index1" :title-style="{fontSize: '14px',fontWeight: 'bold'}"></u-cell-item>
  22. </u-cell-group>
  23. <u-divider v-if="item.isOver" bg-color="transparent">没有更多了</u-divider>
  24. </scroll-view>
  25. <view class="handle-fix-box">
  26. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToRecordForm()">{{type == 1 ? '填写历程' : '填写沟通记录'}}</u-button>
  27. </view>
  28. <u-top-tips ref="uTips"></u-top-tips>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. mapGetters
  34. } from 'vuex'
  35. const NET = require('@/utils/request')
  36. const API = require('@/config/api')
  37. export default {
  38. computed: {
  39. ...mapGetters([
  40. 'mainColor',
  41. 'customStyle',
  42. ])
  43. },
  44. data() {
  45. return {
  46. id: '',
  47. classId: '',
  48. type: '',
  49. studentInfo: {
  50. studentImg: '',
  51. studentName: '',
  52. fatherName: '',
  53. sex: '',
  54. age: '',
  55. phone: '',
  56. },
  57. triggered: false,
  58. isOver: false,
  59. pageIndex: 1,
  60. tableList: []
  61. }
  62. },
  63. onLoad(options) {
  64. this.id = options.id
  65. this.type = options.type
  66. this.classId = options.classId
  67. },
  68. onShow() {
  69. this.initialize()
  70. this.isOver = false
  71. this.pageIndex = 1
  72. this.tableList = []
  73. this.getTableList()
  74. },
  75. methods: {
  76. initialize() {
  77. NET.request(this.type == 1 ? API.getStudentDetail : API.getSignStudentInfo, {
  78. id: this.id,
  79. classId:this.classId
  80. }, 'POST').then(res => {
  81. this.studentInfo = res.data
  82. if (this.type == 1) {
  83. this.tableList = res.data.growList
  84. }
  85. }).catch(error => {
  86. this.$refs.uTips.show({
  87. title: error.message,
  88. type: 'warning',
  89. })
  90. })
  91. },
  92. // 下拉刷新
  93. onRefresh() {
  94. this.triggered = true
  95. this.isOver = false
  96. this.pageIndex = 1
  97. this.tableList = []
  98. this.getTableList()
  99. },
  100. // 重置下拉刷新状态
  101. onRestore() {
  102. this.triggered = 'restore'
  103. this.triggered = false
  104. },
  105. // 懒加载
  106. handleLoadMore() {
  107. if (!this.isOver && this.type != 1) {
  108. this.pageIndex++
  109. this.getTableList()
  110. }
  111. },
  112. // 获取列表数据
  113. getTableList() {
  114. if (this.type != 1) {
  115. NET.request(this.type == 2 ? API.getRenewCommunicateList : API.getSignCommunicateList, {
  116. id: this.id,
  117. page: this.pageIndex,
  118. size: 10,
  119. }, 'POST').then(res => {
  120. this.triggered = false
  121. this.tableList = this.tableList.concat(res.data.row)
  122. this.isOver = res.data.row.length != 10
  123. }).catch(error => {
  124. this.triggered = false
  125. this.$refs.uTips.show({
  126. title: error.message,
  127. type: 'warning',
  128. })
  129. })
  130. }
  131. },
  132. // 跳转沟通记录与成长经历表单
  133. goToRecordForm() {
  134. if (this.type == 1) {
  135. uni.navigateTo({
  136. url: '/pagesClass/courseForm?id=' + this.id + '&classId=' + this.classId
  137. });
  138. } else {
  139. uni.navigateTo({
  140. url: '/pagesMain/communicateForm?id=' + this.id + '&type=' + this.type
  141. });
  142. }
  143. }
  144. },
  145. }
  146. </script>
  147. <style>
  148. page {
  149. width: 100%;
  150. height: 100%;
  151. position: relative;
  152. }
  153. </style>
  154. <style lang="scss" scoped>
  155. @import "@/static/css/themes.scss";
  156. .content {
  157. width: 100%;
  158. float: left;
  159. padding: 0 0 60px 0;
  160. box-sizing: border-box;
  161. .scroll-box {
  162. width: 100%;
  163. height: calc(100vh - 60px);
  164. }
  165. }
  166. </style>