index.vue 10 KB

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