index.vue
4.08 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
<view class="pb50">
<view style="padding:0 30rpx;">
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
activeColor="#15CFAB"></uni-segmented-control>
</view>
<view>
<view class="active" v-for="(item, index) in showList" :key="index" @click="goDetail(item)">
<swiper class="activeSwiper" circular :autoplay="autoplay">
<swiper-item v-for="(pic,index) in item.photos?.split(',')" :key="index">
<image class="cover" mode="aspectFill" :src="config.baseUrl_api+pic"></image>
</swiper-item>
</swiper>
<view class="name">{{item.name}}</view>
<view class="pp" style="display: flex;">报到时间:{{item.reportDate.substring(0, 10)}}</view>
<view class="pp" style="display: flex;">培训时间:{{item.trainStart.substring(0, 10)}} —
{{item.trainEnd.substring(0, 10)}}
</view>
<!-- <view class="pp" style="display: flex;">主办单位:{{item.organizer}}</view> -->
<!-- <view class="pp" style="display: flex;">承办单位:{{item.manager}}</view> -->
<!-- <view class="pp" style="display: flex;">培训地点:{{item.address}}</view> -->
<button class="btn btn1" v-if="item.status == 0">点击进入</button>
</view>
</view>
</view>
<view class="nodata" v-if="showList.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
<text> 暂无活动</text>
</view>
</template>
<script setup>
import {
reactive,
toRefs,
getCurrentInstance
} from 'vue';
import * as hotel from '@/common/hotel.js';
import {
onShow,
onPullDownRefresh
} from '@dcloudio/uni-app';
const app = getApp();
import config from '@/config';
const {
proxy
} = getCurrentInstance();
const data = reactive({
showList: [],
list: [],
list0: [],
list1: [],
query: {},
autoplay: true,
items: ['全部', '进行中', '已过期'],
current: 1
});
const {
showList,
list,
list0,
list1,
query,
autoplay,
items,
current
} = toRefs(data);
onShow(option => {
if (app.globalData.isLogin) {
getList();
} else {
app.firstLoadCallback = () => {
getList();
};
}
})
onPullDownRefresh(() => {
getList();
});
function getList() {
list0.value = []
list1.value = []
hotel.getTrainList().then(res => {
list.value = res.rows
for (var n of list.value) {
if (n.status == 0) {
list0.value.push(n)
}
if (n.status == 1) {
list1.value.push(n)
}
}
getShowList(current.value)
});
}
function goDetail(item) {
let path = `/pages_hotel/hotel/detail?id=${item.trainId}&isApply=${item.isApply}`;
uni.navigateTo({
url: path
});
}
function onClickItem(e) {
if (current.value != e.currentIndex) {
current.value = e.currentIndex
}
getShowList(e.currentIndex)
}
function getShowList(n) {
switch (n) {
case 0:
showList.value = list.value
break;
case 1:
showList.value = list0.value
break;
case 2:
showList.value = list1.value
break;
}
}
</script>
<style lang="scss" scoped>
.iconSquera {
width: 40rpx;
height: 40rpx;
}
.topSearch {
display: flex;
align-items: center;
background: #fff;
}
.active {
background: #fff;
width: 700rpx;
margin: 30rpx auto 30rpx;
box-shadow: 0rpx 0rpx 27rpx 0rpx #DEDEDE;
border-radius: 20rpx 20rpx;
position: relative;
padding: 0 0 30rpx;
.cover {
width: 700rpx;
height: 320rpx;
}
.name {
font-size: 32rpx;
padding: 10rpx 15rpx 0;
color: #000000;
}
.pp {
padding: 0 15rpx;
margin: 6rpx 0;
color: #595959;
font-size: 28rpx;
}
.btn1 {
position: absolute;
right: 0rpx;
bottom: 30rpx;
width: 150rpx;
line-height: 30px;
height: 60rpx;
font-size: 28rpx;
padding: 0;
}
}
.activeSwiper {
height: 320rpx;
}
.myEnter {
position: fixed;
right: 0;
bottom: 10%;
image {
width: 150rpx;
height: 150rpx;
}
}
.pb50 {
padding-bottom: 50rpx;
}
</style>