index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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(${staticUrl}/img/index-bg.png?a=1)`}"></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: '伟大转折演艺',
  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: '伟大转折演艺',
  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. }
  150. },
  151. computed: {
  152. },
  153. onShow() {
  154. // if(innerAudioContext.src){
  155. // this.audioStop();
  156. // this.audioPlay();
  157. // }
  158. },
  159. beforeRouteLeave() {
  160. },
  161. onLoad(page) {
  162. console.log('index page',page);
  163. const scene = decodeURIComponent(page.scene);
  164. if(scene&&scene!='undefined'){
  165. console.log('index scene',scene);
  166. scene&&uni.setStorage({
  167. key:'scene',
  168. data:scene
  169. });
  170. }
  171. this.getSystemInfo();
  172. // console.log('statusBarHeight',this.statusBarHeight);
  173. // console.log('navigationBarHeight',this.navigationBarHeight);
  174. // console.log('windowHeight',this.windowHeight);
  175. // console.log('navHeight',this.navHeight);
  176. // console.log('vuex_member_info=======',this.vuex_member_info);
  177. this.getClientIndex();
  178. //音乐地址
  179. // innerAudioContext.src = this.staticUrl+'/img/audio.mp3';
  180. // innerAudioContext.autoplay = true;//自动播放
  181. // innerAudioContext.loop = true; //循环播放
  182. //音乐播放
  183. // this.audioStop();
  184. // this.audioPlay();
  185. },
  186. onReady() {
  187. },
  188. onUnload() {
  189. // this.audioStop();
  190. },
  191. methods: {
  192. getMemberInfo(){
  193. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  194. this.memberInfo = res.data;
  195. this.avatar = res.data.avatar;
  196. this.$u.vuex('vuex_member_info', res.data);
  197. // console.log('memberInfo',this.memberInfo);
  198. }).catch(err=>{
  199. // console.log('memberInfo',err.data);
  200. })
  201. },
  202. getHotGoods(){
  203. this.$u.api.topGoodList({pageNum:1,pageSize:20}).then(res=>{
  204. this.hotGoods = res.data.rows;
  205. // console.log('res',res);
  206. }).catch(err=>{
  207. console.log('getHotGoods',err.data);
  208. })
  209. },
  210. getClientIndex(){
  211. this.$u.api.clientIndex().then(res=>{
  212. // console.log('res',res);
  213. this.bannerList = res.data.advList;
  214. this.theatreList = res.data.performList;
  215. this.newsList = res.data.informationList;
  216. }).catch(err=>{
  217. console.log('getClientIndex',err.data);
  218. })
  219. },
  220. goLogin(){
  221. uni.$u.route('/pages/login/login')
  222. },
  223. onPageScroll(e){
  224. if(e.scrollTop>100){
  225. this.isblur = true
  226. }else{
  227. this.isblur = false
  228. }
  229. },
  230. bookticket(item){
  231. // console.log('bookticket',item);
  232. uni.$u.route('pages/ticketlist',{id:item.id})
  233. },
  234. openShare(){
  235. this.shareShow = true;
  236. },
  237. // 海报相关开始
  238. getPoster(item){
  239. this.posterShow = true;
  240. this.shareShow = false;
  241. this.$u.api.performQrcode({performId:item.id}).then(res=>{
  242. this.posterSrc = res.data.imageUrl;
  243. // console.log('getPoster',res.data);
  244. }).catch(err=>{
  245. console.log('getPoster',err);
  246. })
  247. },
  248. saveImage() {
  249. let that = this;
  250. uni.showLoading({
  251. title: '保存中'
  252. });
  253. uni.downloadFile({
  254. url: this.posterSrc,
  255. success(res) {
  256. if (res.statusCode === 200) {
  257. uni.saveImageToPhotosAlbum({
  258. filePath: res.tempFilePath,
  259. success() {
  260. uni.showToast({
  261. title: '保存到相册成功',
  262. icon: 'success'
  263. });
  264. },
  265. fail(err) {
  266. console.log('保存图片失败',err);
  267. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  268. uni.getSetting({
  269. success(res) {
  270. if (!res.authSetting['scope.writePhotosAlbum']) {
  271. uni.showModal({
  272. title: '提示',
  273. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  274. confirmText: '去设置',
  275. success(res) {
  276. if (res.confirm) {
  277. uni.openSetting();
  278. }
  279. }
  280. });
  281. } else {
  282. uni.showToast({
  283. title: '保存图片失败',
  284. icon: 'none'
  285. });
  286. }
  287. }
  288. });
  289. } else {
  290. uni.showToast({
  291. title: '保存图片失败',
  292. icon: 'none'
  293. });
  294. }
  295. },
  296. complete() {
  297. uni.hideLoading();
  298. that.posterShow = false;
  299. }
  300. });
  301. } else {
  302. uni.showToast({
  303. title: '下载图片失败',
  304. icon: 'none'
  305. });
  306. }
  307. },
  308. fail() {
  309. uni.showToast({
  310. title: '下载图片失败',
  311. icon: 'none'
  312. });
  313. }
  314. });
  315. },
  316. // 海报相关结束
  317. newsClick(item){
  318. uni.$u.route('/pages/newsdetails', {
  319. id: item.id,
  320. type:'news'
  321. });
  322. },
  323. bannerClick(e){
  324. return false
  325. let item = this.bannerList[e];
  326. // console.log('bannerClick',this.bannerList[e]);
  327. uni.$u.route('/pages/newsdetails', {
  328. id: item.id,
  329. type:'swiperDetail'
  330. });
  331. },
  332. audioClick(){
  333. console.log('musicPlay',this.musicPlay);
  334. if (this.musicPlay == true) {
  335. this.audioStop();
  336. } else if(this.musicPlay == false){
  337. this.audioPlay();
  338. }
  339. },
  340. audioStop(){
  341. this.musicPlay = false;
  342. innerAudioContext.stop()
  343. },
  344. audioPlay(){
  345. this.musicPlay = true;
  346. innerAudioContext.play()
  347. }
  348. }
  349. }
  350. </script>
  351. <style>
  352. page{
  353. }
  354. </style>
  355. <style lang="scss" scoped>
  356. $pagegap:32rpx;
  357. .banner{
  358. position: fixed;
  359. left: 0;
  360. top: 0;
  361. width: 100%;
  362. }
  363. .blurbanner{
  364. pointer-events: none;
  365. position: fixed;
  366. left: 0;
  367. top: 0;
  368. width: 100%;
  369. transition: all 0.3s;
  370. &.isblur{
  371. backdrop-filter: blur(8px);
  372. }
  373. }
  374. .index-bg{
  375. position: fixed;
  376. display: block;
  377. left: 0;
  378. bottom: 0;
  379. width: 100%;
  380. min-height: calc( 100vh - 600rpx + 50rpx );
  381. background-repeat: no-repeat;
  382. background-position: top center;
  383. background-size: 100% auto;
  384. // z-index: -1;
  385. }
  386. .page-wrap{
  387. position: relative;
  388. }
  389. .star-title{
  390. margin-bottom: 22rpx;
  391. .left{
  392. .icon{
  393. width: 28rpx;
  394. height: 28rpx;
  395. margin-right: 8rpx;
  396. }
  397. .text{
  398. font-size: 32rpx;
  399. font-weight: bold;
  400. color: #FFFFFF;
  401. line-height: 48rpx;
  402. background: linear-gradient(128deg, #FFEFBC 0%, #FFD767 100%);
  403. -webkit-background-clip: text;
  404. -webkit-text-fill-color: transparent;
  405. }
  406. }
  407. .right{
  408. padding: 10rpx 32rpx 10rpx 10rpx;
  409. .text{
  410. font-size: 24rpx;
  411. font-weight: 400;
  412. color: #C79191;
  413. }
  414. }
  415. }
  416. .programme-wrap{
  417. // margin-bottom: 64rpx;
  418. .programme{
  419. // background-color: #FFFFFF;
  420. position: relative;
  421. border-radius: 30rpx;
  422. overflow: hidden;
  423. // 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;
  424. background-color: #fff;
  425. background-size: 50% 100%;
  426. background-repeat: no-repeat;
  427. .img{
  428. width: 100%;
  429. height: 242rpx;
  430. display: block;
  431. }
  432. .text{
  433. position: relative;
  434. // &:before{
  435. // content: '';
  436. // // width: calc( 100% - 32rpx );
  437. // width: 100%;
  438. // height: 1px;
  439. // position: absolute;
  440. // left: 0;
  441. // top: -2rpx;
  442. // border-top: 4rpx dashed #931E0C;
  443. // }
  444. padding: 32rpx 30rpx;
  445. .name{
  446. font-size: 28rpx;
  447. font-weight: bold;
  448. color: #363636;
  449. line-height: 42rpx;
  450. // margin-bottom: 18rpx;
  451. }
  452. .addr{
  453. font-size: 22rpx;
  454. font-weight: 400;
  455. color: #7F7F7F;
  456. line-height: 34rpx;
  457. }
  458. .btn{
  459. height: 51rpx;
  460. line-height: 51rpx;
  461. padding: 0 24rpx;
  462. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  463. border-radius: 25rpx;
  464. font-size: 20rpx;
  465. font-weight: 400;
  466. color: #FFFFFF;
  467. }
  468. }
  469. .share{
  470. position: absolute;
  471. right: 16rpx;
  472. top: 16rpx;
  473. padding: 10rpx;
  474. border-radius: 50%;
  475. background-color: rgba(0,0,0,0.4);
  476. .icon{
  477. display: block;
  478. width: 32rpx;
  479. height: 32rpx;
  480. }
  481. }
  482. }
  483. }
  484. .news-wrap{
  485. position: relative;
  486. margin-left: $pagegap;
  487. margin-bottom: 180rpx;
  488. .star-title{
  489. // margin-right: $pagegap;
  490. }
  491. .item{
  492. width: 434rpx;
  493. flex-shrink: 0;
  494. margin-right: 20rpx;
  495. background: #FFFFFF;
  496. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(59,0,0,0.5);
  497. border-radius: 12rpx;
  498. overflow: hidden;
  499. .img{
  500. display: block;
  501. width: 100%;
  502. height: 174rpx;
  503. }
  504. .text{
  505. padding: 30rpx 20rpx 28rpx;
  506. .name{
  507. font-size: 28rpx;
  508. font-weight: bold;
  509. color: #333333;
  510. margin-bottom: 12rpx;
  511. }
  512. .con{
  513. font-size: 24rpx;
  514. font-weight: 400;
  515. color: #6B6B6B;
  516. // line-height: 22rpx;
  517. margin-bottom: 20rpx;
  518. }
  519. .time{
  520. font-size: 20rpx;
  521. font-weight: 400;
  522. color: #C0C0C0;
  523. line-height: 22rpx;
  524. }
  525. .icon{
  526. display: block;
  527. width: 80rpx;
  528. height: 20rpx;
  529. }
  530. }
  531. }
  532. }
  533. .activity{
  534. display: block;
  535. width: 112rpx;
  536. height: 132rpx;
  537. position: fixed;
  538. right: 16rpx;
  539. bottom: 174rpx;
  540. }
  541. .audio-btn{
  542. width: 30px;
  543. height: 30px;
  544. border-radius: 50%;
  545. position: fixed;
  546. right: 24rpx;
  547. top: 150px;
  548. }
  549. .rotate{
  550. animation: rotate 4s infinite linear;
  551. }
  552. @keyframes rotate {
  553. 0% {
  554. transform: rotate(0deg);
  555. }
  556. 100% {
  557. transform: rotate(360deg);
  558. }
  559. }
  560. </style>