index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="course">
  3. <!-- 头部 -->
  4. <view class="custom-header-container">
  5. <view class="header-bg" :style="{height:headerBgHeight}">
  6. <image src="../../../static/image/course/bg.png"/>
  7. </view>
  8. <view class="custom-header-status-bar" :style="{height:getStausBarHeight}"></view>
  9. <view class="custom-header-top-container">
  10. <view class="custom-header-title">课程报名</view>
  11. </view>
  12. </view>
  13. <view class="banner">
  14. <swiper class="swipe" indicator-dots="true" autoplay="true" interval="5000" duration="1500">
  15. <swiper-item :url="item.url" v-for="(item, index) in bannerImg" :key="index">
  16. <image :src="item.img" mode="aspectFill" :title="item.title" class="banner-img"/>
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. <view class="course-list-icon">
  21. <view class="img">
  22. <image src="../../../static/image/course/creation.png" mode=""></image>
  23. </view>
  24. <text>课程报名</text>
  25. </view>
  26. <view class="course-list">
  27. <view class="course-list-item" v-for="(item, index) in courseListData" :key="index">
  28. <view class="course-item-left">
  29. <image :src="item.img" mode=""></image>
  30. </view>
  31. <view class="course-item-right">
  32. <view class="course-item-title">
  33. {{item.title}}
  34. </view>
  35. <view class="course-item-content">
  36. {{item.content}}
  37. </view>
  38. <view class="course-item-moneyAndBtn">
  39. <view class="moneyAndBtn-money">
  40. <text>¥</text> 30.00
  41. </view>
  42. <view class="moneyAndBtn-btn" @click="navTo">
  43. 立即报名
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="placeholder-view">
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. name: 'courseIndex',
  56. data() {
  57. return {
  58. courseListData:[
  59. {
  60. img:'../../../static/image/course/img1.png',
  61. title: '4-6岁幼儿兴趣班',
  62. content: '适合4岁至6岁的小朋友学习开发运动潜力',
  63. },
  64. {
  65. img:'../../../static/image/course/img2.png',
  66. title: '7-9岁幼儿兴趣班',
  67. content: '适合4岁至6岁的小朋友学习开发运动潜力',
  68. },
  69. {
  70. img:'../../../static/image/course/img3.png',
  71. title: '9-12岁幼儿兴趣班',
  72. content: '适合4岁至6岁的小朋友学习开发运动潜力',
  73. },
  74. {
  75. img:'../../../static/image/course/img4.png',
  76. title: '12-15岁幼儿兴趣班',
  77. content: '适合4岁至6岁的小朋友学习开发运动潜力',
  78. },
  79. ],
  80. bannerImg:[
  81. {img:'../../../static/image/course/banner.png'}
  82. ]
  83. }
  84. },
  85. computed:{
  86. getStausBarHeight(){
  87. try {
  88. const res = uni.getSystemInfoSync();
  89. return res.statusBarHeight + 'px';
  90. } catch (err) {
  91. console.log(err)
  92. }
  93. },
  94. headerBgHeight(){
  95. try {
  96. const res = uni.getSystemInfoSync();
  97. return 120+44+res.statusBarHeight + 'px';
  98. } catch (err) {
  99. console.log(err)
  100. }
  101. }
  102. },
  103. methods: {
  104. navTo(){
  105. uni.navigateTo({
  106. url: 'pages/goods/goods'
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. .custom-header-container{
  114. width: 100%;
  115. top: 0;
  116. z-index: 0;
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. background: #fff;
  121. font-size: 26upx;
  122. background: transparent;
  123. .header-bg{
  124. width: 100%;
  125. position: absolute;
  126. overflow: hidden;
  127. z-index: -1;
  128. image{
  129. width: 100%;
  130. height: 230px;
  131. }
  132. }
  133. .custom-header-status-bar{
  134. width: 100%;
  135. top: 0;
  136. position: sticky;
  137. z-index: 100;
  138. }
  139. .custom-header-top-container{
  140. width: 100%;
  141. display: flex;
  142. justify-content: center;
  143. align-items: center;
  144. padding: 0 15upx;
  145. .custom-header-title{
  146. height: 44px;
  147. line-height: 44px;
  148. font-size: 36upx;
  149. font-weight:400;
  150. font-family:Source Han Sans CN;
  151. color: #FBF9F9;
  152. }
  153. }
  154. .cu-bar{
  155. width: 100%;
  156. height: 55px;
  157. }
  158. .head-search{
  159. width: 100%;
  160. height: 60upx;
  161. .head-search-item{
  162. width: 690upx;
  163. height: 65upx;
  164. background: #fff;
  165. border-radius: 50%;
  166. }
  167. }
  168. }
  169. .banner{
  170. width: 94vw;
  171. height: auto;
  172. margin: 0 3vw;
  173. padding: 5vw 0;
  174. z-index: 1;
  175. .swipe {
  176. width: 100%;
  177. height: 42vw;
  178. /* background: #eee; */
  179. border-radius: 10px;
  180. overflow: hidden;
  181. z-index: 1;
  182. .banner-img{
  183. width: 100%;
  184. height: 100%;
  185. }
  186. }
  187. }
  188. .course-list-icon{
  189. width: 100%;
  190. height: 60upx;
  191. padding-left: 20upx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: flex-start;
  195. margin: 30upx 0;
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. white-space: nowrap;
  199. .img{
  200. width: 29upx;
  201. height: 31upx;
  202. margin-right: 10upx;
  203. image{
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. text{
  209. font-size:34upx;
  210. font-family:Source Han Sans CN;
  211. font-weight:500;
  212. color:rgba(61,61,61,1);
  213. }
  214. }
  215. .placeholder-view{
  216. width: 100%;
  217. height: 100upx;
  218. }
  219. .course-list-item{
  220. width: 100%;
  221. height: 242upx;
  222. padding: 15upx;
  223. border-bottom: 1rpx solid #E5E5E5;
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. }
  228. .course-item-left{
  229. width: 251upx;
  230. height: 200upx;
  231. margin-right: 20upx;
  232. image{
  233. width: 100%;
  234. height: 100%;
  235. }
  236. }
  237. .course-item-right{
  238. .course-item-title{
  239. width: 430upx;
  240. font-size:34upx;
  241. font-family:Source Han Sans CN;
  242. font-weight:500;
  243. color:rgba(61,61,61,1);
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. white-space: nowrap;
  247. }
  248. .course-item-content{
  249. width: 430upx;
  250. height: 35upx;
  251. margin: 15upx 0 20upx 0;
  252. font-size:26upx;
  253. font-family:Source Han Sans CN;
  254. font-weight:400;
  255. color:rgba(112,112,112,1);
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. white-space: nowrap;
  259. }
  260. .course-item-moneyAndBtn{
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. .moneyAndBtn-money{
  265. font-size:34upx;
  266. font-family:Source Han Sans CN;
  267. font-weight:500;
  268. color: #FF4800;
  269. text{
  270. font-size:34upx;
  271. font-family:Source Han Sans CN;
  272. font-weight:500;
  273. color: #FF4800;
  274. margin: 0 8upx;
  275. }
  276. }
  277. .moneyAndBtn-btn{
  278. font-size:34upx;
  279. font-family:Source Han Sans CN;
  280. font-weight:500;
  281. color: #fff;
  282. background: #F09A21;
  283. padding: 10upx 22upx;
  284. text-align: center;
  285. box-shadow: 0 4px 10px #999;
  286. border-radius: 8upx;
  287. }
  288. }
  289. }
  290. </style>