classDetail.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.classStartHours}}&nbsp;&nbsp;{{classInfo.residue}}课时
  8. </view>
  9. <view class="class-info-text">
  10. <u-icon name="map"></u-icon>
  11. {{classInfo.address}}
  12. </view>
  13. </view>
  14. </u-card>
  15. <u-card title="授课教练" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  16. <view class="techaer-info-box" slot="body">
  17. <u-image :src="classInfo.coachUrl" mode="aspectFill" width="80px" height="80px" border-radius="10px" style=""></u-image>
  18. <view class="techaer-info">
  19. <view class="class-info-title">{{classInfo.coachName}}</view>
  20. <view class="class-info-text">{{classInfo.coachName}}</view>
  21. </view>
  22. </view>
  23. </u-card>
  24. <u-card title="班级简介" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  25. <view slot="body">
  26. <view class="class-info-text">{{classInfo.desc}}</view>
  27. </view>
  28. <view slot="foot" style="text-align: center;">
  29. <u-icon name="arrow-down" size="34" color="" label="查看更多" label-pos="left"></u-icon>
  30. </view>
  31. </u-card>
  32. <u-card title="班级展示" sub-title="查看更多" :show-foot="false" title-size="32" margin="0px" :head-style="cardStyle">
  33. <view class="class-show-box" slot="body">
  34. <view v-for="(item, index) in classInfo.showList" :key="index" class="class-show-card">
  35. <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px"></u-image>
  36. <view class="class-show-name">{{item.name}}</view>
  37. </view>
  38. </view>
  39. </u-card>
  40. <view class="handle-fix-box">
  41. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToSubscribelForm()">立即预约</u-button>
  42. </view>
  43. <u-top-tips ref="uTips"></u-top-tips>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapGetters
  49. } from 'vuex'
  50. const NET = require('@/utils/request')
  51. const API = require('@/config/api')
  52. export default {
  53. computed: {
  54. ...mapGetters([
  55. 'customStyle',
  56. ])
  57. },
  58. data() {
  59. return {
  60. classId: '',
  61. classInfo: {
  62. name: '',
  63. classStartDate: '',
  64. classStartHours: '',
  65. residue: '',
  66. address: '',
  67. coachName: '',
  68. coachDesc: '',
  69. coachUrl: '',
  70. desc: '',
  71. showList: [],
  72. },
  73. cardStyle: {
  74. fontWeight: 'bold'
  75. }
  76. }
  77. },
  78. onLoad(options) {
  79. this.classId = options.id
  80. this.initialize()
  81. },
  82. onReady() {},
  83. onPullDownRefresh() {
  84. this.initialize()
  85. setTimeout(() => {
  86. uni.stopPullDownRefresh();
  87. }, 500)
  88. },
  89. methods: {
  90. // 获取初始化数据
  91. initialize() {
  92. NET.request(API.getClassDetail, {
  93. id: this.classId
  94. }, 'POST').then(res => {
  95. this.classInfo = res.data
  96. }).catch(error => {
  97. this.$refs.uTips.show({
  98. title: '获取班级详情失败',
  99. type: 'warning',
  100. })
  101. })
  102. },
  103. // 跳转预定表单
  104. goToSubscribelForm() {
  105. uni.navigateTo({
  106. url: '/pagesMember/subscribelForm?id=' + this.classId
  107. });
  108. },
  109. },
  110. }
  111. </script>
  112. <style>
  113. page {
  114. width: 100%;
  115. height: 100%;
  116. background-color: #f7f7f7;
  117. position: relative;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. @import "@/static/css/themes.scss";
  122. .content {
  123. width: 100%;
  124. float: left;
  125. padding-bottom: 60px;
  126. .class-info-text {
  127. color: #999999;
  128. line-height: 18px;
  129. }
  130. .techaer-info-box {
  131. display: flex;
  132. .techaer-info {
  133. flex: 1;
  134. margin-left: 10px;
  135. .class-info-title {
  136. font-size: 14px;
  137. font-weight: bold;
  138. margin-bottom: 5px;
  139. }
  140. }
  141. }
  142. .class-show-box {
  143. width: calc(100% + 32px);
  144. margin: 0 -16px;
  145. float: left;
  146. .class-show-card {
  147. width: calc(50% - 16px);
  148. margin: 0 8px 16px 8px;
  149. float: left;
  150. .class-show-name {
  151. width: 100%;
  152. text-align: center;
  153. line-height: 20px;
  154. font-size: 14px;
  155. margin-top: 5px;
  156. }
  157. }
  158. }
  159. }
  160. </style>