studentInfo.vue 3.8 KB

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