Files
signuptool-ui-xcx/pages/home/FindFragment.vue
2024-02-06 09:36:25 +08:00

327 lines
9.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view style="background: #F1F2F5;">
<RefreshView id="mescrollRef" ref="mescrollRef" :pageBg="F1F2F5" @refresh="refresh" text="活动列表"
:useDownScroll="true" :useUpScroll="true">
<sl-filter id="header" ref="slLilter" v-if="menuList.length!=0" :color="fd6d2a" themeColor="#000000"
:menuList.sync="menuList" @result="result"></sl-filter>
<view>
<view v-for="(item,index) in list " :key="index">
<view
style="display: flex;flex-direction: column;margin-bottom: 30rpx; padding: 30rpx;background: #FFFFFF;"
@click="clickItem(index)">
<view style="display: flex;flex-direction: column;">
<view style="display: flex; flex-direction: row;">
<text style="color: #101010; font-size: 32rpx; display:-webkit-box;-webkit-line-clamp:1;
overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical;
word-break:break-all;flex: 1;">{{item.name}}</text>
<text
style="color: #fff; font-size: 24rpx; background-color: #F2BF5C; padding: 5rpx 10rpx;">{{item.sportCategoryName}}</text>
</view>
<text
style="color: #898989 ; font-size: 28rpx; margin-top: 10rpx;">报名截止{{item.enrollEndTime}}</text>
</view>
<view style="width: 100%;height: 300rpx; margin-top: 20rpx;margin-bottom: 20rpx;">
<image style="width: 100%;height: 100%; border-radius: 30rpx;" mode="aspectFill"
:src="item.firstCoverImage"></image>
<view style="display: flex; height: 50rpx;width: 100%; margin-top: -80rpx; ">
<view style=" display: flex;align-items: center;width: 100%;">
<image style="width: 28px;height: 48rpx;margin-left: 30rpx;"
src="../../static/renqi.png"></image>
<text style="color: #fff; margin-left: 15rpx;flex: 1;">{{item.popularity}}</text>
<text
:class="{'btn1':item.enrollState ==1||item.enrollState ==3,'btn2':item.enrollState==2}"
style="display: flex;text-align: center; padding: 8rpx 15rpx;
color: #FFFFFF; font-size: 28rpx; margin-right:30rpx; border-radius: 10rpx;">{{item.enrollStateName}}</text>
</view>
</view>
</view>
<view v-for="(info,pos) in item.listActivityItemsArea " :key="pos">
<view style="display: flex;flex-direction: column;">
<view
style="display: flex;flex-direction: row; align-items: center; margin-top: 10rpx;">
<text style="color: #101010; font-size: 28rpx; flex: 1;">{{info.name}}</text>
<view style=" align-items: center;">
<text style="color: #ff0000 ; font-size: 24rpx;">{{info.enrollMoldName}}</text>
<text
style="color: #ff0000 ; font-size: 24rpx;margin-left: 10rpx;margin-right: 10rpx;">/</text>
<text
style="color: #ff0000 ; font-size: 24rpx;">{{info.enrollMoney==0?"免费":info.enrollMoney}}</text>
</view>
</view>
<view style="display: flex;flex-direction: row;margin-top: 5rpx;">
<view style="flex: 1; align-items: center;">
<text style="color: #919191; font-size: 24rpx;">报名数</text>
<text
style="color: #919191 ; font-size: 24rpx;">{{info.enrollNumbers==0?"暂无":info.enrollNumbersLimit+'人'}}</text>
<text
style="color: #919191 ; font-size: 24rpx;margin-left: 10rpx;margin-right: 10rpx;">/</text>
<text
style="color: #919191 ; font-size: 24rpx;">{{info.enrollNumbersLimit==0?"不限":info.enrollNumbersLimit+'人'}}</text>
</view>
<text
style="margin-top: 10rpx; color: #919191; font-size: 24rpx;">{{info.startTime}}</text>
</view>
<view v-if="item.listActivityItemsArea.length>pos+1"
style="width: 100%; height: 2rpx;background-color: #efefef; margin-top: 10rpx;">
</view>
</view>
</view>
</view>
</view>
</view>
</RefreshView>
</view>
</template>
<script>
// 必须
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
// 使用mixin (在main.js注册全局组件) 必须
mixins: [MescrollMixin],
data() {
return {
index: 0,
list: [],
page: {
'sort': 0,
'city': this.ReadPreference("find_city"),
'adCode': this.ReadPreference("find_city_code").slice(0, -2),
state: ""
},
menuList: [{
'title': '当前定位城市',
'key': 'type',
'reflexTitle': true,
'defaultSelectedIndex': 0,
detailList: [{
'title': this.ReadPreference("find_city"),
'value': this.ReadPreference("find_city_code").slice(0, -2)
},
{
'title': '选择其他城市',
'value': '0'
}
]
}, {
'title': '默认活动类型',
'key': 'state',
'reflexTitle': true,
'defaultSelectedIndex': 0,
detailList: [{
'title': '全部活动',
'value': ""
}]
}, {
'title': '默认排序',
'key': 'sort',
'reflexTitle': true,
'defaultSelectedIndex': 0,
'detailList': [{
'title': '按发布时间排序',
'value': 0
},
{
'title': '按报名时间排序',
'value': 1
},
{
'title': '按人气从高到低',
'value': 2
}
]
}
]
}
},
onLoad() {
let that = this
that.HTTP({
url: 'aos/v1/activityManagement/getActivityCreatePageParameter',
method: 'GET',
data: {
"adcode": that.page.adCode
},
paramsType: "FORM",
loading: true
}).then((res) => {
console.log("that.menuList[1].detailList", that.menuList[1].detailList);
if (200 == res.code) {
let list = [];
for (var i = 0; i < res.data.listSportCategoryArea.length; i++) {
list.push({
title: res.data.listSportCategoryArea[i].sportCategoryName,
value: res.data.listSportCategoryArea[i].sid
})
}
// 必须用变量去接受
that.menuList[1].detailList = that.menuList[1].detailList.concat(list)
this.$refs.slLilter.setTitle(this.menuList)
console.log("qqq", that.menuList[1].detailList);
}
});
},
onShow() {
let backResult = this.OnActivityResult();
if (backResult != undefined) {
console.log("结果>" + JSON.stringify(backResult))
if (!this.IsEmpty(backResult.code)) {
console.log("结果2>" + backResult.code)
this.page.adCode = backResult.code
this.page.city = backResult.city
this.menuList[0].detailList[0].title = backResult.city
this.menuList[0].detailList[0].value = backResult.code
console.log("qqq", this.menuList[0].detailList);
this.$refs.slLilter.setTitle(this.menuList)
this.$refs.mescrollRef.resetPageOne();
}
}
},
methods: {
result(val) {
if (!this.IsEmpty(val.sort)) {
this.page.sort = val.sort;
this.list = []
console.log("this.page.sort", this.page.sort);
}
if (!this.IsEmpty(val.type)) {
if (val.type != 0) {
this.page.game = val.type;
this.list = []
} else {
console.log("===>1" + JSON.stringify(this.page))
uni.navigateTo({
url: "../../pages/city/CitySelectActivity?city=" + this.page.city +
"&code=" + this.page.adCode
})
}
}
if (!this.IsEmpty(val.state)) {
this.page.state = val.state;
this.list = []
console.log("this.page.state", this.page.state);
}
this.$refs.mescrollRef.resetPageOne();
},
refresh(page) {
let _this = this
this.HTTP({
url: 'aos/v1/activityManagement/getActivityAreaPagerList',
paramsType: "JSON",
method: "POST",
data: {
current: page.num,
size: 10,
params: {
name: "",
adcode: _this.menuList[0].detailList[0].value,
orderBy: _this.page.sort,
sportCategorySid: _this.page.state
}
},
loading: true
}).then((res) => {
// 成功关闭刷新状态
_this.$refs.mescrollRef.refreshFinished(res.data.records.length)
if (page.num == 1) {
// 第一页 先清空集合数据
_this.list = []
}
// 追加数据
_this.list = _this.list.concat(res.data.records)
}).catch(function(err) {
console.log("11111");
_this.$refs.mescrollRef.refreshError()
});
},
clickItem(index) {
let raceSid = this.list[index].sid
console.log(raceSid)
uni.navigateTo({
url: '../index/DetailActivity?raceSid=' + raceSid
});
},
}
}
</script>
<style lang="scss">
.top {
display: flex;
flex-direction: row;
height: 100rpx;
background: #FFFFFF;
opacity: 0.8;
align-items: center;
border-radius: 20rpx;
margin-top: 20rpx;
margin-left: 30rpx;
margin-right: 30rpx;
.unselected {
text-align: center;
font-size: 28rpx;
font-family: Adobe Heiti Std;
font-weight: normal;
color: #191919;
line-height: 40rpx;
}
.selected {
text-align: center;
font-size: 28rpx;
font-family: Adobe Heiti Std;
font-weight: normal;
color: #2CAB69;
line-height: 40rpx;
border-bottom: 2rpx #2CAB69 solid;
padding-bottom: 10rpx;
}
}
.btn1 {
background: #BBBBBB;
}
.btn2 {
background: #0081D5;
}
</style>