index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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. ></u-swiper>
  16. </view>
  17. <!-- 占位 banner -->
  18. <view class="holdbanner" style="height: 600rpx;pointer-events:none"></view>
  19. <!-- 页面滚动banner模糊 -->
  20. <view class="blurbanner" style="height: 600rpx;" :class="{ isblur: isblur }"></view>
  21. <view class="index-bg" :style="{backgroundImage:`url(${staticUrl}/img/index-bg.png?a=1)`}"></view>
  22. <view class="page-wrap">
  23. <view class="star-title u-flex u-row-between">
  24. <view class="left u-flex">
  25. <image class="icon" :src="staticUrl+'/img/title-star.png'" ></image>
  26. <text class="text">演出剧目</text>
  27. </view>
  28. </view>
  29. <swiper class="swiper" :autoplay="true" style="height: 400rpx;margin-bottom: 34rpx" >
  30. <swiper-item :item-id="item.id" v-for="(item,index) in theatreList" :key="index">
  31. <view class="programme-wrap">
  32. <view class="programme">
  33. <image class="img" :src="item.showImg" ></image>
  34. <!-- <image class="img" :src="item.showImg" ></image> -->
  35. <view class="text u-flex u-row-between">
  36. <view class="left">
  37. <view class="name">{{item.name}}</view>
  38. <!-- <view class="addr">演出地点:{{item.address}}</view> -->
  39. </view>
  40. <view class="btn" @click="bookticket(item)">立即预定</view>
  41. </view>
  42. <!-- <view class="share" @click="getPoster(item)">
  43. <image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
  44. </view> -->
  45. </view>
  46. </view>
  47. </swiper-item>
  48. </swiper>
  49. </view>
  50. <view class="news-wrap">
  51. <view class="star-title u-flex u-row-between">
  52. <view class="left u-flex">
  53. <image class="icon" :src="staticUrl+'/img/title-star.png'" ></image>
  54. <text class="text">演出资讯</text>
  55. </view>
  56. <view class="right u-flex">
  57. <text class="text" @click="$u.route('pages/news')">更多</text>
  58. <u-icon name="arrow-right" color="#C79191" size="36rpx"></u-icon>
  59. </view>
  60. </view>
  61. <view class="news">
  62. <u-scroll-list :indicator="false">
  63. <view class="item" v-for="(item, index) in newsList" @click="newsClick(item)" :key="index">
  64. <image class="img" :src="item.showImg||staticUrl+'/img/newsdetails-banner.png'"></image>
  65. <view class="text">
  66. <view class="name u-line-1">{{item.title}}</view>
  67. <view class="con u-line-1">{{item.centent}}</view>
  68. <view class="time u-flex u-row-between">
  69. <view class="left">{{$u.timeFormat(item.onlineTime, 'yyyy-mm-dd')}}</view>
  70. <image class="icon" :src="staticUrl+'/img/arrow-right-ico.png'" ></image>
  71. </view>
  72. </view>
  73. </view>
  74. </u-scroll-list>
  75. </view>
  76. </view>
  77. <!-- content-wrap end -->
  78. <!-- <image class="activity" :src="staticUrl+'/img/activity.png'" ></image> -->
  79. <!-- 分享选择弹出内容 -->
  80. <view class="share-option" :class="{shareShow:shareShow}">
  81. <view class="overlay" v-if="shareShow" @click="shareShow=false"></view>
  82. <button class="share-option-item wx-share" data-name="shareBtn" open-type="share">
  83. 发送给朋友
  84. </button>
  85. <view class="share-option-item" @click="getPoster">生成海报</view>
  86. <view class="share-option-item" @click="shareShow=false">取消</view>
  87. </view>
  88. <u-popup :show="posterShow" @close="posterShow=false" ref="uni-popup">
  89. <view class="poster-wrap u-flex u-col-center">
  90. <view class="poster-inner">
  91. <view class="close-wrap" @click="posterShow=false">
  92. <u-icon name="close-circle" color="#fff" size="56rpx"></u-icon>
  93. </view>
  94. <view class="poster" id="poster" ref="poster" >
  95. <u--image :showLoading="true" :src="posterSrc" width="100%" height="65vh" mode="aspectFit"></u--image>
  96. </view>
  97. <!-- savePoster -->
  98. <view class="poster-btn" @click="saveImage">保存图片</view>
  99. </view>
  100. </view>
  101. </u-popup>
  102. <u-toast ref="uToast"></u-toast>
  103. <tabbar :tabbarIndexProps='0' />
  104. </view>
  105. </template>
  106. <script>
  107. import { systemInfo } from "@/mixin.js";
  108. import tabbar from "../../components/tabbar.vue";
  109. export default {
  110. components:{
  111. tabbar,
  112. // cartfixed
  113. },
  114. mixins:[systemInfo],
  115. data() {
  116. return {
  117. staticUrl:this.$commonConfig.staticUrl,
  118. bannerList: [],
  119. theatreList:[],//剧院信息列表
  120. bannerCurrent: 0,
  121. isblur:false,
  122. newsList:[],//资讯
  123. shareShow:false,
  124. posterShow:false,
  125. posterStyle:{},
  126. posterSrc:''
  127. }
  128. },
  129. computed: {
  130. },
  131. onShow() {
  132. },
  133. beforeRouteLeave() {
  134. },
  135. onLoad(query) {
  136. this.getSystemInfo();
  137. // console.log('statusBarHeight',this.statusBarHeight);
  138. // console.log('navigationBarHeight',this.navigationBarHeight);
  139. // console.log('windowHeight',this.windowHeight);
  140. // console.log('navHeight',this.navHeight);
  141. // console.log('vuex_member_info=======',this.vuex_member_info);
  142. this.getClientIndex();
  143. },
  144. onReady() {
  145. },
  146. onUnload() {
  147. },
  148. methods: {
  149. getMemberInfo(){
  150. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  151. this.memberInfo = res.data;
  152. this.avatar = res.data.avatar;
  153. this.$u.vuex('vuex_member_info', res.data);
  154. // console.log('memberInfo',this.memberInfo);
  155. }).catch(err=>{
  156. // console.log('memberInfo',err.data);
  157. })
  158. },
  159. getHotGoods(){
  160. this.$u.api.topGoodList({pageNum:1,pageSize:20}).then(res=>{
  161. this.hotGoods = res.data.rows;
  162. console.log('res',res);
  163. }).catch(err=>{
  164. console.log('getHotGoods',err.data);
  165. })
  166. },
  167. getClientIndex(){
  168. this.$u.api.clientIndex().then(res=>{
  169. // console.log('res',res);
  170. this.bannerList = res.data.advList;
  171. this.theatreList = res.data.performList;
  172. this.newsList = res.data.informationList;
  173. }).catch(err=>{
  174. console.log('getClientIndex',err.data);
  175. })
  176. },
  177. goLogin(){
  178. uni.$u.route('/pages/login/login')
  179. },
  180. onPageScroll(e){
  181. if(e.scrollTop>100){
  182. this.isblur = true
  183. }else{
  184. this.isblur = false
  185. }
  186. },
  187. bookticket(item){
  188. // console.log('bookticket',item);
  189. uni.$u.route('pages/ticketlist',{id:item.id})
  190. },
  191. openShare(){
  192. this.shareShow = true;
  193. },
  194. // 海报相关开始
  195. getPoster(item){
  196. this.posterShow = true;
  197. this.shareShow = false;
  198. this.$u.api.performQrcode({performId:item.id}).then(res=>{
  199. this.posterSrc = res.data.imageUrl;
  200. // console.log('getPoster',res.data);
  201. }).catch(err=>{
  202. console.log('getPoster',err);
  203. })
  204. },
  205. saveImage() {
  206. let that = this;
  207. uni.showLoading({
  208. title: '保存中'
  209. });
  210. uni.downloadFile({
  211. url: this.posterSrc,
  212. success(res) {
  213. if (res.statusCode === 200) {
  214. uni.saveImageToPhotosAlbum({
  215. filePath: res.tempFilePath,
  216. success() {
  217. uni.showToast({
  218. title: '保存到相册成功',
  219. icon: 'success'
  220. });
  221. },
  222. fail(err) {
  223. console.log('保存图片失败',err);
  224. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  225. uni.getSetting({
  226. success(res) {
  227. if (!res.authSetting['scope.writePhotosAlbum']) {
  228. uni.showModal({
  229. title: '提示',
  230. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  231. confirmText: '去设置',
  232. success(res) {
  233. if (res.confirm) {
  234. uni.openSetting();
  235. }
  236. }
  237. });
  238. } else {
  239. uni.showToast({
  240. title: '保存图片失败',
  241. icon: 'none'
  242. });
  243. }
  244. }
  245. });
  246. } else {
  247. uni.showToast({
  248. title: '保存图片失败',
  249. icon: 'none'
  250. });
  251. }
  252. },
  253. complete() {
  254. uni.hideLoading();
  255. that.posterShow = false;
  256. }
  257. });
  258. } else {
  259. uni.showToast({
  260. title: '下载图片失败',
  261. icon: 'none'
  262. });
  263. }
  264. },
  265. fail() {
  266. uni.showToast({
  267. title: '下载图片失败',
  268. icon: 'none'
  269. });
  270. }
  271. });
  272. },
  273. // 海报相关结束
  274. newsClick(item){
  275. uni.$u.route('/pages/newsdetails', {
  276. id: item.id,
  277. type:'news'
  278. });
  279. }
  280. }
  281. }
  282. </script>
  283. <style>
  284. page{
  285. }
  286. </style>
  287. <style lang="scss" scoped>
  288. $pagegap:32rpx;
  289. .banner{
  290. position: fixed;
  291. left: 0;
  292. top: 0;
  293. width: 100%;
  294. }
  295. .blurbanner{
  296. pointer-events: none;
  297. position: fixed;
  298. left: 0;
  299. top: 0;
  300. width: 100%;
  301. transition: all 0.3s;
  302. &.isblur{
  303. backdrop-filter: blur(8px);
  304. }
  305. }
  306. .index-bg{
  307. position: fixed;
  308. display: block;
  309. left: 0;
  310. bottom: 0;
  311. width: 100%;
  312. min-height: calc( 100vh - 600rpx + 50rpx );
  313. background-repeat: no-repeat;
  314. background-position: top center;
  315. background-size: 100% auto;
  316. // z-index: -1;
  317. }
  318. .page-wrap{
  319. position: relative;
  320. }
  321. .star-title{
  322. margin-bottom: 32rpx;
  323. .left{
  324. .icon{
  325. width: 28rpx;
  326. height: 28rpx;
  327. margin-right: 8rpx;
  328. }
  329. .text{
  330. font-size: 32rpx;
  331. font-weight: bold;
  332. color: #FFFFFF;
  333. line-height: 48rpx;
  334. background: linear-gradient(128deg, #FFEFBC 0%, #FFD767 100%);
  335. -webkit-background-clip: text;
  336. -webkit-text-fill-color: transparent;
  337. }
  338. }
  339. .right{
  340. .text{
  341. font-size: 24rpx;
  342. font-weight: 400;
  343. color: #C79191;
  344. }
  345. }
  346. }
  347. .programme-wrap{
  348. // margin-bottom: 64rpx;
  349. .programme{
  350. // background-color: #FFFFFF;
  351. position: relative;
  352. border-radius: 30rpx;
  353. overflow: hidden;
  354. 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;
  355. background-size: 50% 100%;
  356. background-repeat: no-repeat;
  357. .img{
  358. width: 100%;
  359. height: 242rpx;
  360. display: block;
  361. }
  362. .text{
  363. position: relative;
  364. &:before{
  365. content: '';
  366. width: calc( 100% - 32rpx );
  367. height: 1px;
  368. position: absolute;
  369. left: 20rpx;
  370. top: -2rpx;
  371. border-top: 4rpx dashed #931E0C;
  372. }
  373. padding: 32rpx 30rpx;
  374. .name{
  375. font-size: 28rpx;
  376. font-weight: bold;
  377. color: #363636;
  378. line-height: 42rpx;
  379. // margin-bottom: 18rpx;
  380. }
  381. .addr{
  382. font-size: 22rpx;
  383. font-weight: 400;
  384. color: #7F7F7F;
  385. line-height: 34rpx;
  386. }
  387. .btn{
  388. height: 51rpx;
  389. line-height: 51rpx;
  390. padding: 0 24rpx;
  391. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  392. border-radius: 25rpx;
  393. font-size: 20rpx;
  394. font-weight: 400;
  395. color: #FFFFFF;
  396. }
  397. }
  398. .share{
  399. position: absolute;
  400. right: 16rpx;
  401. top: 16rpx;
  402. padding: 10rpx;
  403. border-radius: 50%;
  404. background-color: rgba(0,0,0,0.4);
  405. .icon{
  406. display: block;
  407. width: 32rpx;
  408. height: 32rpx;
  409. }
  410. }
  411. }
  412. }
  413. .news-wrap{
  414. position: relative;
  415. margin-left: $pagegap;
  416. margin-bottom: 180rpx;
  417. .star-title{
  418. margin-right: $pagegap;
  419. }
  420. .item{
  421. width: 434rpx;
  422. flex-shrink: 0;
  423. margin-right: 20rpx;
  424. background: #FFFFFF;
  425. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(59,0,0,0.5);
  426. border-radius: 12rpx;
  427. overflow: hidden;
  428. .img{
  429. display: block;
  430. width: 100%;
  431. height: 174rpx;
  432. }
  433. .text{
  434. padding: 30rpx 20rpx 22rpx;
  435. .name{
  436. font-size: 28rpx;
  437. font-weight: bold;
  438. color: #333333;
  439. margin-bottom: 12rpx;
  440. }
  441. .con{
  442. font-size: 24rpx;
  443. font-weight: 400;
  444. color: #6B6B6B;
  445. line-height: 22rpx;
  446. margin-bottom: 20rpx;
  447. }
  448. .time{
  449. font-size: 20rpx;
  450. font-weight: 400;
  451. color: #C0C0C0;
  452. line-height: 22rpx;
  453. }
  454. .icon{
  455. display: block;
  456. width: 80rpx;
  457. height: 20rpx;
  458. }
  459. }
  460. }
  461. }
  462. .activity{
  463. display: block;
  464. width: 112rpx;
  465. height: 132rpx;
  466. position: fixed;
  467. right: 16rpx;
  468. bottom: 174rpx;
  469. }
  470. </style>