index.vue 12 KB

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