123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <view class="content">
- <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="type != 1"
- :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
- @refresherrestore="onRestore">
- <u-cell-group>
- <u-cell-item :arrow="false" :title-style="{width: '100%'}">
- <view slot="title" style="display: flex;justify-content: center;">
- <u-avatar :src="studentInfo.studentImg || studentInfo.url" size="140"></u-avatar>
- </view>
- </u-cell-item>
- <u-cell-item title="学生姓名" :value="studentInfo.studentName || studentInfo.name" :arrow="false"></u-cell-item>
- <u-cell-item title="家长姓名" :value="studentInfo.fatherName || studentInfo.parentName" :arrow="false"></u-cell-item>
- <u-cell-item title="学生性别" :value="studentInfo.sex" :arrow="false"></u-cell-item>
- <u-cell-item title="学生年龄" :value="studentInfo.age" :arrow="false"></u-cell-item>
- <u-cell-item title="手机号码" :value="studentInfo.phone" :arrow="false"></u-cell-item>
- <u-cell-item title="剩余课时" :value="studentInfo.residue" :arrow="false"></u-cell-item>
- <u-cell-item title="过期时间" :value="studentInfo.expireTime" :arrow="false"></u-cell-item>
- <u-cell-item :title="type == 1 ? '成长历程' : '沟通记录'" :arrow="false" :title-style="{fontSize: '16px',fontWeight: 'bold'}"></u-cell-item>
- <u-cell-item :title="type == 1 ? item.name : item.coachName" :value="item.time" :label="item.content" :arrow="false"
- v-for="(item, index1) in tableList" :key="index1" :title-style="{fontSize: '14px',fontWeight: 'bold'}"></u-cell-item>
- </u-cell-group>
- <u-divider v-if="item.isOver" bg-color="transparent">没有更多了</u-divider>
- </scroll-view>
- <view class="handle-fix-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToRecordForm()">{{type == 1 ? '填写历程' : '填写沟通记录'}}</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- ])
- },
- data() {
- return {
- id: '',
- classId: '',
- type: '',
- studentInfo: {
- studentImg: '',
- studentName: '',
- fatherName: '',
- sex: '',
- age: '',
- phone: '',
- },
- triggered: false,
- isOver: false,
- pageIndex: 1,
- tableList: []
- }
- },
- onLoad(options) {
- this.id = options.id
- this.type = options.type
- this.classId = options.classId
- },
- onShow() {
- this.initialize()
- this.isOver = false
- this.pageIndex = 1
- this.tableList = []
- this.getTableList()
- },
- methods: {
- initialize() {
- NET.request(this.type == 1 ? API.getStudentDetail : API.getSignStudentInfo, {
- id: this.id,
- classId:this.classId
- }, 'POST').then(res => {
- this.studentInfo = res.data
- if (this.type == 1) {
- this.tableList = res.data.growList
- }
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 下拉刷新
- onRefresh() {
- this.triggered = true
- this.isOver = false
- this.pageIndex = 1
- this.tableList = []
- this.getTableList()
- },
- // 重置下拉刷新状态
- onRestore() {
- this.triggered = 'restore'
- this.triggered = false
- },
- // 懒加载
- handleLoadMore() {
- if (!this.isOver && this.type != 1) {
- this.pageIndex++
- this.getTableList()
- }
- },
- // 获取列表数据
- getTableList() {
- if (this.type != 1) {
- NET.request(this.type == 2 ? API.getRenewCommunicateList : API.getSignCommunicateList, {
- id: this.id,
- page: this.pageIndex,
- size: 10,
- }, 'POST').then(res => {
- this.triggered = false
- this.tableList = this.tableList.concat(res.data.row)
- this.isOver = res.data.row.length != 10
- }).catch(error => {
- this.triggered = false
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- }
- },
- // 跳转沟通记录与成长经历表单
- goToRecordForm() {
- if (this.type == 1) {
- uni.navigateTo({
- url: '/pagesClass/courseForm?id=' + this.id + '&classId=' + this.classId
- });
- } else {
- uni.navigateTo({
- url: '/pagesMain/communicateForm?id=' + this.id + '&type=' + this.type
- });
- }
- }
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding: 0 0 60px 0;
- box-sizing: border-box;
- .scroll-box {
- width: 100%;
- height: calc(100vh - 60px);
- }
- }
- </style>
|