index.vue 12 KB

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