index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  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. // https://blog.csdn.net/qq_42961150/article/details/121136346
  249. // https://cloud.tencent.com/developer/article/1053234
  250. // 复制链接到剪贴板
  251. // uni.setClipboardData({
  252. // data: 'https://itrip.meituan.com/panda/api/s/ditui/ticket/1b073febffd2101c',
  253. // success: function () {
  254. // uni.showModal({
  255. // title: '提示',
  256. // content: '链接已复制,请在浏览器中打开查看',
  257. // showCancel: false,
  258. // confirmText: '我知道了'
  259. // })
  260. // }
  261. // })
  262. // 小程序短链接跳转
  263. // uni.navigateToMiniProgram({
  264. // // appId: 'wx2c348cf579062e56', // 美团小程序appId
  265. // shortLink: '#小程序://美团丨外卖团购特价美食酒店电影/VPWfvtLFajYiHei',
  266. // // path: item.url
  267. // })
  268. //小程序appId打开
  269. wx.navigateToMiniProgram({
  270. appId: 'wx4fa555703dced95c',
  271. path: '/pages/max/pages/landing/index?q=https://itrip.meituan.com/panda/api/s/ditui/ticket/1b073febffd2101c',
  272. // extraData: {
  273. // foo: 'bar'
  274. // },
  275. // envVersion: 'develop',
  276. // success(res) {
  277. // // 打开成功
  278. // }
  279. })
  280. }
  281. },
  282. openShare(){
  283. this.shareShow = true;
  284. },
  285. // 海报相关开始
  286. getPoster(item){
  287. this.posterShow = true;
  288. this.shareShow = false;
  289. this.$u.api.performQrcode({performId:item.id}).then(res=>{
  290. this.posterSrc = res.data.imageUrl;
  291. // console.log('getPoster',res.data);
  292. }).catch(err=>{
  293. console.log('getPoster',err);
  294. })
  295. },
  296. saveImage() {
  297. let that = this;
  298. uni.showLoading({
  299. title: '保存中'
  300. });
  301. uni.downloadFile({
  302. url: this.posterSrc,
  303. success(res) {
  304. if (res.statusCode === 200) {
  305. uni.saveImageToPhotosAlbum({
  306. filePath: res.tempFilePath,
  307. success() {
  308. uni.showToast({
  309. title: '保存到相册成功',
  310. icon: 'success'
  311. });
  312. },
  313. fail(err) {
  314. console.log('保存图片失败',err);
  315. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  316. uni.getSetting({
  317. success(res) {
  318. if (!res.authSetting['scope.writePhotosAlbum']) {
  319. uni.showModal({
  320. title: '提示',
  321. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  322. confirmText: '去设置',
  323. success(res) {
  324. if (res.confirm) {
  325. uni.openSetting();
  326. }
  327. }
  328. });
  329. } else {
  330. uni.showToast({
  331. title: '保存图片失败',
  332. icon: 'none'
  333. });
  334. }
  335. }
  336. });
  337. } else {
  338. uni.showToast({
  339. title: '保存图片失败',
  340. icon: 'none'
  341. });
  342. }
  343. },
  344. complete() {
  345. uni.hideLoading();
  346. that.posterShow = false;
  347. }
  348. });
  349. } else {
  350. uni.showToast({
  351. title: '下载图片失败',
  352. icon: 'none'
  353. });
  354. }
  355. },
  356. fail() {
  357. uni.showToast({
  358. title: '下载图片失败',
  359. icon: 'none'
  360. });
  361. }
  362. });
  363. },
  364. // 海报相关结束
  365. newsClick(item){
  366. uni.$u.route('/pages/newsdetails', {
  367. id: item.id,
  368. type:'news'
  369. });
  370. },
  371. bannerClick(e){
  372. return false
  373. let item = this.bannerList[e];
  374. // console.log('bannerClick',this.bannerList[e]);
  375. uni.$u.route('/pages/newsdetails', {
  376. id: item.id,
  377. type:'swiperDetail'
  378. });
  379. },
  380. audioClick(){
  381. console.log('musicPlay',this.musicPlay);
  382. if (this.musicPlay == true) {
  383. this.audioStop();
  384. } else if(this.musicPlay == false){
  385. this.audioPlay();
  386. }
  387. },
  388. audioStop(){
  389. this.musicPlay = false;
  390. innerAudioContext.stop()
  391. },
  392. audioPlay(){
  393. this.musicPlay = true;
  394. innerAudioContext.play()
  395. }
  396. }
  397. }
  398. </script>
  399. <style>
  400. page{
  401. }
  402. </style>
  403. <style lang="scss" scoped>
  404. $pagegap:32rpx;
  405. .banner{
  406. position: fixed;
  407. left: 0;
  408. top: 0;
  409. width: 100%;
  410. }
  411. .blurbanner{
  412. pointer-events: none;
  413. position: fixed;
  414. left: 0;
  415. top: 0;
  416. width: 100%;
  417. transition: all 0.3s;
  418. &.isblur{
  419. backdrop-filter: blur(8px);
  420. }
  421. }
  422. .index-bg{
  423. position: fixed;
  424. display: block;
  425. left: 0;
  426. bottom: 0;
  427. width: 100%;
  428. min-height: calc( 100vh - 600rpx + 50rpx );
  429. background-repeat: no-repeat;
  430. background-position: top center;
  431. background-size: 100% auto;
  432. // background-color: #a00303;
  433. // z-index: -1;
  434. }
  435. .page-wrap{
  436. position: relative;
  437. }
  438. .star-title{
  439. margin-bottom: 22rpx;
  440. .left{
  441. .icon{
  442. width: 28rpx;
  443. height: 28rpx;
  444. margin-right: 8rpx;
  445. }
  446. .text{
  447. font-size: 32rpx;
  448. font-weight: bold;
  449. color: #FFFFFF;
  450. line-height: 48rpx;
  451. background: linear-gradient(128deg, #FFEFBC 0%, #FFD767 100%);
  452. -webkit-background-clip: text;
  453. -webkit-text-fill-color: transparent;
  454. }
  455. }
  456. .right{
  457. padding: 10rpx 32rpx 10rpx 10rpx;
  458. .text{
  459. font-size: 24rpx;
  460. font-weight: 400;
  461. color: #C79191;
  462. }
  463. }
  464. }
  465. .programme-wrap{
  466. // margin-bottom: 64rpx;
  467. .programme{
  468. // background-color: #FFFFFF;
  469. position: relative;
  470. border-radius: 30rpx;
  471. overflow: hidden;
  472. // 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;
  473. background-color: #fff;
  474. background-size: 50% 100%;
  475. background-repeat: no-repeat;
  476. .img{
  477. width: 100%;
  478. height: 242rpx;
  479. display: block;
  480. }
  481. .text{
  482. position: relative;
  483. // &:before{
  484. // content: '';
  485. // // width: calc( 100% - 32rpx );
  486. // width: 100%;
  487. // height: 1px;
  488. // position: absolute;
  489. // left: 0;
  490. // top: -2rpx;
  491. // border-top: 4rpx dashed #931E0C;
  492. // }
  493. padding: 32rpx 30rpx;
  494. .name{
  495. font-size: 28rpx;
  496. font-weight: bold;
  497. color: #363636;
  498. line-height: 42rpx;
  499. // margin-bottom: 18rpx;
  500. }
  501. .addr{
  502. font-size: 22rpx;
  503. font-weight: 400;
  504. color: #7F7F7F;
  505. line-height: 34rpx;
  506. }
  507. .btn{
  508. height: 51rpx;
  509. line-height: 51rpx;
  510. padding: 0 24rpx;
  511. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  512. border-radius: 25rpx;
  513. font-size: 20rpx;
  514. font-weight: 400;
  515. color: #FFFFFF;
  516. }
  517. }
  518. .share{
  519. position: absolute;
  520. right: 16rpx;
  521. top: 16rpx;
  522. padding: 10rpx;
  523. border-radius: 50%;
  524. background-color: rgba(0,0,0,0.4);
  525. .icon{
  526. display: block;
  527. width: 32rpx;
  528. height: 32rpx;
  529. }
  530. }
  531. }
  532. }
  533. .news-wrap{
  534. position: relative;
  535. margin-left: $pagegap;
  536. margin-bottom: 180rpx;
  537. .star-title{
  538. // margin-right: $pagegap;
  539. }
  540. .item{
  541. width: 434rpx;
  542. flex-shrink: 0;
  543. margin-right: 20rpx;
  544. background: #FFFFFF;
  545. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(59,0,0,0.5);
  546. border-radius: 12rpx;
  547. overflow: hidden;
  548. .img{
  549. display: block;
  550. width: 100%;
  551. height: 174rpx;
  552. }
  553. .text{
  554. padding: 30rpx 20rpx 28rpx;
  555. .name{
  556. font-size: 28rpx;
  557. font-weight: bold;
  558. color: #333333;
  559. margin-bottom: 12rpx;
  560. }
  561. .con{
  562. font-size: 24rpx;
  563. font-weight: 400;
  564. color: #6B6B6B;
  565. // line-height: 22rpx;
  566. margin-bottom: 20rpx;
  567. }
  568. .time{
  569. font-size: 20rpx;
  570. font-weight: 400;
  571. color: #C0C0C0;
  572. line-height: 22rpx;
  573. }
  574. .icon{
  575. display: block;
  576. width: 80rpx;
  577. height: 20rpx;
  578. }
  579. }
  580. }
  581. }
  582. .activity{
  583. display: block;
  584. width: 112rpx;
  585. height: 132rpx;
  586. position: fixed;
  587. right: 16rpx;
  588. bottom: 174rpx;
  589. }
  590. .audio-btn{
  591. width: 30px;
  592. height: 30px;
  593. border-radius: 50%;
  594. position: fixed;
  595. right: 24rpx;
  596. top: 150px;
  597. }
  598. .rotate{
  599. animation: rotate 4s infinite linear;
  600. }
  601. @keyframes rotate {
  602. 0% {
  603. transform: rotate(0deg);
  604. }
  605. 100% {
  606. transform: rotate(360deg);
  607. }
  608. }
  609. </style>