index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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. // 分享获取参数
  95. const shareParams = decodeURIComponent(options.shareParams)
  96. const shareId = shareParams.split(':')[0]
  97. const shareType = shareParams.split(':')[1]
  98. NET.request(API.getQrcodeInfo, {shareId,shareType}, 'POST').then(res => {
  99. if(res.status == 50000) {
  100. this.$refs.uTips.show({
  101. title: res.message,
  102. type: 'warning',
  103. })
  104. }
  105. })
  106. // console.log(options.shareParams)
  107. // wx.setStorage({//存储到本地
  108. // key:"shareParams",
  109. // data:options.shareParams
  110. // })
  111. }
  112. // setTimeout(()=>{
  113. // let videoContext = uni.createVideoContext('video1')
  114. // videoContext.play()
  115. // console.log(12)
  116. // },6000)
  117. uni.getLocation({
  118. type: 'wgs84',
  119. geocode: true,
  120. success: (res) => {
  121. uni.setStorage({
  122. key: 'locationData',
  123. data: {
  124. longitude: res.longitude,
  125. latitude: res.latitude,
  126. }
  127. })
  128. this.initialize()
  129. }
  130. });
  131. },
  132. onShow() {
  133. // if (!uni.getStorageSync('token')) {
  134. // uni.navigateTo({
  135. // url: '/pages/login/index'
  136. // });
  137. // }
  138. },
  139. onPullDownRefresh() {
  140. this.initialize()
  141. setTimeout(() => {
  142. uni.stopPullDownRefresh();
  143. }, 500)
  144. },
  145. methods: {
  146. confirm(e) {
  147. console.log(e);
  148. },
  149. // 获取初始化数据
  150. initialize() {
  151. // 轮播图
  152. NET.request(API.getIndexSwiperList, {}, 'POST').then(res => {
  153. this.swiperList = res.data
  154. }).catch(error => {
  155. this.$refs.uTips.show({
  156. title: error.message,
  157. type: 'warning',
  158. })
  159. })
  160. // 会员卡
  161. // NET.request(API.getMemberCardList, {}, 'POST').then(res => {
  162. // this.menberList = res.data
  163. // }).catch(error => {
  164. // this.$refs.uTips.show({
  165. // title: error.message,
  166. // type: 'warning',
  167. // })
  168. // })
  169. // 省-市-区
  170. NET.request(API.getAddressInfo, uni.getStorageSync('locationData'), 'POST').then(res => {
  171. this.locationText = res.data.province + '-' + res.data.city + '-' + res.data.district
  172. }).catch(error => {
  173. this.$refs.uTips.show({
  174. title: error.message,
  175. type: 'warning',
  176. })
  177. })
  178. // 附件场馆
  179. NET.request(API.getVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  180. const venueData = res.data
  181. this.venueList = venueData.length <= 4 ? venueData : venueData.slice(0,4)
  182. }).catch(error => {
  183. this.$refs.uTips.show({
  184. title: error.message,
  185. type: 'warning',
  186. })
  187. })
  188. // 精彩瞬间
  189. NET.request(API.getVideoList, uni.getStorageSync('locationData'), 'POST').then(res => {
  190. const videoData = res.data
  191. // 取4个精彩瞬间
  192. this.videoList = videoData.length <= 4 ? videoData : videoData.slice(0,4)
  193. }).catch(error => {
  194. this.$refs.uTips.show({
  195. title: error.message,
  196. type: 'warning',
  197. })
  198. })
  199. },
  200. // 更多场馆
  201. handleMoreClick() {
  202. uni.navigateTo({
  203. url: '/pagesMember/venueMore'
  204. });
  205. },
  206. // 跳转开通支付
  207. // goToPay(site) {
  208. // uni.navigateTo({
  209. // url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  210. // });
  211. // },
  212. // 跳转场馆详情
  213. goToVenueDetail(item) {
  214. uni.navigateTo({
  215. url: '/pagesMember/venueDetail?id=' + item.id
  216. });
  217. },
  218. },
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. @import "@/static/css/themes.scss";
  223. .content {
  224. width: 100%;
  225. float: left;
  226. // /deep/.u-navbar {
  227. // .u-title {
  228. // font-weight: bold;
  229. // }
  230. // }
  231. .slot-wrap {
  232. display: flex;
  233. align-items: center;
  234. /* 如果您想让slot内容占满整个导航栏的宽度 */
  235. flex: 1;
  236. /* 如果您想让slot内容与导航栏左右有空隙 */
  237. padding: 0 30rpx;
  238. }
  239. .section-title {
  240. width: 100%;
  241. height: 28px;
  242. display: flex;
  243. align-items: center;
  244. margin-top: 20px;
  245. padding: 0 15px;
  246. u-section {
  247. margin-left: 10px;
  248. flex: 1;
  249. }
  250. }
  251. .menber-box {
  252. width: 100vw;
  253. float: left;
  254. padding-left: 5px;
  255. overflow-x: auto;
  256. white-space: nowrap;
  257. .menber-col {
  258. width: 70vw;
  259. margin: 10px 15px;
  260. padding: 15px 20px;
  261. display: inline-block;
  262. background-color: #FFFFFF;
  263. border-radius: 15px;
  264. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  265. position: relative;
  266. overflow: hidden;
  267. .menber-label {
  268. width: 100%;
  269. margin-bottom: 10px;
  270. float: left;
  271. font-size: 14px;
  272. font-weight: bold;
  273. line-height: 20px;
  274. }
  275. .menber-num {
  276. width: 100%;
  277. float: left;
  278. font-size: 26px;
  279. line-height: 28px;
  280. color: $mainColor;
  281. }
  282. .menber-icon {
  283. font-size: 80px;
  284. color: $mainColor;
  285. position: absolute;
  286. right: -15px;
  287. bottom: -15x;
  288. opacity: 0.5;
  289. }
  290. }
  291. }
  292. .venue-box {
  293. width: 100vw;
  294. float: left;
  295. padding-left: 5px;
  296. overflow-x: auto;
  297. white-space: nowrap;
  298. /deep/.u-card--border:after {
  299. border-color: #cccccc;
  300. border-radius: 15px;
  301. }
  302. .venue-card {
  303. min-width: 70vw;
  304. display: inline-block;
  305. .venue-content {
  306. padding: 0px 15px 10px 15px;
  307. .venue-name {
  308. height: 20px;
  309. font-weight: bold;
  310. font-size: 15px;
  311. line-height: 20px;
  312. }
  313. .info-text {
  314. max-width: 60vw;
  315. overflow: hidden;
  316. white-space: nowrap;
  317. text-overflow: ellipsis;
  318. color: #999999;
  319. line-height: 18px;
  320. /deep/.u-icon {
  321. margin-right: 5px;
  322. font-size: 14px;
  323. }
  324. }
  325. }
  326. }
  327. }
  328. .video-box {
  329. width: 100vw;
  330. float: left;
  331. box-sizing: border-box;
  332. padding: 10px 7px 0px 7px;
  333. .video-card {
  334. width: calc(50% - 16px);
  335. margin: 0 8px 16px 8px;
  336. float: left;
  337. .video-col {
  338. width: 100%;
  339. height: 30vw;
  340. float: left;
  341. border-radius: 10px;
  342. overflow: hidden;
  343. video {
  344. width: 100%;
  345. height: 30vw;
  346. }
  347. }
  348. .video-name {
  349. width: 100%;
  350. float: left;
  351. text-align: center;
  352. line-height: 20px;
  353. font-size: 14px;
  354. margin-top: 5px;
  355. }
  356. }
  357. }
  358. }
  359. </style>