123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <template>
- <view class="content">
- <u-card :title="classInfo.name" :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>
- </u-card>
- <u-card title="授课教练" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <view class="techaer-info-box" slot="body">
- <u-image :src="classInfo.coachUrl" mode="aspectFill" width="80px" height="80px" border-radius="10px" style=""></u-image>
- <view class="techaer-info">
- <view class="class-info-title">{{classInfo.coachName}}</view>
- <view class="class-info-text">{{classInfo.coachName}}</view>
- </view>
- </view>
- </u-card>
- <u-card title="班级简介" title-size="32" :show-foot="true" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <view slot="body">
- <u-read-more :toggle="true" show-height="100" color="#333333" :shadow-style="shadowStyle">
- <view class="class-info-text">{{classInfo.desc}}</view>
- </u-read-more>
- </view>
- </u-card>
- <u-card title="班级近况" :show-foot="false" title-size="32" margin="0px" :head-style="cardStyle">
- <view class="class-show-box" slot="body">
- <view v-for="(item, index) in classInfo.showList" :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>
- </view>
- </view>
- </u-card>
- <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
- <scroll-view scroll-y class="student-box">
- <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
- margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
- <view class="student-card" slot="body">
- <view class="class-info-text">性别:{{item.sex}} 年龄:{{item.age}}</view>
- </view>
- </u-card>
- </scroll-view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
- @click="goToSubscribelForm()">新增学员</u-button>
- </u-popup>
- <u-popup v-model="subscribeShow" mode="bottom" border-radius="30">
- <scroll-view scroll-y class="student-box">
- <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
- margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="subscribeStudent(item)">
- <view class="student-card" slot="body">
- <view class="class-info-text">性别:{{item.sex}} 年龄:{{item.age}}</view>
- </view>
- </u-card>
- </scroll-view>
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
- @click="goToSubscribelForm()">新增学员</u-button>
- </u-popup>
- <view class="handle-fix-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="subscribeShow = true">预约体验</u-button>
- <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,...handleStyleLeft}" @click="subscribeShow = true">预约体验</u-button> -->
- <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,...handleStyleRight}" @click="enlistShow = true">立即报名</u-button> -->
- </view>
- <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'customStyle',
- ])
- },
- data() {
- return {
- classId: '',
- classInfo: {
- name: '',
- classStartDate: '',
- classStartHours: '',
- residue: '',
- address: '',
- coachName: '',
- coachDesc: '',
- coachUrl: '',
- desc: '',
- showList: [],
- classExtrasList: [],
- },
- handleStyleLeft: {
- borderRadius: '40px 0 0 40px',
- borderRight: '1px solid #ffffff'
- },
- handleStyleRight: {
- borderRadius: '0 40px 40px 0',
- borderLeft: '1px solid #ffffff'
- },
- cardStyle: {
- fontWeight: 'bold'
- },
- shadowStyle: {
- backgroundImage: 'linear-gradient(to bottom, transparent 80rpx, #ffffff 80rpx, #ffffff 100rpx)',
- paddingTop: "100rpx",
- marginTop: "-100rpx"
- },
- enlistShow: false,
- studentList1: [],
- subscribeShow: false,
- studentList2: [],
- }
- },
- onLoad(options) {
- this.classId = options.id
- this.initialize()
- },
- onShow() {
- NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
- this.studentList1 = res.data.row
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
- this.studentList2 = res.data.row
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- onPullDownRefresh() {
- this.initialize()
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 500)
- },
- methods: {
- // 获取初始化数据
- initialize() {
- NET.request(API.getClassDetail, {
- id: this.classId
- }, 'POST').then(res => {
- this.classInfo = res.data
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 学员报名
- enlistStudent(item) {
- NET.request(API.enlistStudent, {
- classId: this.classId,
- studentId: item.studentId,
- }, 'POST').then(res => {
- this.enlistShow = false
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 学员预约
- subscribeStudent(item) {
- NET.request(API.subscribeStudent, {
- classId: this.classId,
- studentId: item.studentId,
- }, 'POST').then(res => {
- this.subscribeShow = false
- this.$refs.uTips.show({
- title: res.message,
- type: 'success',
- })
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 跳转新增学员表单
- goToSubscribelForm() {
- uni.navigateTo({
- url: '/pagesMember/subscribelForm'
- });
- },
- },
- }
- </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: 2px;
- }
- }
- .student-box {
- max-height: 200px;
- padding: 0 15px;
- margin: 25px 0 0 0;
- box-sizing: border-box;
- overflow: auto;
- /deep/.u-card__head {
- padding-bottom: 0px !important;
- }
- }
- .techaer-info-box {
- display: flex;
- .techaer-info {
- flex: 1;
- margin-left: 10px;
- .class-info-title {
- font-size: 14px;
- font-weight: bold;
- margin-bottom: 5px;
- }
- }
- }
- .class-show-box {
- width: 100%;
- float: left;
- .class-show-card {
- width: calc(50% - 16px);
- margin: 0 8px 16px 8px;
- float: left;
- .class-show-name {
- width: 100%;
- text-align: center;
- line-height: 20px;
- font-size: 14px;
- margin-top: 5px;
- }
- .video-col {
- width: 100%;
- height: 30vw;
- border-radius: 10px;
- video {
- width: 100%;
- height: 30vw;
- }
- }
- }
- }
- .handle-fix-box {
- u-button {
- width: 100%;
- display: inline-block;
- }
- }
- }
- </style>
|