venueDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="content">
  3. <u-image :src="venueInfo.url" mode="aspectFill" height="45vw" border-radius="10px" width="calc(100vw - 30px)" style="margin: 10px 15px;float: left;"></u-image>
  4. <u-section :title="venueInfo.name" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  5. <view class="venue-text">
  6. <u-icon name="map" style="font-size: 14px;margin-right: 2px;"></u-icon>
  7. {{venueInfo.address}}
  8. </view>
  9. <u-section title="场馆简介" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  10. <view class="venue-text">{{venueInfo.desc}}</view>
  11. <u-section title="班级信息" :right="false" :show-line="false" font-size="32" class="title-box"></u-section>
  12. <view class="filter-box">
  13. <u-search placeholder="请输入班级名" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
  14. </view>
  15. <view class="class-box">
  16. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0" margin="10px" v-for="(item, index) in venueInfo.classListResList"
  17. :key="index" class="class-card" @click="goToClassDetail(item)">
  18. <view class="class-content" slot="head" style="padding-top: 10px;">
  19. <text class="class-name">{{item.name}}</text>
  20. </view>
  21. <view class="class-content" slot="body" style="padding-bottom: 10px;">
  22. <view class="class-info">
  23. <view class="class-info-row">
  24. <u-icon name="clock"></u-icon>
  25. {{item.classStartDate}}&nbsp;~&nbsp;{{item.classEndDate}}
  26. </view>
  27. <view class="class-info-row" v-for="(site, index2) in item.classExtrasList" :key="index2">
  28. <u-icon name="calendar" style="visibility: hidden;"></u-icon>
  29. <text>{{site.week}}&nbsp;{{site.startTime}}-{{site.endTime}}</text>
  30. </view>
  31. <view class="class-info-row">
  32. <u-icon name="map"></u-icon>
  33. {{item.address}}
  34. </view>
  35. </view>
  36. </view>
  37. <view class="class-content" slot="foot" style="padding-bottom: 10px;text-align: right;">
  38. <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click="goToClassDetail(item)">详情</u-button>
  39. </view>
  40. </u-card>
  41. </view>
  42. <u-top-tips ref="uTips"></u-top-tips>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. mapGetters
  48. } from 'vuex'
  49. const NET = require('@/utils/request')
  50. const API = require('@/config/api')
  51. export default {
  52. computed: {
  53. ...mapGetters([
  54. 'customStyle',
  55. 'handleCustomStyle',
  56. ])
  57. },
  58. data() {
  59. return {
  60. filterText: '',
  61. venueId: '',
  62. venueInfo: {
  63. url: '',
  64. name: '',
  65. address: '',
  66. desc: '',
  67. classListResList: [],
  68. },
  69. }
  70. },
  71. onLoad(options) {
  72. this.venueId = options.id
  73. this.initialize()
  74. },
  75. onShow() {},
  76. onPullDownRefresh() {
  77. this.initialize()
  78. setTimeout(() => {
  79. uni.stopPullDownRefresh();
  80. }, 500)
  81. },
  82. methods: {
  83. // 获取初始化数据
  84. initialize() {
  85. NET.request(API.getVenueDetail, {
  86. id: this.venueId
  87. }, 'POST').then(res => {
  88. this.venueInfo = res.data
  89. }).catch(error => {
  90. this.$refs.uTips.show({
  91. title: error.message,
  92. type: 'warning',
  93. })
  94. })
  95. },
  96. setFilterText() {
  97. if(this.filterText) {
  98. let arr = []
  99. this.venueInfo.classListResList.forEach(item => {
  100. if(item.name.indexOf(this.filterText) >= 0) {
  101. arr.push(item)
  102. }
  103. })
  104. this.venueInfo.classListResList = arr
  105. } else {
  106. this.initialize()
  107. }
  108. },
  109. // 跳转班级详情
  110. goToClassDetail(item) {
  111. uni.navigateTo({
  112. url: '/pagesEnroll/classDetail?id=' + item.id
  113. });
  114. },
  115. },
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. @import "@/static/css/themes.scss";
  120. .content {
  121. width: 100%;
  122. float: left;
  123. .filter-box {
  124. width: 100vw;
  125. height: 48px;
  126. padding: 10px 15px;
  127. background-color: #FFFFFF;
  128. float: left;
  129. }
  130. .title-box {
  131. width: 100vw;
  132. padding: 10px 15px 5px 15px;
  133. float: left;
  134. box-sizing: border-box;
  135. }
  136. .venue-text {
  137. width: 100vw;
  138. padding: 5px 15px 15px 15px;
  139. float: left;
  140. box-sizing: border-box;
  141. color: #999999;
  142. font-size: 10px;
  143. line-height: 16px;
  144. }
  145. .class-box {
  146. width: 100vw;
  147. padding: 5px;
  148. float: left;
  149. box-sizing: border-box;
  150. .class-card {
  151. /deep/.u-border:after {
  152. border-radius: 20px !important;
  153. border-color: #999999;
  154. }
  155. .class-content {
  156. width: 100%;
  157. padding: 2px 15px;
  158. float: left;
  159. position: relative;
  160. }
  161. .class-name {
  162. height: 20px;
  163. font-weight: bold;
  164. font-size: 14px;
  165. line-height: 20px;
  166. }
  167. .class-info {
  168. .class-info-row {
  169. color: #999999;
  170. line-height: 18px;
  171. }
  172. }
  173. }
  174. }
  175. .student-box {
  176. max-height: 200px;
  177. padding: 0 15px;
  178. margin: 25px 0 0 0;
  179. box-sizing: border-box;
  180. overflow: auto;
  181. /deep/.u-card__head {
  182. padding-bottom: 0px !important;
  183. }
  184. }
  185. }
  186. </style>