index.vue 12 KB

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