index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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">
  67. <view class="name u-line-1">{{item.title}}</view>
  68. <view class="con u-line-1" v-html="item.centent"></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. let item = this.bannerList[e];
  283. // console.log('bannerClick',this.bannerList[e]);
  284. uni.$u.route('/pages/newsdetails', {
  285. id: item.id,
  286. type:'swiperDetail'
  287. });
  288. }
  289. }
  290. }
  291. </script>
  292. <style>
  293. page{
  294. }
  295. </style>
  296. <style lang="scss" scoped>
  297. $pagegap:32rpx;
  298. .banner{
  299. position: fixed;
  300. left: 0;
  301. top: 0;
  302. width: 100%;
  303. }
  304. .blurbanner{
  305. pointer-events: none;
  306. position: fixed;
  307. left: 0;
  308. top: 0;
  309. width: 100%;
  310. transition: all 0.3s;
  311. &.isblur{
  312. backdrop-filter: blur(8px);
  313. }
  314. }
  315. .index-bg{
  316. position: fixed;
  317. display: block;
  318. left: 0;
  319. bottom: 0;
  320. width: 100%;
  321. min-height: calc( 100vh - 600rpx + 50rpx );
  322. background-repeat: no-repeat;
  323. background-position: top center;
  324. background-size: 100% auto;
  325. // z-index: -1;
  326. }
  327. .page-wrap{
  328. position: relative;
  329. }
  330. .star-title{
  331. margin-bottom: 32rpx;
  332. .left{
  333. .icon{
  334. width: 28rpx;
  335. height: 28rpx;
  336. margin-right: 8rpx;
  337. }
  338. .text{
  339. font-size: 32rpx;
  340. font-weight: bold;
  341. color: #FFFFFF;
  342. line-height: 48rpx;
  343. background: linear-gradient(128deg, #FFEFBC 0%, #FFD767 100%);
  344. -webkit-background-clip: text;
  345. -webkit-text-fill-color: transparent;
  346. }
  347. }
  348. .right{
  349. .text{
  350. font-size: 24rpx;
  351. font-weight: 400;
  352. color: #C79191;
  353. }
  354. }
  355. }
  356. .programme-wrap{
  357. // margin-bottom: 64rpx;
  358. .programme{
  359. // background-color: #FFFFFF;
  360. position: relative;
  361. border-radius: 30rpx;
  362. overflow: hidden;
  363. // 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;
  364. background-color: #fff;
  365. background-size: 50% 100%;
  366. background-repeat: no-repeat;
  367. .img{
  368. width: 100%;
  369. height: 242rpx;
  370. display: block;
  371. }
  372. .text{
  373. position: relative;
  374. // &:before{
  375. // content: '';
  376. // // width: calc( 100% - 32rpx );
  377. // width: 100%;
  378. // height: 1px;
  379. // position: absolute;
  380. // left: 0;
  381. // top: -2rpx;
  382. // border-top: 4rpx dashed #931E0C;
  383. // }
  384. padding: 32rpx 30rpx;
  385. .name{
  386. font-size: 28rpx;
  387. font-weight: bold;
  388. color: #363636;
  389. line-height: 42rpx;
  390. // margin-bottom: 18rpx;
  391. }
  392. .addr{
  393. font-size: 22rpx;
  394. font-weight: 400;
  395. color: #7F7F7F;
  396. line-height: 34rpx;
  397. }
  398. .btn{
  399. height: 51rpx;
  400. line-height: 51rpx;
  401. padding: 0 24rpx;
  402. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  403. border-radius: 25rpx;
  404. font-size: 20rpx;
  405. font-weight: 400;
  406. color: #FFFFFF;
  407. }
  408. }
  409. .share{
  410. position: absolute;
  411. right: 16rpx;
  412. top: 16rpx;
  413. padding: 10rpx;
  414. border-radius: 50%;
  415. background-color: rgba(0,0,0,0.4);
  416. .icon{
  417. display: block;
  418. width: 32rpx;
  419. height: 32rpx;
  420. }
  421. }
  422. }
  423. }
  424. .news-wrap{
  425. position: relative;
  426. margin-left: $pagegap;
  427. margin-bottom: 180rpx;
  428. .star-title{
  429. margin-right: $pagegap;
  430. }
  431. .item{
  432. width: 434rpx;
  433. flex-shrink: 0;
  434. margin-right: 20rpx;
  435. background: #FFFFFF;
  436. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(59,0,0,0.5);
  437. border-radius: 12rpx;
  438. overflow: hidden;
  439. .img{
  440. display: block;
  441. width: 100%;
  442. height: 174rpx;
  443. }
  444. .text{
  445. padding: 30rpx 20rpx 22rpx;
  446. .name{
  447. font-size: 28rpx;
  448. font-weight: bold;
  449. color: #333333;
  450. margin-bottom: 12rpx;
  451. }
  452. .con{
  453. font-size: 24rpx;
  454. font-weight: 400;
  455. color: #6B6B6B;
  456. // line-height: 22rpx;
  457. margin-bottom: 20rpx;
  458. }
  459. .time{
  460. font-size: 20rpx;
  461. font-weight: 400;
  462. color: #C0C0C0;
  463. line-height: 22rpx;
  464. }
  465. .icon{
  466. display: block;
  467. width: 80rpx;
  468. height: 20rpx;
  469. }
  470. }
  471. }
  472. }
  473. .activity{
  474. display: block;
  475. width: 112rpx;
  476. height: 132rpx;
  477. position: fixed;
  478. right: 16rpx;
  479. bottom: 174rpx;
  480. }
  481. </style>