|
@@ -3,7 +3,7 @@
|
|
|
<!-- <page-top-bar /> -->
|
|
|
<view class="top-bar">
|
|
|
<view class="row">
|
|
|
- <view class="column column1" @click="navTo(1,'/pages/home/home')">
|
|
|
+ <view class="column column1" @click="navTo(1,'/pages/theater/index/index')">
|
|
|
<image src="@/static/images/backhome.png" style="width: 24px; height: 24px;"></image>
|
|
|
</view>
|
|
|
<view class="column column2"><input @input="KeyName" class="input-box" type="text" placeholder="搜索内容"
|
|
@@ -26,9 +26,19 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="section1">
|
|
|
- <view class="row">
|
|
|
- <view class="column" v-for="(tag,index) in eventstag">
|
|
|
+ <view class="serow">
|
|
|
+ <view class="column">
|
|
|
+
|
|
|
+ <view class="cell" :class="active == 6?'active':''" @click="selActive('',6)">
|
|
|
+ <view class="cl">
|
|
|
+ <image :src="'/static/images/chart_alt6.png'" style="width: 24px; height: 24px;">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ <view class="cl">全部</view>
|
|
|
+ </view>
|
|
|
|
|
|
+ </view>
|
|
|
+ <view class="column" v-for="(tag,index) in eventstag">
|
|
|
<view class="cell" :class="active == index?'active':''" @click="selActive(tag,index)">
|
|
|
<view class="cl">
|
|
|
<image :src="'/static/images/chart_alt'+index+'.png'" style="width: 24px; height: 24px;">
|
|
@@ -36,24 +46,37 @@
|
|
|
</view>
|
|
|
<view class="cl">{{tag.name}}</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
<view class="full-row">
|
|
|
- <view class="column">
|
|
|
- 上海市 </view>
|
|
|
- <view class="column2">
|
|
|
- <image src="/static/images/arr.png" style="width: 10px; height: 10px;"></image>
|
|
|
+ <view class="rows" @click="showCity">
|
|
|
+ <view class="column">
|
|
|
+ {{activeCity}}
|
|
|
+ </view>
|
|
|
+ <view class="column2">
|
|
|
+ <image src="/static/images/arr.png" style="width: 10px; height: 10px;"></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="rows" @click="showType">
|
|
|
+ <view class="column">类型</view>
|
|
|
+ <view class="column2">
|
|
|
+ <image src="/static/images/arr.png" style="width: 10px; height: 10px;"></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="column">类型</view>
|
|
|
- <view class="column2">
|
|
|
- <image src="/static/images/arr.png" style="width: 10px; height: 10px;"></image>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ <view class="selected" v-if="cityShow">
|
|
|
+ <view class="textInfo" v-for="(item,index) in cityLists" :key='index' @click="selCity(item)">
|
|
|
+ {{item.name}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="selected" style="left: 16%;" v-if="typeShow">
|
|
|
+ <view class="textInfo" :class="active == index?'active':''" v-for="(item,index) in eventList"
|
|
|
+ :key='index' @click="selActive(item,index)">
|
|
|
+ {{item.name}}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="selected" v-if="">
|
|
|
- 城市
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
<view class="section3" style="padding-bottom: 75px;">
|
|
|
|
|
@@ -100,6 +123,7 @@
|
|
|
} from 'vuex'
|
|
|
|
|
|
const app = getApp();
|
|
|
+ const data = require('@/static/city.json')
|
|
|
export default {
|
|
|
|
|
|
|
|
@@ -114,9 +138,21 @@
|
|
|
events: [], // 用于存储事件数据
|
|
|
eventshot: [],
|
|
|
eventstag: [],
|
|
|
- active: 0,
|
|
|
- tagId: 5,
|
|
|
- keyword: ''
|
|
|
+ active: 6,
|
|
|
+ tagId: '',
|
|
|
+ keyword: '',
|
|
|
+ cityShow: false,
|
|
|
+ cityLists: [],
|
|
|
+ cities: data,
|
|
|
+ activeCity: '全国',
|
|
|
+ city: '',
|
|
|
+ typeShow: false,
|
|
|
+ eventList: [],
|
|
|
+ total: null, //总共多少条数据
|
|
|
+ formData: {
|
|
|
+ pageSize: 10, //每页10条数据
|
|
|
+ page: 1, //第几页
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -126,9 +162,59 @@
|
|
|
this.fetchEventsTag();
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ onReachBottom() {
|
|
|
+ let allTotal = this.formData.page * this.formData.pageSize
|
|
|
+ if (allTotal < this.total) {
|
|
|
+ //当前条数小于总条数 则增加请求页数
|
|
|
+ this.formData.page++;
|
|
|
+ this.fetchEventsData() //调用加载数据方法
|
|
|
+ } else {
|
|
|
+ // console.log('已加载全部数据')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.events = []
|
|
|
+ //调用获取数据方法
|
|
|
+ this.getData()
|
|
|
+ setTimeout(() => {
|
|
|
+ //结束下拉刷新
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
|
|
|
methods: {
|
|
|
+ showType() {
|
|
|
+ let _this = this
|
|
|
+ _this.$http.request('events/searchTags', {
|
|
|
+ page: 1,
|
|
|
+ pageSize: 50,
|
|
|
+ }).then(response => {
|
|
|
+ console.log(response); // 先打印整个响应对象查看结构
|
|
|
+ this.eventList = response.data;
|
|
|
+ this.typeShow = !this.typeShow
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('数据获取失败:', error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ selCity(item) {
|
|
|
+ this.activeCity = item.name
|
|
|
+ console.log(item);
|
|
|
+ this.city = item.city
|
|
|
+ this.cityShow = false
|
|
|
+ this.fetchEventsData()
|
|
|
+ },
|
|
|
+ showCity() {
|
|
|
+ this.cityShow = !this.cityShow
|
|
|
+ },
|
|
|
+ navTo(index, url) {
|
|
|
+
|
|
|
+ if (index != this.active) {
|
|
|
+
|
|
|
+ uni.switchTab({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
//搜索内容
|
|
|
seachText() {
|
|
|
this.$http.request('events/searchEvents', {
|
|
@@ -146,23 +232,41 @@
|
|
|
},
|
|
|
//切换筛选条件
|
|
|
selActive(item, index) {
|
|
|
+ if(item==''){
|
|
|
+ this.city=''
|
|
|
+ }
|
|
|
this.tagId = item.id
|
|
|
this.active = index
|
|
|
this.fetchEventsData()
|
|
|
+ this.typeShow = false
|
|
|
},
|
|
|
|
|
|
fetchEventsData() {
|
|
|
let _this = this;
|
|
|
- _this.$http.request('events/searchEvents', {
|
|
|
- page: 1,
|
|
|
- pageSize: 10,
|
|
|
- tagId: _this.tagId,
|
|
|
- }).then(response => {
|
|
|
- console.log(response); // 先打印整个响应对象查看结构
|
|
|
- this.events = response.data;
|
|
|
- console.log(response.data)
|
|
|
+ _this.formData.tagId = _this.tagId;
|
|
|
+ _this.formData.city = _this.city;
|
|
|
+ _this.$http.request('events/searchEvents', _this.formData).then(response => {
|
|
|
+ if (_this.cityLists.length === 0) {
|
|
|
+ response.data.forEach(item => {
|
|
|
+ _this.cities.forEach(el => {
|
|
|
+ if (item.province === el.code) {
|
|
|
+ let obj = {
|
|
|
+ name: el.name,
|
|
|
+ city: item.city
|
|
|
+ };
|
|
|
+ // 检查是否已经存在相同的城市对象
|
|
|
+ if (!_this.cityLists.some(city => city.city === obj.city)) {
|
|
|
+ _this.cityLists.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(_this.cityLists); // 先打印整个响应对象查看结构
|
|
|
+ _this.total = response.data.length;
|
|
|
+ _this.events = response.data;
|
|
|
}).catch(error => {
|
|
|
- console.error('数据获取失败:', error);
|
|
|
+ console.error('数据获取失败:', error);
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -186,7 +290,7 @@
|
|
|
let _this = this;
|
|
|
_this.$http.request('events/searchTags', {
|
|
|
page: 1,
|
|
|
- pageSize: 5,
|
|
|
+ pageSize: 4,
|
|
|
|
|
|
|
|
|
}).then(response => {
|