index.vue 13 KB

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