index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <view class="content">
  3. <!-- 导航栏 -->
  4. <u-navbar :is-back="false">
  5. <view class="slot-wrap">
  6. <view @click="show = true">{{ locationText }}</view>
  7. <!-- <u-select v-model="show" mode="mutil-column-auto" :list="list" @confirm="confirm"></u-select> -->
  8. </view>
  9. </u-navbar>
  10. <!-- 轮播图 -->
  11. <u-swiper :list="swiperList" mode="rect" height="300" effect3d border-radius="30" name="url" style="margin-bottom: 10px;"></u-swiper>
  12. <!-- <view class="section-title">
  13. <u-image width="20px" height="10px" :src="sectionIcon"></u-image>
  14. <u-section title="会员开通" font-size="32" :right="false" :show-line="false"></u-section>
  15. </view>
  16. <view class="menber-box">
  17. <view class="menber-col" v-for="(item, index) in menberList" :key="index" @click="goToPay(item)">
  18. <view class="menber-label">{{item.typeValue}}</view>
  19. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...handleCustomStyle, float: 'left', marginLeft: ''}" size="mini" @click="goToPay(item)">点击开通</u-button>
  20. <view class="menber-icon iconfont iconzu4931"></view>
  21. </view>
  22. </view> -->
  23. <!-- 会员开通 -->
  24. <view class="section-title">
  25. <u-image width="20px" height="10px" :src="sectionIcon"></u-image>
  26. <u-section title="会员开通" font-size="32" :show-line="false" @click="handleMoreClick"></u-section>
  27. </view>
  28. <view class="venue-box">
  29. <u-card :head-border-bottom="false" :foot-border-top="false" title-size="32" padding="0" margin="10px" v-for="(item, index) in venueList"
  30. :key="index" class="venue-card" @click="goToVenueDetail(item)">
  31. <view class="venue-content" slot="head" style="padding-top: 10px;">
  32. <view class="venue-name">{{item.name}}</view>
  33. </view>
  34. <view class="venue-content" slot="body">
  35. <view class="info-text">
  36. <u-icon name="car"></u-icon>
  37. 距您{{item.distance}}
  38. </view>
  39. <view class="info-text">
  40. <u-icon name="map"></u-icon>
  41. {{item.address}}
  42. </view>
  43. </view>
  44. <view class="venue-content" slot="foot" style="text-align: right;">
  45. <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click="goToVenueDetail(item)">预约</u-button>
  46. </view>
  47. </u-card>
  48. </view>
  49. <!-- 精彩瞬间 -->
  50. <view class="section-title">
  51. <u-image width="20px" height="10px" :src="sectionIcon"></u-image>
  52. <u-section title="精彩瞬间" font-size="32" :right="false" :show-line="false"></u-section>
  53. </view>
  54. <view class="video-box">
  55. <view v-for="(item, index) in videoList" :key="index" class="video-card">
  56. <view class="video-col">
  57. <video :src="item.url" object-fit="cover" controls :id="'video' + index"></video>
  58. </view>
  59. <!-- <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px"></u-image> -->
  60. <view class="video-name">{{item.title}}</view>
  61. </view>
  62. </view>
  63. <u-top-tips ref="uTips"></u-top-tips>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. mapGetters
  69. } from 'vuex'
  70. const NET = require('@/utils/request')
  71. const API = require('@/config/api')
  72. export default {
  73. computed: {
  74. ...mapGetters([
  75. 'mainColor',
  76. 'handleCustomStyle',
  77. ])
  78. },
  79. data() {
  80. return {
  81. show: false,
  82. sectionIcon: API.getServerImg + 'biaoti.png',
  83. longitude: '',
  84. latitude: '',
  85. locationText: '',
  86. swiperList: [],
  87. // menberList: [],
  88. venueList: [],
  89. videoList: []
  90. }
  91. },
  92. onLoad(options) {
  93. if (options.shareParams) {
  94. console.log(options.shareParams)
  95. wx.setStorage({//存储到本地
  96. key:"shareParams",
  97. data:options.shareParams
  98. })
  99. }
  100. //console.log(wx.getStorageSync('shareParams'))
  101. // setTimeout(()=>{
  102. // let videoContext = uni.createVideoContext('video1')
  103. // videoContext.play()
  104. // console.log(12)
  105. // },6000)
  106. uni.getLocation({
  107. type: 'wgs84',
  108. geocode: true,
  109. success: (res) => {
  110. uni.setStorage({
  111. key: 'locationData',
  112. data: {
  113. longitude: res.longitude,
  114. latitude: res.latitude,
  115. }
  116. })
  117. this.initialize()
  118. }
  119. });
  120. },
  121. onShow() {
  122. // if (!uni.getStorageSync('token')) {
  123. // uni.navigateTo({
  124. // url: '/pages/login/index'
  125. // });
  126. // }
  127. },
  128. onPullDownRefresh() {
  129. this.initialize()
  130. setTimeout(() => {
  131. uni.stopPullDownRefresh();
  132. }, 500)
  133. },
  134. methods: {
  135. confirm(e) {
  136. console.log(e);
  137. },
  138. // 获取初始化数据
  139. initialize() {
  140. // 轮播图
  141. NET.request(API.getIndexSwiperList, {}, 'POST').then(res => {
  142. this.swiperList = res.data
  143. }).catch(error => {
  144. this.$refs.uTips.show({
  145. title: error.message,
  146. type: 'warning',
  147. })
  148. })
  149. // 会员卡
  150. // NET.request(API.getMemberCardList, {}, 'POST').then(res => {
  151. // this.menberList = res.data
  152. // }).catch(error => {
  153. // this.$refs.uTips.show({
  154. // title: error.message,
  155. // type: 'warning',
  156. // })
  157. // })
  158. // 省-市-区
  159. NET.request(API.getAddressInfo, uni.getStorageSync('locationData'), 'POST').then(res => {
  160. this.locationText = res.data.province + '-' + res.data.city + '-' + res.data.district
  161. }).catch(error => {
  162. this.$refs.uTips.show({
  163. title: error.message,
  164. type: 'warning',
  165. })
  166. })
  167. // 附件场馆
  168. NET.request(API.getVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  169. const venueData = res.data
  170. this.venueList = venueData.length <= 4 ? venueData : venueData.slice(0,4)
  171. }).catch(error => {
  172. this.$refs.uTips.show({
  173. title: error.message,
  174. type: 'warning',
  175. })
  176. })
  177. // 精彩瞬间
  178. NET.request(API.getVideoList, uni.getStorageSync('locationData'), 'POST').then(res => {
  179. const videoData = res.data
  180. // 取4个精彩瞬间
  181. this.videoList = videoData.length <= 4 ? videoData : videoData.slice(0,4)
  182. }).catch(error => {
  183. this.$refs.uTips.show({
  184. title: error.message,
  185. type: 'warning',
  186. })
  187. })
  188. },
  189. // 更多场馆
  190. handleMoreClick() {
  191. uni.navigateTo({
  192. url: '/pagesMember/venueMore'
  193. });
  194. },
  195. // 跳转开通支付
  196. // goToPay(site) {
  197. // uni.navigateTo({
  198. // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  199. // });
  200. // },
  201. // 跳转场馆详情
  202. goToVenueDetail(item) {
  203. uni.navigateTo({
  204. url: '/pagesMember/venueDetail?id=' + item.id
  205. });
  206. },
  207. },
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. @import "@/static/css/themes.scss";
  212. .content {
  213. width: 100%;
  214. float: left;
  215. // /deep/.u-navbar {
  216. // .u-title {
  217. // font-weight: bold;
  218. // }
  219. // }
  220. .slot-wrap {
  221. display: flex;
  222. align-items: center;
  223. /* 如果您想让slot内容占满整个导航栏的宽度 */
  224. flex: 1;
  225. /* 如果您想让slot内容与导航栏左右有空隙 */
  226. padding: 0 30rpx;
  227. }
  228. .section-title {
  229. width: 100%;
  230. height: 28px;
  231. display: flex;
  232. align-items: center;
  233. margin-top: 20px;
  234. padding: 0 15px;
  235. u-section {
  236. margin-left: 10px;
  237. flex: 1;
  238. }
  239. }
  240. .menber-box {
  241. width: 100vw;
  242. float: left;
  243. padding-left: 5px;
  244. overflow-x: auto;
  245. white-space: nowrap;
  246. .menber-col {
  247. width: 70vw;
  248. margin: 10px 15px;
  249. padding: 15px 20px;
  250. display: inline-block;
  251. background-color: #FFFFFF;
  252. border-radius: 15px;
  253. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  254. position: relative;
  255. overflow: hidden;
  256. .menber-label {
  257. width: 100%;
  258. margin-bottom: 10px;
  259. float: left;
  260. font-size: 14px;
  261. font-weight: bold;
  262. line-height: 20px;
  263. }
  264. .menber-num {
  265. width: 100%;
  266. float: left;
  267. font-size: 26px;
  268. line-height: 28px;
  269. color: $mainColor;
  270. }
  271. .menber-icon {
  272. font-size: 80px;
  273. color: $mainColor;
  274. position: absolute;
  275. right: -15px;
  276. bottom: -15x;
  277. opacity: 0.5;
  278. }
  279. }
  280. }
  281. .venue-box {
  282. width: 100vw;
  283. float: left;
  284. padding-left: 5px;
  285. overflow-x: auto;
  286. white-space: nowrap;
  287. /deep/.u-card--border:after {
  288. border-color: #cccccc;
  289. border-radius: 15px;
  290. }
  291. .venue-card {
  292. min-width: 70vw;
  293. display: inline-block;
  294. .venue-content {
  295. padding: 0px 15px 10px 15px;
  296. .venue-name {
  297. height: 20px;
  298. font-weight: bold;
  299. font-size: 15px;
  300. line-height: 20px;
  301. }
  302. .info-text {
  303. max-width: 60vw;
  304. overflow: hidden;
  305. white-space: nowrap;
  306. text-overflow: ellipsis;
  307. color: #999999;
  308. line-height: 18px;
  309. /deep/.u-icon {
  310. margin-right: 5px;
  311. font-size: 14px;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. .video-box {
  318. width: 100vw;
  319. float: left;
  320. box-sizing: border-box;
  321. padding: 10px 7px 0px 7px;
  322. .video-card {
  323. width: calc(50% - 16px);
  324. margin: 0 8px 16px 8px;
  325. float: left;
  326. .video-col {
  327. width: 100%;
  328. height: 30vw;
  329. float: left;
  330. border-radius: 10px;
  331. overflow: hidden;
  332. video {
  333. width: 100%;
  334. height: 30vw;
  335. }
  336. }
  337. .video-name {
  338. width: 100%;
  339. float: left;
  340. text-align: center;
  341. line-height: 20px;
  342. font-size: 14px;
  343. margin-top: 5px;
  344. }
  345. }
  346. }
  347. }
  348. </style>