index.vue 9.8 KB

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