studentInfo.vue 3.9 KB

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