index.vue 12 KB

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