index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. uni.setStorageSync({
  85. key: 'shareParams',
  86. data: options.shareParams
  87. })
  88. }
  89. // setTimeout(()=>{
  90. // let videoContext = uni.createVideoContext('video1')
  91. // videoContext.play()
  92. // console.log(12)
  93. // },6000)
  94. uni.getLocation({
  95. type: 'wgs84',
  96. geocode: true,
  97. success: (res) => {
  98. uni.setStorage({
  99. key: 'locationData',
  100. data: {
  101. longitude: res.longitude,
  102. latitude: res.latitude,
  103. }
  104. })
  105. this.initialize()
  106. }
  107. });
  108. },
  109. onShow() {
  110. if (!uni.getStorageSync('token')) {
  111. uni.navigateTo({
  112. url: '/pages/login/index'
  113. });
  114. }
  115. },
  116. onPullDownRefresh() {
  117. this.initialize()
  118. setTimeout(() => {
  119. uni.stopPullDownRefresh();
  120. }, 500)
  121. },
  122. methods: {
  123. // 获取初始化数据
  124. initialize() {
  125. NET.request(API.getIndexSwiperList, {}, 'POST').then(res => {
  126. this.swiperList = res.data
  127. }).catch(error => {
  128. this.$refs.uTips.show({
  129. title: error.message,
  130. type: 'warning',
  131. })
  132. })
  133. NET.request(API.getMemberCardList, {}, 'POST').then(res => {
  134. this.menberList = res.data
  135. }).catch(error => {
  136. this.$refs.uTips.show({
  137. title: error.message,
  138. type: 'warning',
  139. })
  140. })
  141. NET.request(API.getAddressInfo, uni.getStorageSync('locationData'), 'POST').then(res => {
  142. this.locationText = res.data.province + '-' + res.data.city + '-' + res.data.district
  143. }).catch(error => {
  144. this.$refs.uTips.show({
  145. title: error.message,
  146. type: 'warning',
  147. })
  148. })
  149. NET.request(API.getVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  150. this.venueList = res.data
  151. }).catch(error => {
  152. this.$refs.uTips.show({
  153. title: error.message,
  154. type: 'warning',
  155. })
  156. })
  157. NET.request(API.getVideoList, uni.getStorageSync('locationData'), 'POST').then(res => {
  158. this.videoList = res.data
  159. }).catch(error => {
  160. this.$refs.uTips.show({
  161. title: error.message,
  162. type: 'warning',
  163. })
  164. })
  165. },
  166. // 跳转开通支付
  167. goToPay(site) {
  168. uni.navigateTo({
  169. url: '/pagesMain/openMember?memberCardType=' + site.type + '&typeValue=' + site.typeValue
  170. });
  171. },
  172. // 跳转场馆详情
  173. goToVenueDetail(item) {
  174. uni.navigateTo({
  175. url: '/pagesMember/venueDetail?id=' + item.id
  176. });
  177. },
  178. },
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. @import "@/static/css/themes.scss";
  183. .content {
  184. width: 100%;
  185. float: left;
  186. /deep/.u-navbar {
  187. .u-title {
  188. font-weight: bold;
  189. }
  190. }
  191. .section-title {
  192. width: 100%;
  193. height: 28px;
  194. display: flex;
  195. align-items: center;
  196. margin-top: 20px;
  197. padding: 0 15px;
  198. u-section {
  199. margin-left: 10px;
  200. flex: 1;
  201. }
  202. }
  203. .menber-box {
  204. width: 100vw;
  205. float: left;
  206. padding-left: 5px;
  207. overflow-x: auto;
  208. white-space: nowrap;
  209. .menber-col {
  210. width: 70vw;
  211. margin: 10px 15px;
  212. padding: 15px 20px;
  213. display: inline-block;
  214. background-color: #FFFFFF;
  215. border-radius: 15px;
  216. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  217. position: relative;
  218. overflow: hidden;
  219. .menber-label {
  220. width: 100%;
  221. margin-bottom: 10px;
  222. float: left;
  223. font-size: 14px;
  224. font-weight: bold;
  225. line-height: 20px;
  226. }
  227. .menber-num {
  228. width: 100%;
  229. float: left;
  230. font-size: 26px;
  231. line-height: 28px;
  232. color: $mainColor;
  233. }
  234. .menber-icon {
  235. font-size: 80px;
  236. color: $mainColor;
  237. position: absolute;
  238. right: -15px;
  239. bottom: -15x;
  240. opacity: 0.5;
  241. }
  242. }
  243. }
  244. .venue-box {
  245. width: 100vw;
  246. float: left;
  247. padding-left: 5px;
  248. overflow-x: auto;
  249. white-space: nowrap;
  250. /deep/.u-card--border:after {
  251. border-color: #cccccc;
  252. border-radius: 15px;
  253. }
  254. .venue-card {
  255. min-width: 70vw;
  256. display: inline-block;
  257. .venue-content {
  258. padding: 0px 15px 10px 15px;
  259. .venue-name {
  260. height: 20px;
  261. font-weight: bold;
  262. font-size: 15px;
  263. line-height: 20px;
  264. }
  265. .info-text {
  266. color: #999999;
  267. line-height: 18px;
  268. /deep/.u-icon {
  269. margin-right: 5px;
  270. font-size: 14px;
  271. }
  272. }
  273. }
  274. }
  275. }
  276. .video-box {
  277. width: 100vw;
  278. float: left;
  279. box-sizing: border-box;
  280. padding: 10px 7px 0px 7px;
  281. .video-card {
  282. width: calc(50% - 16px);
  283. margin: 0 8px 16px 8px;
  284. float: left;
  285. .video-col {
  286. width: 100%;
  287. height: 30vw;
  288. float: left;
  289. border-radius: 10px;
  290. overflow: hidden;
  291. video {
  292. width: 100%;
  293. height: 30vw;
  294. }
  295. }
  296. .video-name {
  297. width: 100%;
  298. float: left;
  299. text-align: center;
  300. line-height: 20px;
  301. font-size: 14px;
  302. margin-top: 5px;
  303. }
  304. }
  305. }
  306. }
  307. </style>