123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- <template>
- <view class="content">
- <u-card :title="classInfo.name" :sub-title="classInfo.useLessonsType == 1 ? '体验班' : ''" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <view slot="body">
- <view class="class-info-text">
- <u-icon name="clock"></u-icon>
- {{classInfo.classStartDate}} ~ {{classInfo.classEndDate}}
- </view>
- <view class="class-info-text" v-for="(item, index) in classInfo.classExtrasList" :key="index">
- <u-icon name="calendar" style="visibility: hidden;"></u-icon>
- <text>{{item.week}} {{item.startTime}}-{{item.endTime}}</text>
- </view>
- <view class="class-info-text">
- <u-icon name="map"></u-icon>
- {{classInfo.address}}
- </view>
- <!--<view style="display: flex;justify-content: flex-end;" v-if="classInfo.state != 0">-->
- <view style="display: flex;justify-content: flex-end;">
- <u-button type="warning" :custom-style="{background: mainColor}" size="mini" shape="circle" :ripple="true" @click="handleUpdateClassClick">修改</u-button>
- <u-button v-if="!classInfo.studentSignList.length" type="warning" :custom-style="{background: mainColor,marginLeft: '5px'}" size="mini" shape="circle" :ripple="true" @click="handleDeleteClick">删除</u-button>
- </view>
- </view>
- </u-card>
- <u-card :title="'学员信息(' + getStudentsNumber(1) + ')'" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <u-grid :col="3" slot="body" :border="false">
- <u-grid-item v-for="(item, index) in classInfo.studentSignList" :key="index" :custom-style="gridCustomStyle" @click="goToStudentInfo(item)">
- <view class="class-student-col">
- {{item.name}}
- <u-icon :name="item.state == 1 ? 'bookmark-fill' : 'bookmark'" :color="mainColor" size="48"></u-icon>
- </view>
- </u-grid-item>
- </u-grid>
- </u-card>
- <u-card margin="0px 0px 10px 0px" :head-style="cardStyle" :show-head="false" @click="handleScanClick" v-if="classInfo.useLessonsType==1">
- <view slot="body" style="display: flex;justify-content: space-between;">
- <view style="font-size: 32rpx;font-weight: bold;color:#000000;">扫码</view>
- <u-icon name="scan" size="32"></u-icon>
- </view>
- </u-card>
- <u-card :title="'事假(' + getStudentsNumber(2) + ')'" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <u-grid :col="3" slot="body" :border="false" v-if="classInfo.studentLeaveRecordList.length">
- <u-grid-item v-for="(item, index) in classInfo.studentLeaveRecordList" :key="index" :custom-style="gridCustomStyle">
- <view class="class-student-col" @click="handleleaveClick(item)">
- {{item.name}}
- <u-icon :name="item.agreeType == 1 ? 'bookmark-fill' : 'bookmark'" :color="mainColor" size="48"></u-icon>
- </view>
- </u-grid-item>
- </u-grid>
- </u-card>
- <u-card :title="'病假结束确认(' + getStudentsNumber(3) + ')'" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <u-grid :col="3" slot="body" :border="false" v-if="classInfo.studentLeaveList.length">
- <u-grid-item v-for="(item, index) in classInfo.studentLeaveList" :key="index" :custom-style="gridCustomStyle">
- <view class="class-student-col" @click="handleOtherClick(item)">
- {{item.name}}
- <u-icon name="'bookmark" :color="mainColor" size="48"></u-icon>
- </view>
- </u-grid-item>
- </u-grid>
- </u-card>
- <u-card :title="'续费卡和自定义卡(' + getStudentsNumber(4) + ')'" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <u-grid :col="3" slot="body" :border="false" v-if="classInfo.studentRenewList.length">
- <u-grid-item v-for="(item, index) in classInfo.studentRenewList" :key="index" :custom-style="gridCustomStyle">
- <view class="class-student-col" :class="item.state ? 'student-active' : ''" @click="handleVtCardClick(item)">
- {{item.name}}
- <u-icon name="bookmark" :color="mainColor" size="48"></u-icon>
- </view>
- </u-grid-item>
- </u-grid>
- </u-card>
- <u-card title="班级近况" :sub-title="imgEdit ? '完成' : '管理'" :sub-title-color="imgEdit ? '#19be6b' : '#909399'" :show-foot="false"
- title-size="32" margin="0px" :head-style="cardStyle" @sub-click="imgEdit = !imgEdit">
- <view class="class-show-box" slot="body">
- <view v-for="(item, index) in classShowList" :key="index" class="class-show-card">
- <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px" v-if="item.type == 0"></u-image>
- <view class="video-col" v-if="item.type == 1">
- <video :src="item.url" object-fit="cover" controls :id="'video' + index"></video>
- </view>
- <view class="class-show-name">{{item.name}}</view>
- <u-icon name="close-circle-fill" color="#fa3534" size="48" v-if="imgEdit" class="delete-icon" @click="deleteClassShow(item)"></u-icon>
- </view>
- <view class="class-show-card" style="width: calc(100% - 16px);text-align: center;" v-if="imgEdit">
- <u-icon name="plus-circle-fill" size="100" :color="mainColor" @click="uploadTypeShow = true"></u-icon>
- </view>
- </view>
- </u-card>
- <view class="handle-fix-box" v-if="classInfo.state==1">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToSignForm">立即签到</u-button>
- </view>
- <u-action-sheet :list="uploadTypeList" v-model="uploadTypeShow" @click="selectUploadType"></u-action-sheet>
- <!-- 事假 -->
- <u-popup v-model="leaveShow" mode="center" border-radius="30" width="600rpx">
- <view class="common-title">事假</view>
- <view class="menber-box">
- <u-form :model="leaveForm" ref="leaveFormRef" label-width="140">
- <u-form-item label="请假时间" prop="time">
- <u-input v-model="leaveForm.time" disabled type="text" />
- </u-form-item>
- <u-form-item label="请假理由" prop="leaveReason">
- <u-input v-model="leaveForm.leaveReason" disabled type="text" />
- </u-form-item>
- </u-form>
- <view style="height:20px;"></view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleAgreeClick">同意</u-button>
- </view>
- </u-popup>
- <!-- 病假确认 -->
- <u-modal v-model="leaveOtherShow" content="提示" show-cancel-button @confirm="handleEndClick">
- <view style="text-align: center;margin: 10px 0;">
- 是否确认{{ studentName }}的病假结束?
- </view>
- </u-modal>
- <!-- 续费卡 -->
- <u-popup v-model="vtCardShow" mode="center" border-radius="30" width="600rpx">
- <view class="common-title">请选择</view>
- <view class="menber-box">
- <u-radio-group v-model="orderId">
- <u-radio class="menber-col" v-for="(item,index) in vtCardList" :key="index" :name="item.orderId">
- <view class="menber-label" >卡名:{{ item.cardName }}-{{item.cardType==4?'自定义卡':'续费卡'}}</view>
- <!-- <view class="menber-label">售价: ¥ 1111</view> -->
- <!-- <view class="menber-label">使用时间: 11111</view> -->
- <!-- <u-checkbox v-model="true" active-color="#ff6e3e">选择</u-checkbox> -->
- <!-- <view class="menber-icon iconfont iconzu4931"></view> -->
- </u-radio>
- </u-radio-group>
- <view style="height:20px;"></view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleAffirmClick">确认</u-button>
- </view>
- </u-popup>
- <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 {
- classId: '',
- studentId: '',
- studentName: '',
- recordId: '',
- classInfo: {
- name: '',
- classStartDate: '',
- classStartHours: '',
- classEndDate: '',
- classEndHours: '',
- residue: '',
- address: '',
- studentLeaveList: [],
- classExtrasList: [],
- studentSignList: [],
- showList: [],
- studentLeaveRecordList: [],
- studentRenewList: []
- },
- classShowList: [],
- uploadTypeShow: false,
- uploadTypeList: [{
- text: '图片'
- },
- {
- text: '视频'
- }
- ],
- imgEdit: false,
- cardStyle: {
- fontWeight: 'bold'
- },
- gridCustomStyle: {
- padding: '0 2px'
- },
- leaveShow: false,
- leaveForm: {},
- leaveOtherShow: false,
- vtCardShow: false,
- vtCardId: '',
- vtCardValue: '',
- orderId:'',
- cardId:'',
- vtCardList: [],
- trainList: [
- {
- id: 1,
- text: '一对一(或一对多)面授'
- },
- {
- id: 2,
- text: '大班额面授课'
- },
- {
- id: 3,
- text: '小班额面授课'
- },
- {
- id: 4,
- text: '本班开班不受最低人数限制'
- },
- {
- id: 5,
- text: '其他方式'
- },
- ],
- }
- },
- onLoad(options) {
- this.classId = options.id
- },
- onShow() {
- this.initialize()
- this.getClassShow()
- },
- onPullDownRefresh() {
- this.initialize()
- this.getClassShow()
- },
- methods: {
- // 获取初始化数据
- initialize() {
- NET.request(API.getClassDetail, {
- id: this.classId
- }, 'POST').then(res => {
- this.classInfo = res.data
- console.log(this.classInfo.venueId)
- uni.stopPullDownRefresh();
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 扫码
- handleScanClick() {
- try {
- let that = this
- uni.scanCode({
- onlyFromCamera: true,
- success: function (res) {
- console.log(res)
- // const studentId = parseInt(res.result)
- if(res.result.indexOf("xinghuoclass66889955224477")==-1){
- that.$refs.uTips.show({
- title: "二维码错误",
- type: 'success',
- })
- return false;
- }
- const studentId = res.result.replace("xinghuoclass66889955224477",'')
- const classId = parseInt(that.classId)
- NET.request(API.classCourseWriteOff, {
- studentId,classId
- }, 'POST').then(res => {
- if(res.status == 10000) {
- that.initialize()
- that.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- } else {
- that.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- }
- }).catch(error => {
- that.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- fail: function (res) {
- that.$refs.uTips.show({
- title: "调用摄像头失败",
- type: 'warning',
- })
- },
- });
- } catch {
- this.$refs.uTips.show({
- title: "调用摄像头失败",
- type: 'warning',
- })
- }
- },
- // 班级近况
- getClassShow() {
- NET.request(API.getClassDetailShowList, {
- id: this.classId,
- page: 0,
- size: 1000
- }, 'POST').then(res => {
- this.classShowList = res.data.row
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 删除班级(班级内无学员)
- handleDeleteClick() {
- NET.request(API.deleteById, {
- id: parseInt(this.classId)
- }, 'POST').then( res=> {
- if(res.status == 10000) {
- uni.navigateBack({})
- }
- })
- },
- // 获取学生数量
- getStudentsNumber(num) {
- // 1 学生数晾 2 事假数量 3 续费卡数量
- switch (num){
- case 1:
- return this.classInfo.studentSignList.length
- case 2:
- return this.classInfo.studentLeaveRecordList.length
- case 3:
- return this.classInfo.studentLeaveList.length
- case 4:
- return this.classInfo.studentRenewList.length
- }
- },
- handleOtherClick(item) {
- this.studentId = item.id
- this.studentName = item.name
- this.recordId = item.leaveRecordId
- this.leaveOtherShow = true
- },
- // 病假知晓
- handleEndClick() {
- NET.request(API.leaveLessonsEndOk,{
- recordId:parseInt(this.recordId), studentId:parseInt(this.studentId)
- },'POST').then(res=> {
- if(res.status == 10000) {
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- this.initialize()
- this.getClassShow()
- } else {
- this.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- }
- })
- },
- // 事假信息
- handleleaveClick(item) {
- if(item.agreeType == 1) return
- NET.request(API.leaveLessonsInfo,{
- id: parseInt(item.leaveRecordId)
- },'POST').then(res=> {
- if(res.status == 10000) {
- this.leaveForm = { ...res.data }
- this.leaveShow = true
- } else {
- this.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- }
- })
- },
- // 事假信息->同意
- handleAgreeClick() {
- NET.request(API.leaveLessonsOk, {
- leaveId: parseInt(this.leaveForm.leaveId)
- }, 'POST').then(res => {
- if(res.status == 10000) {
- this.leaveShow = false
- this.leaveForm = {}
- this.initialize()
- } else {
- this.leaveShow = false
- this.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- }
- })
- },
- // 续费卡列表
- handleVtCardClick(item) {
- this.studentId = parseInt(item.id)
- const data = {
- studentId: parseInt(this.studentId),
- classId: parseInt(this.classId)
- }
- NET.request(API.stuRenewalCardList, data, 'POST').then(res=> {
- if(res.status == 10000) {
- this.vtCardList = res.data
- this.vtCardShow = true
- } else {
- this.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- this.vtCardShow = false
- }
- })
- },
- // 续费卡切换
- handleRadioChange(orderId) {
- this.vtCardId = this.vtCardList.find( item => item.orderId = orderId).cardId
- this.vtCardValue = this.vtCardList.find( item => item.orderId = orderId).cardName
- this.orderId=orderId
- console.log(this.orderId)
- },
- // 续费卡确认
- handleAffirmClick() {
- let that = this
- const data = {
- cardId: this.vtCardList.find( item => item.orderId == that.orderId).cardId,
- studentId: parseInt(this.studentId),
- classId: parseInt(this.classId),
- orderId:parseInt(this.orderId)
- }
- //console.log(that.orderId)
- //console.log(data)
- ///return false
- NET.request(API.openRenewalCard, data,'POST').then(res=> {
- console.log(res)
- if(res.status == 10000) {
- this.vtCardShow = false
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- this.initialize()
- } else {
- this.$refs.uTips.show({
- title: res.message,
- type: 'warning',
- })
- this.vtCardShow = false
- }
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 选择上传文件类型
- selectUploadType(index) {
- if (index == 0) {
- uni.chooseImage({
- count: 1,
- success: (res) => {
- this.uploadFile(res.tempFilePaths[0])
- },
- fail: (error) => {
- }
- });
- } else if (index) {
- uni.chooseVideo({
- count: 1,
- success: (res) => {
- this.uploadFile(res.tempFilePath)
- },
- fail: (error) => {
- }
- });
- }
- },
- // 上传文件
- uploadFile(path) {
- let that = this
- uni.uploadFile({
- url: API.uploadFile,
- filePath: path,
- name: 'file',
- header: {
- Authorization: uni.getStorageSync('token')
- },
- success: (uploadFileRes) => {
- that.uploadSuccess(JSON.parse(uploadFileRes.data).data.id)
- }
- });
- },
- // 文件上传成功回调
- uploadSuccess(id) {
- NET.request(API.insertClassShow, {
- fileId: [id],
- id: this.classId,
- }, 'POST').then(res => {
- this.getClassShow()
- this.$refs.uTips.show({
- title: '班级近况发布成功',
- type: 'success',
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 删除班级近况
- deleteClassShow(site) {
- NET.request(API.deleteClassShow, {
- id: site.id,
- }, 'POST').then(res => {
- this.getClassShow()
- this.$refs.uTips.show({
- title: '删除成功',
- type: 'success',
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 跳转修改班级
- handleUpdateClassClick() {
- let getInfo = this.trainList.find(item => item.id == this.classInfo.classTypeDesc)
- let info = ''
- if(!getInfo) {
- info = '其他方式'
- this.classInfo.otherType = this.classInfo.classTypeDesc
- this.classInfo.classTypeDesc = 5
- } else {
- info = getInfo.text
- }
- const form = {
- classId: this.classId,
- name: this.classInfo.name,
- classTypeDesc: this.classInfo.classTypeDesc,
- classTypeInfo: info,
- otherType: this.classInfo.otherType,
- startDate: this.classInfo.classStartDate,
- endDate: this.classInfo.classEndDate,
- timeReqList: this.classInfo.classExtrasList,
- maxStudentCount: this.classInfo.maxStudentCount,
- }
- if(this.classInfo.state == 3 || this.classInfo.state == 1) {
- uni.navigateTo({
- url: '/pagesClass/updateClassForm?form=' + encodeURIComponent(JSON.stringify(form))
- });
- } else {
- uni.navigateTo({
- url: '/pagesClass/updateClassForm?classId=' + this.classId
- });
- }
-
- },
- // 跳转学生详情
- goToStudentInfo(item) {
- uni.navigateTo({
- url: '/pagesMain/studentInfo?type=1&id=' + item.id + '&classId=' + this.classId
- });
- },
- // 跳转签到表单
- goToSignForm() {
- uni.removeStorageSync('signUserList')
- uni.navigateTo({
- url: '/pagesClass/signForm?id=' + this.classId + '&status=' + this.classInfo.signStatus+'&venueId=' + this.classInfo.venueId
- });
- },
- // 跳转续费卡详情
- jumpVtCardPage(id) {
- uni.navigateTo({
- url: `/pagesClass/vtCardInfo?id=${id}`
- })
- }
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #f7f7f7;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding-bottom: 60px;
- .class-info-text {
- color: #999999;
- line-height: 18px;
- u-icon {
- margin-right: 4px;
- }
- }
- .class-student-col {
- height: 28px;
- display: flex;
- padding: 0 10rpx;
- line-height: 28px;
- color: $mainColor;
- white-space: nowrap;
- border: 1px solid $mainColor;
- border-radius: 5px;
- /deep/u-icon {
- margin-left: 5px;
- }
- }
- .student-active {
- background-color: $mainColor;
- color: #FFFFFF;
- }
- .class-student-box {
- display: flex;
- justify-content: space-around;
- }
- .class-show-box {
- width: 100%;
- float: left;
- .class-show-card {
- width: calc(50% - 16px);
- margin: 0 8px 16px 8px;
- float: left;
- position: relative;
- .class-show-name {
- width: 100%;
- text-align: center;
- line-height: 20px;
- font-size: 14px;
- margin-top: 5px;
- }
- .delete-icon {
- position: absolute;
- right: -5px;
- top: -5px;
- }
- .video-col {
- width: 100%;
- height: 30vw;
- border-radius: 10px;
- video {
- width: 100%;
- height: 30vw;
- }
- }
- }
- }
-
- .menber-box {
- width: 100%;
- // float: left;
- padding: 10px 15px;
- margin-bottom: 10px;
-
- .menber-col {
- width: 100%;
- padding: 15px;
- margin-bottom: 10px;
- display: inline-block;
- background-color: #FFFFFF;
- border-radius: 15px;
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
- position: relative;
- overflow: hidden;
- box-sizing: border-box;
-
- .menber-label {
- width: 100%;
- margin-bottom: 5px;
- float: left;
- font-size: 14px;
- // line-height: 20px;
- }
-
- .menber-num {
- width: 100%;
- float: left;
- font-size: 26px;
- line-height: 28px;
- color: $mainColor;
- }
-
- .menber-icon {
- font-size: 100px;
- color: $mainColor;
- position: absolute;
- right: -5px;
- bottom: -30px;
- opacity: 0.5;
- }
- }
- }
- .common-title {
- width:100%;
- text-align: center;
- font-size: 20px;
- margin: 10px 0;
- }
- }
- </style>
|