index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="course_layout">
  3. <view class="course_list">
  4. <view class="course_item" v-for="(item,index) in productList" :key="index">
  5. <view class="course_title">
  6. <view class="left">
  7. <image :src="item.image"></image>
  8. </view>
  9. <view class="right">
  10. <view class="title">
  11. {{item.name}}
  12. <!-- 拳击课程 -->
  13. </view>
  14. <view class="skill">
  15. {{item.desc}}
  16. <!-- 拳击课程修炼 -->
  17. </view>
  18. <view class="course_option">
  19. <view class="course_num">
  20. 预约人数:{{item.course_reservation_number}}
  21. </view>
  22. <view class="remain_class">
  23. <navigator :url="`/pages/course/reservation?course_id=${item.id}`">
  24. <view class="course_make_btn">
  25. 预约上课
  26. </view>
  27. </navigator>
  28. </view>
  29. </view>
  30. <view class="course_remain">
  31. <view class="remain_class">
  32. </view>
  33. <!-- <view class="price">
  34. ¥{{item.price_total}}
  35. &lt;!&ndash; ¥100 &ndash;&gt;
  36. </view>-->
  37. </view>
  38. </view>
  39. </view>
  40. <view class="btn_title">
  41. <view class="title">
  42. 上课地址:{{item.address}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="to_bottom">---到底啦---</view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. //产品列表
  55. productList:[],
  56. // 请求参数
  57. requestParam:{
  58. name:"",
  59. page:1,
  60. },
  61. // 是否最后一页
  62. isLast:false,
  63. // 是否请求中
  64. isReqing:false,
  65. }
  66. },
  67. onShow() {
  68. // 没有数据的话,或者请求中,不允许刷新
  69. if( this.isReqing ) return ;
  70. // 请求参数
  71. this.requestParam.name = "";
  72. // 请求参数
  73. this.requestParam.page = 1;
  74. // 是否是最后一页
  75. this.isLast = false;
  76. // 设置请求中
  77. this.isReqing = true;
  78. this.$http.request('api/course/get_list',this.requestParam.page).then((re)=>{
  79. // 设置非请求中
  80. this.isReqing = false;
  81. // 成功结果
  82. if( re.code == 'success' ){
  83. if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
  84. this.productList = re.data.data;
  85. }
  86. });
  87. },
  88. methods: {
  89. }
  90. }
  91. </script>
  92. <style lang="less">
  93. .course_layout{
  94. width: 690rpx;
  95. margin: 30rpx auto;
  96. .course_list{
  97. display: block;
  98. width: 690rpx;
  99. .course_item{
  100. width:690rpx;
  101. display: block;
  102. background-color: #fafafa;
  103. padding: 1rpx 0rpx;
  104. margin: 20rpx 0rpx;
  105. .course_title{
  106. display: flex;
  107. width: 660rpx;
  108. margin: 20rpx auto;
  109. .left{
  110. width: 200rpx;
  111. // height: 200rpx;
  112. // background-color: aqua;
  113. // border: 2rpx solid;
  114. border-radius: 20rpx;
  115. image{
  116. width: 200rpx;
  117. height: 200rpx;
  118. }
  119. }
  120. .right{
  121. font-size: 24rpx;
  122. margin-left: 20rpx;
  123. .title{
  124. font-size: 36rpx;
  125. }
  126. .skill{
  127. padding: 5rpx;
  128. margin: 10rpx 10rpx 10rpx 0rpx;
  129. color: #c9c9c9;
  130. }
  131. .course_option{
  132. display: flex;
  133. justify-content: space-between;
  134. flex-wrap: wrap;
  135. width: 420rpx;
  136. .course_num{
  137. display: inline-flex;
  138. justify-content: center;
  139. width: 180rpx;
  140. border: 2rpx solid #3985ff;
  141. border-radius: 15rpx;
  142. margin: 5rpx;
  143. padding: 5rpx;
  144. color: #3985ff;
  145. }
  146. .remain_class{
  147. display: inline-flex;
  148. justify-content: center;
  149. width: 180rpx;
  150. margin: 5rpx;
  151. padding: 5rpx;
  152. background-color: #3985ff;
  153. border-radius: 15rpx;
  154. color: #ffffff;
  155. }
  156. }
  157. .course_remain{
  158. display: flex;
  159. justify-content: space-between;
  160. flex-wrap: wrap;
  161. width: 420rpx;
  162. margin-top: 30rpx;
  163. // .remain_class{
  164. // display: inline-flex;
  165. // justify-content: center;
  166. // width: 180rpx;
  167. // margin: 5rpx;
  168. // padding: 5rpx;
  169. // background-color: #3985ff;
  170. // border-radius: 15rpx;
  171. // color: #ffffff;
  172. // }
  173. .price{
  174. width: 180rpx;
  175. margin: 5rpx;
  176. padding: 5rpx;
  177. text-align: right;
  178. font-size: 30rpx;
  179. }
  180. }
  181. }
  182. }
  183. .btn_title{
  184. .title{
  185. margin-left: 20rpx;
  186. font-size: 20rpx;
  187. }
  188. .btn{
  189. display: flex;
  190. width: 690rpx;
  191. margin: 20rpx 0rpx;
  192. justify-content: space-between;
  193. .course_make_btn{
  194. width: 300rpx;
  195. height: 60rpx;
  196. line-height: 60rpx;
  197. text-align: center;
  198. padding: 10rpx;
  199. background-color: #1fbe7e;
  200. color: #ffffff;
  201. border-radius: 20rpx;
  202. }
  203. .user_course_btn{
  204. width: 300rpx;
  205. height: 60rpx;
  206. line-height: 60rpx;
  207. text-align: center;
  208. padding: 10rpx;
  209. background-color: #1fbe7e;
  210. color: #ffffff;
  211. border-radius: 20rpx;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. </style>