index.vue 16 KB

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