|
|
@@ -5,33 +5,33 @@
|
|
|
<template>
|
|
|
<view class="Details {{forbiddenScroll ? 'forbiddenScroll' : ''}}">
|
|
|
<!-- 影片信息 -->
|
|
|
- <block wx:if="{{!!Data.subject_info}}">
|
|
|
+ <block wx:if="{{showInfo}}">
|
|
|
<black class="movieInfoBlock">
|
|
|
<view class="movieInfo">
|
|
|
- <image class="movieInfo__poster" src="{{Data.subject_info.pic}}" mode="widthFix" lazy-load="false" />
|
|
|
+ <image class="movieInfo__poster" src="{{showInfo.poster+'_160x240'}}" mode="widthFix" lazy-load="false" />
|
|
|
<view class="movieInfo__detail">
|
|
|
- <view class="movieInfo__name">{{Data.subject_info.title}}</view>
|
|
|
- <view wx:if="{{!!Data.subject_info.title_en}}" class="movieInfo__title_en">{{Data.subject_info.title_en}}</view>
|
|
|
+ <view class="movieInfo__name">{{showInfo.showName}}</view>
|
|
|
+ <view wx:if="{{showInfo.showNameEn}}" class="movieInfo__title_en">{{showInfo.showNameEn}}</view>
|
|
|
<view class="movieInfo__p">
|
|
|
- <text wx:if="{{!!Data.subject_info.duration}}">{{Data.subject_info.duration}}分钟 | </text>
|
|
|
- <text wx:if="{{!!Data.subject_info.kind}}">{{Data.subject_info.kind}} | </text>
|
|
|
- <text wx:if="{{!!Data.subject_info.country}}">{{Data.subject_info.country}}</text>
|
|
|
+ <text wx:if="{{showInfo.duration}}">{{showInfo.duration}}分钟 | </text>
|
|
|
+ <text wx:if="{{showInfo.type}}">{{showInfo.type}} | </text>
|
|
|
+ <text wx:if="{{showInfo.country}}">{{showInfo.country}}</text>
|
|
|
</view>
|
|
|
- <view wx:if="{{!!Data.subject_info.director}}" class="movieInfo__p">导演:{{Data.subject_info.director}}</view>
|
|
|
- <view wx:if="{{!!Data.subject_info.actors.length}}" class="movieInfo__p">主演:<text wx:for="{{Data.subject_info.actors}}" wx:key="index">{{item}}</text></view>
|
|
|
+ <view wx:if="{{showInfo.director}}" class="movieInfo__p">导演:{{showInfo.director}}</view>
|
|
|
+ <view wx:if="{{showInfo.leadingRole}}" class="movieInfo__p">主演:{{showInfo.leadingRole}}</view>
|
|
|
</view>
|
|
|
- <view class="bg" style="background-image:linear-gradient(15deg, #fff 70%, rgba(225,225,225,0) 120%),url({{Data.subject_info.pic}})" />
|
|
|
+ <view class="bg" style="background-image:linear-gradient(15deg, #fff 70%, rgba(225,225,225,0) 120%),url({{showInfo.background}})" />
|
|
|
</view>
|
|
|
|
|
|
<!-- 影片简介 -->
|
|
|
- <view wx:if="{{!!Data.subject_info.synopsis}}" class="movie__synopsis">
|
|
|
+ <view wx:if="{{showInfo.description}}" class="movie__synopsis">
|
|
|
<view class="h2_title">剧情简介</view>
|
|
|
<view
|
|
|
@tap="onOff"
|
|
|
data-id="{{'sl'+index}}"
|
|
|
- data-suffix="{{!!Data.subject_info.synopsisLong ? '•••' : ''}}"
|
|
|
- class="{{!!Data.subject_info.synopsisOnOff ? 'movie__introduce unfold' : 'movie__introduce'}}">
|
|
|
- {{Data.subject_info.synopsis}}
|
|
|
+ data-suffix="{{!!showInfo.descLong ? '•••' : ''}}"
|
|
|
+ class="{{!!showInfo.descOnOff ? 'movie__introduce unfold' : 'movie__introduce'}}">
|
|
|
+ {{showInfo.description}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</black>
|
|
|
@@ -72,24 +72,24 @@
|
|
|
type="default" plain size="mini"
|
|
|
class="select_city">定位失败,请手动选择城市</button>
|
|
|
</view>
|
|
|
- <view wx:if="{{!!Data && (Data.cinemas.length == 0)}}" class="blackMargin">
|
|
|
+ <view wx:if="{{cinemas.length == 0}}" class="blackMargin">
|
|
|
<icon type="ico-Empty2" class="" />
|
|
|
<view>没有符合条件的影院</view>
|
|
|
</view>
|
|
|
|
|
|
- <ul wx:if="{{Data.cinemas.length > 0}}" class="cinemas__list">
|
|
|
- <li wx:for="{{Data.cinemas}}" wx:key="index"
|
|
|
+ <ul wx:if="{{cinemas.length > 0}}" class="cinemas__list">
|
|
|
+ <li wx:for="{{cinemas}}" wx:key="index"
|
|
|
class="cinemas__list__item"
|
|
|
- data-cinema_id="{{item.cinema_id}}"
|
|
|
+ data-cinema-id="{{item.id}}"
|
|
|
@tap="goToitem">
|
|
|
<div class="item__info">
|
|
|
- <h2 class="cinemas__title">{{item.cinema_name}}</h2>
|
|
|
+ <h2 class="cinemas__title">{{item.cinemaName}}</h2>
|
|
|
<p class="cinemas__address">{{item.addr}}</p>
|
|
|
</div>
|
|
|
<div class="item__text">{{item.distance}}</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <view wx:if="{{!!Data.total && !!isMax}}" class="weui-loadmore weui-loadmore_line">
|
|
|
+ <view wx:if="{{last}}" class="weui-loadmore weui-loadmore_line">
|
|
|
<view class="weui-loadmore__tips weui-loadmore__tips_in-line">已经到底了</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -100,6 +100,7 @@
|
|
|
<script>
|
|
|
import wepy from 'wepy';
|
|
|
import { fetchCinemas } from '../../utils/api.js';
|
|
|
+import http from '../../utils/http.js';
|
|
|
|
|
|
export default class Cinemas extends wepy.page {
|
|
|
config = {
|
|
|
@@ -109,8 +110,10 @@ export default class Cinemas extends wepy.page {
|
|
|
data = {
|
|
|
top: 100,
|
|
|
couponId: null,
|
|
|
- usable_num: 0,
|
|
|
+ usableNum: 0,
|
|
|
Data: null,
|
|
|
+ showInfo: null,
|
|
|
+ cinemas: [],
|
|
|
|
|
|
activeIndex: 0,
|
|
|
sliderOffset: 0,
|
|
|
@@ -123,7 +126,7 @@ export default class Cinemas extends wepy.page {
|
|
|
scrollLeft: 0,
|
|
|
hasLoaded: null,
|
|
|
|
|
|
- subject_id: null,
|
|
|
+ showId: null,
|
|
|
subjectOnly: null,
|
|
|
locateFail: null,
|
|
|
loc: null,
|
|
|
@@ -134,11 +137,10 @@ export default class Cinemas extends wepy.page {
|
|
|
areaIndex: 0,
|
|
|
cinemas__nav__item: 'cinemas__nav__item',
|
|
|
|
|
|
- start: 0,
|
|
|
- limit: 20,
|
|
|
- total: 0,
|
|
|
- isMax: false,
|
|
|
- lowerLoader: false,
|
|
|
+ page: 0,
|
|
|
+ size: 20,
|
|
|
+ last: false,
|
|
|
+ loadingMore: false,
|
|
|
bind_cinema: false,
|
|
|
scrollTop: 0
|
|
|
};
|
|
|
@@ -162,23 +164,23 @@ export default class Cinemas extends wepy.page {
|
|
|
|
|
|
// }
|
|
|
|
|
|
- let subject_id = this.subject_id;
|
|
|
+ let showId = this.showId;
|
|
|
// bind_cinemas==true 绑定影院
|
|
|
let bind_cinema = !!this.Data ? this.Data.bind_cinema : false;
|
|
|
let couponId = this.couponId;
|
|
|
|
|
|
- let url = `/pages/locoation/locoation?subject_id=${subject_id}&bind_cinema=${bind_cinema}&couponId=${couponId}&loc=choose`;
|
|
|
+ let url = `/pages/locoation/locoation?showId=${showId}&bind_cinema=${bind_cinema}&couponId=${couponId}&loc=choose`;
|
|
|
wx.navigateTo({
|
|
|
url
|
|
|
});
|
|
|
},
|
|
|
goToitem(e) {
|
|
|
let couponId = this.couponId;
|
|
|
- let subject_id = this.subject_id;
|
|
|
+ let showId = this.showId;
|
|
|
let cinema_id = e.target.dataset.cinema_id;
|
|
|
- let usable_num = this.usable_num;
|
|
|
+ let usableNum = this.usableNum;
|
|
|
let subjectOnly = this.subjectOnly == 0 ? `&subjectOnly=${this.subjectOnly}` : '';
|
|
|
- let url = `/pages/session/session?couponId=${couponId}&subject_id=${subject_id}&cinema_id=${cinema_id}&usable_num=${usable_num}${subjectOnly}`;
|
|
|
+ let url = `/pages/session/session?couponId=${couponId}&showId=${showId}&cinema_id=${cinema_id}&usableNum=${usableNum}${subjectOnly}`;
|
|
|
wx.navigateTo({
|
|
|
url
|
|
|
});
|
|
|
@@ -187,7 +189,7 @@ export default class Cinemas extends wepy.page {
|
|
|
onOff(e) {
|
|
|
if (e.target.dataset.suffix == '•••') {
|
|
|
// let i = parseInt(e.target.dataset.id.replace(/[^0-9]/ig,''))
|
|
|
- this.Data.subject_info.synopsisOnOff = !this.Data.subject_info.synopsisOnOff;
|
|
|
+ this.showInfo.descOnOff = !this.showInfo.descOnOff;
|
|
|
}
|
|
|
},
|
|
|
bindMore() {
|
|
|
@@ -228,34 +230,14 @@ export default class Cinemas extends wepy.page {
|
|
|
|
|
|
let id = e.currentTarget.id;
|
|
|
this.region = id == 0 ? '' : this.regions[id];
|
|
|
- this.start = 0;
|
|
|
console.log('region::', this.region);
|
|
|
|
|
|
- let queryData = {
|
|
|
- couponId: this.couponId,
|
|
|
- subject_id: this.subject_id,
|
|
|
- region: id == 0 ? '' : this.regions[id],
|
|
|
- start: 0,
|
|
|
- limit: 20,
|
|
|
- city_id: this.loc.id,
|
|
|
- ...this.loc
|
|
|
- };
|
|
|
- let fetchData = await fetchCinemas(queryData);
|
|
|
- this.total = fetchData.data.total;
|
|
|
-
|
|
|
- console.log(queryData.limit, queryData.start, this.total, queryData.limit + queryData.start <= this.total);
|
|
|
- if (queryData.limit + queryData.start <= this.total) {
|
|
|
- this.isMax = false;
|
|
|
- } else {
|
|
|
- this.isMax = true;
|
|
|
- }
|
|
|
- this.Data.cinemas = fetchData.data.cinemas;
|
|
|
- // this.fetchData(0, 20)
|
|
|
- this.$apply();
|
|
|
+ this.page = 0;
|
|
|
+ this.fetchData();
|
|
|
}
|
|
|
};
|
|
|
// 获取影院列表数据
|
|
|
- async fetchData(start, limit, show) {
|
|
|
+ async fetchData(show) {
|
|
|
let current_city = this.$parent.globalData.location.current_city,
|
|
|
choose_city = this.$parent.globalData.location.choose_city,
|
|
|
choose_city1 = !!current_city ? { lat: current_city.lat, lng: current_city.lng, ...choose_city } : choose_city;
|
|
|
@@ -270,59 +252,27 @@ export default class Cinemas extends wepy.page {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- let data = {
|
|
|
+ let params = {
|
|
|
couponId: this.couponId,
|
|
|
- subject_id: this.subject_id,
|
|
|
- subject_info: this.subject_info,
|
|
|
- region: this.region,
|
|
|
- start: start,
|
|
|
- limit: limit,
|
|
|
- city_id: this.loc.id,
|
|
|
- ...this.loc
|
|
|
+ page: this.page,
|
|
|
+ size: this.size
|
|
|
};
|
|
|
-
|
|
|
- let fetchData = await fetchCinemas(data);
|
|
|
-
|
|
|
- if (!!this.Data && !show) {
|
|
|
- this.Data.cinemas = [...this.Data.cinemas, ...fetchData.data.cinemas];
|
|
|
- } else {
|
|
|
- this.Data = fetchData.data;
|
|
|
+ if (this.loc.lat && this.loc.lng) {
|
|
|
+ params.lat = this.loc.lat;
|
|
|
+ params.lng = this.loc.lng;
|
|
|
}
|
|
|
-
|
|
|
- // 简介内容长度判断
|
|
|
- !!this.Data.subject_info.synopsis &&
|
|
|
- setTimeout(() => {
|
|
|
- wx.createSelectorQuery()
|
|
|
- .select('.movie__introduce')
|
|
|
- .boundingClientRect(rect => {
|
|
|
- this.Data.subject_info.synopsisLong = rect.height >= 70 ? 1 : 0;
|
|
|
- this.$apply();
|
|
|
- })
|
|
|
- .exec();
|
|
|
- }, 200);
|
|
|
- // 滚动吸顶高度
|
|
|
- !!this.Data.subject_info &&
|
|
|
- setTimeout(() => {
|
|
|
- wx.createSelectorQuery()
|
|
|
- .select('.movieInfoBlock')
|
|
|
- .boundingClientRect(rect => {
|
|
|
- this.mobileDistance = rect.height + 20;
|
|
|
- this.$apply();
|
|
|
- })
|
|
|
- .exec();
|
|
|
- }, 200);
|
|
|
-
|
|
|
- this.start = fetchData.data.start;
|
|
|
- this.limit = fetchData.data.limit;
|
|
|
- this.total = fetchData.data.total;
|
|
|
-
|
|
|
- if (this.limit + this.start < this.total) {
|
|
|
- this.isMax = false;
|
|
|
- } else {
|
|
|
- this.isMax = true;
|
|
|
+ if (this.region) {
|
|
|
+ params.regionName = this.region;
|
|
|
}
|
|
|
- console.log(fetchData.data.regions);
|
|
|
- this.regions = fetchData.data.regions ? ['不限区域', ...fetchData.data.regions] : ['不限区域'];
|
|
|
+ http.get(`/cinema/city/${this.loc.id}`, params).then(res => {
|
|
|
+ this.last = res.page.last;
|
|
|
+ this.regions = ['不限区域', ...res.regions];
|
|
|
+ if (res.page.number === 0) {
|
|
|
+ this.cinemas = [];
|
|
|
+ }
|
|
|
+ this.cinemas = this.cinemas.concat(res.page.content);
|
|
|
+ this.$apply();
|
|
|
+ });
|
|
|
|
|
|
let timestamp = Date.parse(new Date());
|
|
|
// let expiration = timestamp + 6*1000
|
|
|
@@ -338,26 +288,56 @@ export default class Cinemas extends wepy.page {
|
|
|
let app_data = wx.getStorageSync('data_location');
|
|
|
|
|
|
this.couponId = options.couponId;
|
|
|
- this.subject_id = options.subject_id;
|
|
|
+ this.showId = options.showId;
|
|
|
this.subject_info = options.subject_info;
|
|
|
- this.usable_num = options.usable_num;
|
|
|
+ this.usableNum = options.usableNum;
|
|
|
this.subjectOnly = options.subjectOnly;
|
|
|
|
|
|
this.$apply();
|
|
|
}
|
|
|
async onShow() {
|
|
|
+ http.get(`/show/detail/${this.showId}`)
|
|
|
+ .then(res => {
|
|
|
+ this.showInfo = res; // 简介内容长度判断
|
|
|
+ this.$apply();
|
|
|
+ !!this.showInfo.description &&
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.createSelectorQuery()
|
|
|
+ .select('.movie__introduce')
|
|
|
+ .boundingClientRect(rect => {
|
|
|
+ this.showInfo.descLong = rect.height >= 70 ? 1 : 0;
|
|
|
+ this.$apply();
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ }, 200);
|
|
|
+ // 滚动吸顶高度
|
|
|
+ !!this.showInfo &&
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.createSelectorQuery()
|
|
|
+ .select('.movieInfoBlock')
|
|
|
+ .boundingClientRect(rect => {
|
|
|
+ this.mobileDistance = rect.height + 20;
|
|
|
+ this.$apply();
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ }, 200);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ wx.toast({
|
|
|
+ title: e.error || '发生错误',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
this.onMore = false;
|
|
|
this.scrollAnim = true;
|
|
|
if (this.$parent.globalData.loc == 'choose' && this.$parent.globalData.From == 'lockoation') {
|
|
|
this.region = '';
|
|
|
- this.start = 0;
|
|
|
this.areaIndex = 0;
|
|
|
this.$apply();
|
|
|
}
|
|
|
let choose_city = this.$parent.globalData.location.choose_city;
|
|
|
- let start = 0,
|
|
|
- limit = this.limit,
|
|
|
- total = this.total;
|
|
|
|
|
|
let locateFail = (this.locateFail = this.$parent.globalData.locateFail);
|
|
|
|
|
|
@@ -365,7 +345,7 @@ export default class Cinemas extends wepy.page {
|
|
|
if (this.$parent.globalData.From != 'session') {
|
|
|
// 首页入口时-定位失败时
|
|
|
if (locateFail != null) {
|
|
|
- this.fetchData(start, limit, 'show');
|
|
|
+ this.fetchData('show');
|
|
|
return;
|
|
|
}
|
|
|
// 首页入口时-定位成功时
|
|
|
@@ -373,7 +353,7 @@ export default class Cinemas extends wepy.page {
|
|
|
|
|
|
// 非首页入口时
|
|
|
this.$parent.observable.on('location', async () => {
|
|
|
- this.fetchData(start, limit, 'show');
|
|
|
+ this.fetchData('show');
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -388,27 +368,12 @@ export default class Cinemas extends wepy.page {
|
|
|
}
|
|
|
// 上拉加载
|
|
|
async onReachBottom(e) {
|
|
|
- await this.lower(e);
|
|
|
- }
|
|
|
- async lower(e) {
|
|
|
- if (!!this.lowerLoader || !!this.isMax || !this.Data.cinemas.length) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.limit + this.start <= this.total) {
|
|
|
- await this.fetchData(this.limit + this.start, this.limit);
|
|
|
- // this.isMax = false
|
|
|
- this.lowerLoader = true;
|
|
|
- } else {
|
|
|
- this.isMax = true;
|
|
|
- this.lowerLoader = false;
|
|
|
+ if (this.loadingMore || this.last) {
|
|
|
return;
|
|
|
}
|
|
|
- // console.log('到底::',this.limit + this.start <= this.total, 'isMax::',this.isMax)
|
|
|
- setTimeout(() => {
|
|
|
- this.lowerLoader = false;
|
|
|
- }, 100);
|
|
|
+ this.page++;
|
|
|
this.$apply();
|
|
|
+ this.fetchData();
|
|
|
}
|
|
|
}
|
|
|
</script>
|