index.vue 7.9 KB

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