classDetail.vue 8.1 KB

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