active.vue
3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
<view>
<view class="search-area">
<uni-easyinput prefixIcon="search" v-model="query.activityName" placeholder="搜索活动名称"
@clear="getList" @change="getList">
</uni-easyinput>
</view>
<view class="imageFlowBox">
<view class="imageFlow">
<view v-for="(b,index) in alist" :key="b.activityId" @click="goDetail(b)">
<image mode="aspectFit" :src="config.baseUrl_api+b.activityPic" class="cover"></image>
</view>
</view>
</view>
<view class="tbar">
全部活动
</view>
<view class="list">
<view class="acitem" v-for="n in list" :key="n.activityId" @click="goDetail(n)">
<view class="acbody">
<image :src="config.baseUrl_api+n.activityPic" mode="aspectFit"></image>
<view class="info">
<view class="tt">{{n.activityName}}</view>
<view class="pp">
<uni-icons type="notification" size="12" />
{{n.startTime}} ~ {{n.endTime}}
</view>
<view class="pp mt20">
<uni-icons type="location" size="12" />
{{n.address}}
</view>
<view class="text-warning" v-if="n.isFree==1">金币{{n.allGold}}/积分{{n.allScore}}</view>
<view class="text-warning" v-else>免费</view>
</view>
</view>
<view class="acfoot">
<view>
<!-- <uni-icons type="person" size="12"></uni-icons> -->
<!-- 已有 222人报名参加 -->
</view>
<button class="btn btn1">我要报名</button>
</view>
</view>
</view>
<view class="nodata" v-if="list.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onShow,onShareAppMessage
} from '@dcloudio/uni-app';
import config from '@/config.js';
import {
ref,
getCurrentInstance
} from 'vue';
import * as api from '@/common/api.js';
const list = ref([])
const alist = ref([])
const query = ref({
activityName: ''
})
const system = uni.getStorageSync('systemType');
onShow(() => {
init()
})
function init() {
uni.showLoading({
title: `加载中`
})
getList()
getHotList()
}
function getHotList(){
api.getHomePageHotActive().then(res => {
alist.value = res.data
uni.hideLoading()
})
}
function getList() {
api.getActivityList(query.value).then(res => {
list.value = res.rows
uni.hideLoading()
})
}
function goDetail(item) {
let path = `/course/activeDetail?id=${item.activityId}`;
uni.navigateTo({
url: path
});
}
</script>
<style lang="scss" scoped>
.imageFlowBox {
position: relative;
height: 300rpx;
overflow: auto;
}
.imageFlow {
display: flex;
position: absolute;
left: 0;
padding: 0 10rpx;
&>view {
border-radius: 10px;
overflow: hidden;
width: 630rpx;
height: 300rpx;
margin: 0 10rpx;
position: relative;
}
image {
width: 630rpx;
height: 300rpx;
}
.info {
position: absolute;
color: #fff;
top: 0;
width: 100%;
height: 100%;
padding: 30rpx 40rpx;
overflow: hidden;
box-sizing: border-box;
.name {
font-size: 34rpx;
color: #fff;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
border-bottom: 1px solid RGBA(255, 255, 255, 0.7);
}
}
.esp_2 {
font-size: 28rpx;
margin-bottom: 26rpx;
}
.timeblock {
background: rgba(27, 27, 27, 0.1);
border-radius: 25rpx;
font-size: 22rpx;
padding: 12rpx 17rpx;
display: inline-flex;
align-items: center;
image {
width: 28rpx;
height: 28rpx;
margin-left: 22rpx;
}
}
}
.list {
padding: 24rpx 0 0 24rpx;
overflow: hidden;
}
</style>