classDetail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="content">
  3. <u-card :title="classInfo.name" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  4. <view slot="body">
  5. <view class="class-info-text">
  6. <u-icon name="clock"></u-icon>
  7. {{classInfo.classStartDate}}&nbsp;~&nbsp;{{classInfo.classEndDate}}
  8. </view>
  9. <view class="class-info-text" v-for="(item, index) in classInfo.classExtrasList" :key="index">
  10. <u-icon name="calendar" style="visibility: hidden;"></u-icon>
  11. <text>{{item.week}}&nbsp;{{item.startTime}}-{{item.endTime}}</text>
  12. </view>
  13. <view class="class-info-text">
  14. <u-icon name="map"></u-icon>
  15. {{classInfo.address}}
  16. </view>
  17. </view>
  18. </u-card>
  19. <u-card title="授课教练" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  20. <view class="techaer-info-box" slot="body">
  21. <u-image :src="classInfo.coachUrl" mode="aspectFill" width="80px" height="80px" border-radius="10px" style=""></u-image>
  22. <view class="techaer-info">
  23. <view class="class-info-title">{{classInfo.coachName}}</view>
  24. <view class="class-info-text">{{classInfo.coachName}}</view>
  25. </view>
  26. </view>
  27. </u-card>
  28. <u-card title="班级简介" title-size="32" :show-foot="true" margin="0px 0px 10px 0px" :head-style="cardStyle">
  29. <view slot="body">
  30. <u-read-more :toggle="true" show-height="100" color="#333333" :shadow-style="shadowStyle">
  31. <view class="class-info-text">{{classInfo.desc}}</view>
  32. </u-read-more>
  33. </view>
  34. </u-card>
  35. <u-card title="班级近况" :show-foot="false" title-size="32" margin="0px" :head-style="cardStyle">
  36. <view class="class-show-box" slot="body">
  37. <view v-for="(item, index) in classInfo.showList" :key="index" class="class-show-card">
  38. <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px" v-if="item.type == 0"></u-image>
  39. <view class="video-col" v-if="item.type == 1">
  40. <video :src="item.url" object-fit="cover" controls :id="'video' + index"></video>
  41. </view>
  42. <view class="class-show-name">{{item.name}}</view>
  43. </view>
  44. </view>
  45. </u-card>
  46. <u-popup v-model="enlistShow" mode="bottom" border-radius="30" :closeable="true">
  47. <scroll-view scroll-y class="student-box">
  48. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  49. margin="10px" borderRadius="20" v-for="(item, index) in studentList1" :key="index" @click="enlistStudent(item)">
  50. <view class="student-card" slot="body">
  51. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  52. </view>
  53. </u-card>
  54. </scroll-view>
  55. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  56. @click="goToSubscribelForm()">新增学员</u-button>
  57. </u-popup>
  58. <u-popup v-model="subscribeShow" mode="bottom" border-radius="30">
  59. <scroll-view scroll-y class="student-box">
  60. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  61. margin="10px" borderRadius="20" v-for="(item, index) in studentList2" :key="index" @click="subscribeStudent(item)">
  62. <view class="student-card" slot="body">
  63. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  64. </view>
  65. </u-card>
  66. </scroll-view>
  67. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  68. @click="goToSubscribelForm()">新增学员</u-button>
  69. </u-popup>
  70. <view class="handle-fix-box">
  71. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="subscribeShow = true">预约体验</u-button>
  72. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,...handleStyleLeft}" @click="subscribeShow = true">预约体验</u-button> -->
  73. <!-- <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,...handleStyleRight}" @click="enlistShow = true">立即报名</u-button> -->
  74. </view>
  75. <u-top-tips ref="uTips" zIndex="100000"></u-top-tips>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. mapGetters
  81. } from 'vuex'
  82. const NET = require('@/utils/request')
  83. const API = require('@/config/api')
  84. export default {
  85. computed: {
  86. ...mapGetters([
  87. 'customStyle',
  88. ])
  89. },
  90. data() {
  91. return {
  92. classId: '',
  93. classInfo: {
  94. name: '',
  95. classStartDate: '',
  96. classStartHours: '',
  97. residue: '',
  98. address: '',
  99. coachName: '',
  100. coachDesc: '',
  101. coachUrl: '',
  102. desc: '',
  103. showList: [],
  104. classExtrasList: [],
  105. },
  106. handleStyleLeft: {
  107. borderRadius: '40px 0 0 40px',
  108. borderRight: '1px solid #ffffff'
  109. },
  110. handleStyleRight: {
  111. borderRadius: '0 40px 40px 0',
  112. borderLeft: '1px solid #ffffff'
  113. },
  114. cardStyle: {
  115. fontWeight: 'bold'
  116. },
  117. shadowStyle: {
  118. backgroundImage: 'linear-gradient(to bottom, transparent 80rpx, #ffffff 80rpx, #ffffff 100rpx)',
  119. paddingTop: "100rpx",
  120. marginTop: "-100rpx"
  121. },
  122. enlistShow: false,
  123. studentList1: [],
  124. subscribeShow: false,
  125. studentList2: [],
  126. }
  127. },
  128. onLoad(options) {
  129. this.classId = options.id
  130. this.initialize()
  131. },
  132. onShow() {
  133. NET.request(API.getEnlistAbleStudent, {}, 'POST').then(res => {
  134. this.studentList1 = res.data.row
  135. }).catch(error => {
  136. this.$refs.uTips.show({
  137. title: error.message,
  138. type: 'warning',
  139. })
  140. })
  141. NET.request(API.getSubscribeAbleList, {}, 'POST').then(res => {
  142. this.studentList2 = res.data.row
  143. }).catch(error => {
  144. this.$refs.uTips.show({
  145. title: error.message,
  146. type: 'warning',
  147. })
  148. })
  149. },
  150. onPullDownRefresh() {
  151. this.initialize()
  152. setTimeout(() => {
  153. uni.stopPullDownRefresh();
  154. }, 500)
  155. },
  156. methods: {
  157. // 获取初始化数据
  158. initialize() {
  159. NET.request(API.getClassDetail, {
  160. id: this.classId
  161. }, 'POST').then(res => {
  162. this.classInfo = res.data
  163. }).catch(error => {
  164. this.$refs.uTips.show({
  165. title: error.message,
  166. type: 'warning',
  167. })
  168. })
  169. },
  170. // 学员报名
  171. enlistStudent(item) {
  172. NET.request(API.enlistStudent, {
  173. classId: this.classId,
  174. studentId: item.studentId,
  175. }, 'POST').then(res => {
  176. this.enlistShow = false
  177. this.$refs.uTips.show({
  178. title: res.message,
  179. type: 'success',
  180. })
  181. }).catch(error => {
  182. this.$refs.uTips.show({
  183. title: error.message,
  184. type: 'warning',
  185. })
  186. })
  187. },
  188. // 学员预约
  189. subscribeStudent(item) {
  190. NET.request(API.subscribeStudent, {
  191. classId: this.classId,
  192. studentId: item.studentId,
  193. }, 'POST').then(res => {
  194. this.subscribeShow = false
  195. this.$refs.uTips.show({
  196. title: res.message,
  197. type: 'success',
  198. })
  199. }).catch(error => {
  200. this.$refs.uTips.show({
  201. title: error.message,
  202. type: 'warning',
  203. })
  204. })
  205. },
  206. // 跳转新增学员表单
  207. goToSubscribelForm() {
  208. uni.navigateTo({
  209. url: '/pagesMember/subscribelForm'
  210. });
  211. },
  212. },
  213. }
  214. </script>
  215. <style>
  216. page {
  217. width: 100%;
  218. height: 100%;
  219. background-color: #f7f7f7;
  220. position: relative;
  221. }
  222. </style>
  223. <style lang="scss" scoped>
  224. @import "@/static/css/themes.scss";
  225. .content {
  226. width: 100%;
  227. float: left;
  228. padding-bottom: 60px;
  229. .class-info-text {
  230. color: #999999;
  231. line-height: 18px;
  232. u-icon {
  233. margin-right: 2px;
  234. }
  235. }
  236. .student-box {
  237. max-height: 200px;
  238. padding: 0 15px;
  239. margin: 25px 0 0 0;
  240. box-sizing: border-box;
  241. overflow: auto;
  242. /deep/.u-card__head {
  243. padding-bottom: 0px !important;
  244. }
  245. }
  246. .techaer-info-box {
  247. display: flex;
  248. .techaer-info {
  249. flex: 1;
  250. margin-left: 10px;
  251. .class-info-title {
  252. font-size: 14px;
  253. font-weight: bold;
  254. margin-bottom: 5px;
  255. }
  256. }
  257. }
  258. .class-show-box {
  259. width: 100%;
  260. float: left;
  261. .class-show-card {
  262. width: calc(50% - 16px);
  263. margin: 0 8px 16px 8px;
  264. float: left;
  265. .class-show-name {
  266. width: 100%;
  267. text-align: center;
  268. line-height: 20px;
  269. font-size: 14px;
  270. margin-top: 5px;
  271. }
  272. .video-col {
  273. width: 100%;
  274. height: 30vw;
  275. border-radius: 10px;
  276. video {
  277. width: 100%;
  278. height: 30vw;
  279. }
  280. }
  281. }
  282. }
  283. .handle-fix-box {
  284. u-button {
  285. width: 100%;
  286. display: inline-block;
  287. }
  288. }
  289. }
  290. </style>