studentInfo.vue 4.6 KB

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