classDetail.vue 7.8 KB

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