index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view class="pages">
  3. <!-- <view class="" :style="{height: navHeight+'px' }"></view> -->
  4. <view class="banner">
  5. <!-- <image :src="staticUrl+'/img/index-banner.png'" ></image> -->
  6. <u-swiper
  7. :list="bannerList"
  8. height="600rpx"
  9. indicatorMode="dot"
  10. :indicatorStyle="{bottom:'100rpx'}"
  11. keyName="sliderImg"
  12. radius="0"
  13. indicator
  14. circular
  15. @click="bannerClick"
  16. ></u-swiper>
  17. </view>
  18. <!-- 占位 banner -->
  19. <view class="holdbanner" style="height: 600rpx;pointer-events:none"></view>
  20. <!-- 页面滚动banner模糊 -->
  21. <view class="blurbanner" style="height: 600rpx;" :class="{ isblur: isblur }"></view>
  22. <view class="index-bg" :style="{backgroundImage:`url(${indexBg})`}"></view>
  23. <view class="page-wrap">
  24. <view class="star-title u-flex u-row-between">
  25. <view class="left u-flex">
  26. <image class="icon" :src="staticUrl+'/img/title-star.png'" ></image>
  27. <text class="text">演出剧目</text>
  28. </view>
  29. </view>
  30. <swiper class="swiper" :autoplay="false" style="height: 400rpx;margin-bottom: 34rpx" >
  31. <swiper-item :item-id="item.id" v-for="(item,index) in theatreList" :key="index">
  32. <view class="programme-wrap">
  33. <view class="programme">
  34. <image class="img" :src="item.showImg" ></image>
  35. <!-- <image class="img" :src="item.showImg" ></image> -->
  36. <view class="text u-flex u-row-between">
  37. <view class="left">
  38. <view class="name">{{item.name}}</view>
  39. <!-- <view class="addr">演出地点:{{item.address}}</view> -->
  40. </view>
  41. <view class="btn" @click="bookticket(item)">立即预定</view>
  42. </view>
  43. <!-- <view class="share" @click="getPoster(item)">
  44. <image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
  45. </view> -->
  46. </view>
  47. </view>
  48. </swiper-item>
  49. </swiper>
  50. </view>
  51. <view class="news-wrap">
  52. <view class="star-title u-flex u-row-between">
  53. <view class="left u-flex">
  54. <image class="icon" :src="staticUrl+'/img/title-star.png'" ></image>
  55. <text class="text">演出资讯</text>
  56. </view>
  57. <view class="right u-flex" @click="$u.route('pages/news')">
  58. <text class="text">更多</text>
  59. <u-icon name="arrow-right" color="#C79191" size="36rpx"></u-icon>
  60. </view>
  61. </view>
  62. <view class="news">
  63. <u-scroll-list :indicator="false">
  64. <view class="item" v-for="(item, index) in newsList" @click="newsClick(item)" :key="index">
  65. <image class="img" :src="item.mainImg" mode="aspectFill"></image>
  66. <view class="text" style="padding-bottom: 10px;">
  67. <view class="name u-line-2">{{item.title}}</view>
  68. <view class="con u-line-1">{{item.infoSnapshot}}</view>
  69. <view class="time u-flex u-row-between">
  70. <view class="left">{{$u.timeFormat(item.onlineTime, 'yyyy-mm-dd')}}</view>
  71. <image class="icon" :src="staticUrl+'/img/arrow-right-ico.png'" ></image>
  72. </view>
  73. </view>
  74. </view>
  75. </u-scroll-list>
  76. </view>
  77. </view>
  78. <!-- content-wrap end -->
  79. <!-- <image class="activity" :src="staticUrl+'/img/activity.png'" ></image> -->
  80. <!-- 分享选择弹出内容 -->
  81. <view class="share-option" :class="{shareShow:shareShow}">
  82. <view class="overlay" v-if="shareShow" @click="shareShow=false"></view>
  83. <button class="share-option-item wx-share" data-name="shareBtn" open-type="share">
  84. 发送给朋友
  85. </button>
  86. <view class="share-option-item" @click="getPoster">生成海报</view>
  87. <view class="share-option-item" @click="shareShow=false">取消</view>
  88. </view>
  89. <u-popup :show="posterShow" @close="posterShow=false" ref="uni-popup">
  90. <view class="poster-wrap u-flex u-col-center">
  91. <view class="poster-inner">
  92. <view class="close-wrap" @click="posterShow=false">
  93. <u-icon name="close-circle" color="#fff" size="56rpx"></u-icon>
  94. </view>
  95. <view class="poster" id="poster" ref="poster" >
  96. <u--image :showLoading="true" :src="posterSrc" width="100%" height="65vh" mode="aspectFit"></u--image>
  97. </view>
  98. <!-- savePoster -->
  99. <view class="poster-btn" @click="saveImage">保存图片</view>
  100. </view>
  101. </view>
  102. </u-popup>
  103. <u-toast ref="uToast"></u-toast>
  104. <!-- <image @click="audioClick" :class="{rotate:musicPlay}" class="audio-btn" :showLoading="false" :src="staticUrl+'/img/music.svg'"></image> -->
  105. <tabbar :tabbarIndexProps='0' />
  106. </view>
  107. </template>
  108. <script>
  109. import { systemInfo } from "@/mixin.js";
  110. import tabbar from "../../components/tabbar.vue";
  111. // const innerAudioContext = uni.createInnerAudioContext();
  112. export default {
  113. onShareAppMessage(res) {
  114. if (res.from === 'button') {// 来自页面内分享按钮
  115. console.log(res.target)
  116. }
  117. return {
  118. title: this.$isDevelop?'剧场票务':'伟大转折演艺',
  119. path: '/pages/index/index'
  120. }
  121. },
  122. onShareTimeline(res) {
  123. if (res.from === 'button') {// 来自页面内分享按钮
  124. console.log(res.target)
  125. }
  126. return {
  127. title: this.$isDevelop?'剧场票务':'伟大转折演艺',
  128. path: '/pages/index/index'
  129. }
  130. },
  131. components:{
  132. tabbar,
  133. // cartfixed
  134. },
  135. mixins:[systemInfo],
  136. data() {
  137. return {
  138. staticUrl:this.$commonConfig.staticUrl,
  139. bannerList: [],
  140. theatreList:[],//剧院信息列表
  141. bannerCurrent: 0,
  142. isblur:false,
  143. newsList:[],//资讯
  144. shareShow:false,
  145. posterShow:false,
  146. posterStyle:{},
  147. posterSrc:'',
  148. musicPlay:true,
  149. indexBg:`${this.$commonConfig.staticUrl}/img/index-bg.png`,
  150. scene:null,
  151. }
  152. },
  153. computed: {
  154. },
  155. onShow() {
  156. // if(innerAudioContext.src){
  157. // this.audioStop();
  158. // this.audioPlay();
  159. // }
  160. },
  161. beforeRouteLeave() {
  162. },
  163. onLoad(page) {
  164. console.log('index page',page);
  165. const scene = decodeURIComponent(page.scene);
  166. if(scene&&scene!='undefined'){
  167. console.log('index scene',scene);
  168. this.scene = scene;
  169. scene&&uni.setStorage({
  170. key:'scene',
  171. data:scene
  172. });
  173. }
  174. this.getSystemInfo();
  175. // console.log('statusBarHeight',this.statusBarHeight);
  176. // console.log('navigationBarHeight',this.navigationBarHeight);
  177. // console.log('windowHeight',this.windowHeight);
  178. // console.log('navHeight',this.navHeight);
  179. // console.log('vuex_member_info=======',this.vuex_member_info);
  180. this.getClientIndex();
  181. //音乐地址
  182. // innerAudioContext.src = this.staticUrl+'/img/audio.mp3';
  183. // innerAudioContext.autoplay = true;//自动播放
  184. // innerAudioContext.loop = true; //循环播放
  185. //音乐播放
  186. // this.audioStop();
  187. // this.audioPlay();
  188. if(this.$isDevelop){
  189. this.indexBg = `${this.$commonConfig.staticUrl}/img/index-bg-dev.png`;
  190. // this.indexBg = 'none'
  191. }
  192. },
  193. onReady() {
  194. },
  195. onUnload() {
  196. // this.audioStop();
  197. },
  198. methods: {
  199. getMemberInfo(){
  200. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  201. this.memberInfo = res.data;
  202. this.avatar = res.data.avatar;
  203. this.$u.vuex('vuex_member_info', res.data);
  204. // console.log('memberInfo',this.memberInfo);
  205. }).catch(err=>{
  206. // console.log('memberInfo',err.data);
  207. })
  208. },
  209. getHotGoods(){
  210. this.$u.api.topGoodList({pageNum:1,pageSize:20}).then(res=>{
  211. this.hotGoods = res.data.rows;
  212. // console.log('res',res);
  213. }).catch(err=>{
  214. console.log('getHotGoods',err.data);
  215. })
  216. },
  217. getClientIndex(){
  218. this.$u.api.clientIndex().then(res=>{
  219. // console.log('res',res);
  220. this.bannerList = res.data.advList;
  221. this.theatreList = res.data.performList;
  222. this.newsList = res.data.informationList;
  223. }).catch(err=>{
  224. console.log('getClientIndex',err.data);
  225. })
  226. },
  227. goLogin(){
  228. uni.$u.route('/pages/login/login')
  229. },
  230. onPageScroll(e){
  231. if(e.scrollTop>100){
  232. this.isblur = true
  233. }else{
  234. this.isblur = false
  235. }
  236. },
  237. async bookticket(item){
  238. let retailId = null;
  239. try {
  240. const res = await uni.getStorage({ key: 'retailId' });
  241. retailId = res.data;
  242. } catch (error) {
  243. }
  244. // console.log('bookticket',item);
  245. if(retailId){
  246. uni.$u.route('pages/ticketlist',{id:item.id})
  247. }else{
  248. uni.navigateToMiniProgram({
  249. // appId: 'wx2c348cf579062e56', // 美团小程序appId
  250. shortLink: '#小程序://美团丨外卖团购特价美食酒店电影/VPWfvtLFajYiHei',
  251. // path: item.url
  252. })
  253. }
  254. },
  255. openShare(){
  256. this.shareShow = true;
  257. },
  258. // 海报相关开始
  259. getPoster(item){
  260. this.posterShow = true;
  261. this.shareShow = false;
  262. this.$u.api.performQrcode({performId:item.id}).then(res=>{
  263. this.posterSrc = res.data.imageUrl;
  264. // console.log('getPoster',res.data);
  265. }).catch(err=>{
  266. console.log('getPoster',err);
  267. })
  268. },
  269. saveImage() {
  270. let that = this;
  271. uni.showLoading({
  272. title: '保存中'
  273. });
  274. uni.downloadFile({
  275. url: this.posterSrc,
  276. success(res) {
  277. if (res.statusCode === 200) {
  278. uni.saveImageToPhotosAlbum({
  279. filePath: res.tempFilePath,
  280. success() {
  281. uni.showToast({
  282. title: '保存到相册成功',
  283. icon: 'success'
  284. });
  285. },
  286. fail(err) {
  287. console.log('保存图片失败',err);
  288. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  289. uni.getSetting({
  290. success(res) {
  291. if (!res.authSetting['scope.writePhotosAlbum']) {
  292. uni.showModal({
  293. title: '提示',
  294. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  295. confirmText: '去设置',
  296. success(res) {
  297. if (res.confirm) {
  298. uni.openSetting();
  299. }
  300. }
  301. });
  302. } else {
  303. uni.showToast({
  304. title: '保存图片失败',
  305. icon: 'none'
  306. });
  307. }
  308. }
  309. });
  310. } else {
  311. uni.showToast({
  312. title: '保存图片失败',
  313. icon: 'none'
  314. });
  315. }
  316. },
  317. complete() {
  318. uni.hideLoading();
  319. that.posterShow = false;
  320. }
  321. });
  322. } else {
  323. uni.showToast({
  324. title: '下载图片失败',
  325. icon: 'none'
  326. });
  327. }
  328. },
  329. fail() {
  330. uni.showToast({
  331. title: '下载图片失败',
  332. icon: 'none'
  333. });
  334. }
  335. });
  336. },
  337. // 海报相关结束
  338. newsClick(item){
  339. uni.$u.route('/pages/newsdetails', {
  340. id: item.id,
  341. type:'news'
  342. });
  343. },
  344. bannerClick(e){
  345. return false
  346. let item = this.bannerList[e];
  347. // console.log('bannerClick',this.bannerList[e]);
  348. uni.$u.route('/pages/newsdetails', {
  349. id: item.id,
  350. type:'swiperDetail'
  351. });
  352. },
  353. audioClick(){
  354. console.log('musicPlay',this.musicPlay);
  355. if (this.musicPlay == true) {
  356. this.audioStop();
  357. } else if(this.musicPlay == false){
  358. this.audioPlay();
  359. }
  360. },
  361. audioStop(){
  362. this.musicPlay = false;
  363. innerAudioContext.stop()
  364. },
  365. audioPlay(){
  366. this.musicPlay = true;
  367. innerAudioContext.play()
  368. }
  369. }
  370. }
  371. </script>
  372. <style>
  373. page{
  374. }
  375. </style>
  376. <style lang="scss" scoped>
  377. $pagegap:32rpx;
  378. .banner{
  379. position: fixed;
  380. left: 0;
  381. top: 0;
  382. width: 100%;
  383. }
  384. .blurbanner{
  385. pointer-events: none;
  386. position: fixed;
  387. left: 0;
  388. top: 0;
  389. width: 100%;
  390. transition: all 0.3s;
  391. &.isblur{
  392. backdrop-filter: blur(8px);
  393. }
  394. }
  395. .index-bg{
  396. position: fixed;
  397. display: block;
  398. left: 0;
  399. bottom: 0;
  400. width: 100%;
  401. min-height: calc( 100vh - 600rpx + 50rpx );
  402. background-repeat: no-repeat;
  403. background-position: top center;
  404. background-size: 100% auto;
  405. // background-color: #a00303;
  406. // z-index: -1;
  407. }
  408. .page-wrap{
  409. position: relative;
  410. }
  411. .star-title{
  412. margin-bottom: 22rpx;
  413. .left{
  414. .icon{
  415. width: 28rpx;
  416. height: 28rpx;
  417. margin-right: 8rpx;
  418. }
  419. .text{
  420. font-size: 32rpx;
  421. font-weight: bold;
  422. color: #FFFFFF;
  423. line-height: 48rpx;
  424. background: linear-gradient(128deg, #FFEFBC 0%, #FFD767 100%);
  425. -webkit-background-clip: text;
  426. -webkit-text-fill-color: transparent;
  427. }
  428. }
  429. .right{
  430. padding: 10rpx 32rpx 10rpx 10rpx;
  431. .text{
  432. font-size: 24rpx;
  433. font-weight: 400;
  434. color: #C79191;
  435. }
  436. }
  437. }
  438. .programme-wrap{
  439. // margin-bottom: 64rpx;
  440. .programme{
  441. // background-color: #FFFFFF;
  442. position: relative;
  443. border-radius: 30rpx;
  444. overflow: hidden;
  445. // background: radial-gradient(circle at -26rpx 230rpx, transparent 10%, #fff 4%) left, radial-gradient(circle at calc( 100% + 26rpx ) 232rpx, transparent 10%, #fff 4%) right;
  446. background-color: #fff;
  447. background-size: 50% 100%;
  448. background-repeat: no-repeat;
  449. .img{
  450. width: 100%;
  451. height: 242rpx;
  452. display: block;
  453. }
  454. .text{
  455. position: relative;
  456. // &:before{
  457. // content: '';
  458. // // width: calc( 100% - 32rpx );
  459. // width: 100%;
  460. // height: 1px;
  461. // position: absolute;
  462. // left: 0;
  463. // top: -2rpx;
  464. // border-top: 4rpx dashed #931E0C;
  465. // }
  466. padding: 32rpx 30rpx;
  467. .name{
  468. font-size: 28rpx;
  469. font-weight: bold;
  470. color: #363636;
  471. line-height: 42rpx;
  472. // margin-bottom: 18rpx;
  473. }
  474. .addr{
  475. font-size: 22rpx;
  476. font-weight: 400;
  477. color: #7F7F7F;
  478. line-height: 34rpx;
  479. }
  480. .btn{
  481. height: 51rpx;
  482. line-height: 51rpx;
  483. padding: 0 24rpx;
  484. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  485. border-radius: 25rpx;
  486. font-size: 20rpx;
  487. font-weight: 400;
  488. color: #FFFFFF;
  489. }
  490. }
  491. .share{
  492. position: absolute;
  493. right: 16rpx;
  494. top: 16rpx;
  495. padding: 10rpx;
  496. border-radius: 50%;
  497. background-color: rgba(0,0,0,0.4);
  498. .icon{
  499. display: block;
  500. width: 32rpx;
  501. height: 32rpx;
  502. }
  503. }
  504. }
  505. }
  506. .news-wrap{
  507. position: relative;
  508. margin-left: $pagegap;
  509. margin-bottom: 180rpx;
  510. .star-title{
  511. // margin-right: $pagegap;
  512. }
  513. .item{
  514. width: 434rpx;
  515. flex-shrink: 0;
  516. margin-right: 20rpx;
  517. background: #FFFFFF;
  518. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(59,0,0,0.5);
  519. border-radius: 12rpx;
  520. overflow: hidden;
  521. .img{
  522. display: block;
  523. width: 100%;
  524. height: 174rpx;
  525. }
  526. .text{
  527. padding: 30rpx 20rpx 28rpx;
  528. .name{
  529. font-size: 28rpx;
  530. font-weight: bold;
  531. color: #333333;
  532. margin-bottom: 12rpx;
  533. }
  534. .con{
  535. font-size: 24rpx;
  536. font-weight: 400;
  537. color: #6B6B6B;
  538. // line-height: 22rpx;
  539. margin-bottom: 20rpx;
  540. }
  541. .time{
  542. font-size: 20rpx;
  543. font-weight: 400;
  544. color: #C0C0C0;
  545. line-height: 22rpx;
  546. }
  547. .icon{
  548. display: block;
  549. width: 80rpx;
  550. height: 20rpx;
  551. }
  552. }
  553. }
  554. }
  555. .activity{
  556. display: block;
  557. width: 112rpx;
  558. height: 132rpx;
  559. position: fixed;
  560. right: 16rpx;
  561. bottom: 174rpx;
  562. }
  563. .audio-btn{
  564. width: 30px;
  565. height: 30px;
  566. border-radius: 50%;
  567. position: fixed;
  568. right: 24rpx;
  569. top: 150px;
  570. }
  571. .rotate{
  572. animation: rotate 4s infinite linear;
  573. }
  574. @keyframes rotate {
  575. 0% {
  576. transform: rotate(0deg);
  577. }
  578. 100% {
  579. transform: rotate(360deg);
  580. }
  581. }
  582. </style>