classDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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-top-tips ref="uTips"></u-top-tips>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. mapGetters
  52. } from 'vuex'
  53. const NET = require('@/utils/request')
  54. const API = require('@/config/api')
  55. export default {
  56. computed: {
  57. ...mapGetters([
  58. 'customStyle',
  59. ])
  60. },
  61. data() {
  62. return {
  63. classId: '',
  64. classInfo: {
  65. name: '',
  66. classStartDate: '',
  67. classStartHours: '',
  68. residue: '',
  69. address: '',
  70. coachName: '',
  71. coachDesc: '',
  72. coachUrl: '',
  73. desc: '',
  74. showList: [],
  75. },
  76. handleStyleLeft: {
  77. borderRadius: '40px 0 0 40px',
  78. borderRight: '1px solid #ffffff'
  79. },
  80. handleStyleRight: {
  81. borderRadius: '0 40px 40px 0',
  82. borderLeft: '1px solid #ffffff'
  83. },
  84. cardStyle: {
  85. fontWeight: 'bold'
  86. },
  87. shadowStyle: {
  88. backgroundImage: 'linear-gradient(to bottom, transparent 80rpx, #ffffff 80rpx, #ffffff 100rpx)',
  89. paddingTop: "100rpx",
  90. marginTop: "-100rpx"
  91. },
  92. }
  93. },
  94. onLoad(options) {
  95. this.classId = options.id
  96. this.initialize()
  97. },
  98. onShow() {},
  99. onPullDownRefresh() {
  100. this.initialize()
  101. setTimeout(() => {
  102. uni.stopPullDownRefresh();
  103. }, 500)
  104. },
  105. methods: {
  106. // 获取初始化数据
  107. initialize() {
  108. NET.request(API.getClassDetail, {
  109. id: this.classId
  110. }, 'POST').then(res => {
  111. this.classInfo = res.data
  112. }).catch(error => {
  113. this.$refs.uTips.show({
  114. title: error.message,
  115. type: 'warning',
  116. })
  117. })
  118. },
  119. },
  120. }
  121. </script>
  122. <style>
  123. page {
  124. width: 100%;
  125. height: 100%;
  126. background-color: #f7f7f7;
  127. position: relative;
  128. }
  129. </style>
  130. <style lang="scss" scoped>
  131. @import "@/static/css/themes.scss";
  132. .content {
  133. width: 100%;
  134. float: left;
  135. .class-info-text {
  136. color: #999999;
  137. line-height: 18px;
  138. u-icon {
  139. margin-right: 2px;
  140. }
  141. }
  142. .student-box {
  143. max-height: 200px;
  144. padding: 0 15px;
  145. margin: 25px 0 0 0;
  146. box-sizing: border-box;
  147. overflow: auto;
  148. /deep/.u-card__head {
  149. padding-bottom: 0px !important;
  150. }
  151. }
  152. .techaer-info-box {
  153. display: flex;
  154. .techaer-info {
  155. flex: 1;
  156. margin-left: 10px;
  157. .class-info-title {
  158. font-size: 14px;
  159. font-weight: bold;
  160. margin-bottom: 5px;
  161. }
  162. }
  163. }
  164. .class-show-box {
  165. width: 100%;
  166. float: left;
  167. .class-show-card {
  168. width: calc(50% - 16px);
  169. margin: 0 8px 16px 8px;
  170. float: left;
  171. .class-show-name {
  172. width: 100%;
  173. text-align: center;
  174. line-height: 20px;
  175. font-size: 14px;
  176. margin-top: 5px;
  177. }
  178. }
  179. .video-col {
  180. width: 100%;
  181. height: 30vw;
  182. border-radius: 10px;
  183. video {
  184. width: 100%;
  185. height: 30vw;
  186. }
  187. }
  188. }
  189. .handle-fix-box {
  190. u-button {
  191. width: 50%;
  192. display: inline-block;
  193. }
  194. }
  195. }
  196. </style>