index.vue 13 KB

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