internship.vue
5.9 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<template>
<view class="internship_box" :style="vuex_theme">
<view class="internship" v-if="hasLogin">
<view class="search_box">
<view class="search">
<u-search placeholder="请输入学生姓名/学号/手机号" placeholderColor="#C1C1C9" searchIconSize="36" height="64rpx"
bgColor="#F4F4F4" :showAction="false" shape="square" v-model="keyword" @search="handelSearch">
</u-search>
</view>
</view>
<view class="list_box" v-if="list.length > 0">
<view class="item" v-for="(item, i) in list" :key="i" @click="handelDetail(item)">
<view class="info">
<u-image :src="vuex_baseImgUrl && `${vuex_baseImgUrl}classIcon.png`" width="88rpx" height="88rpx" />
<view class="title_name">
<view class="title">
{{item.startSchoolYear}}
</view>
<view class="time">
<text>{{item.classInfoName}}</text>
</view>
</view>
<view class="num">
<text>{{item.internedTotal || 0}}/{{item.classInfoTotal || 0}}</text>
<u-icon :style="{margin:'0 0 0 8rpx'}" name="arrow-right" color="#909097" size="24">
</u-icon>
</view>
</view>
</view>
<c-loading :loading="loading"></c-loading>
</view>
<view v-else class="no_data">
<c-no-data></c-no-data>
</view>
</view>
<view class="no_login" v-else>
<view class="image">
<u-image :style="{margin:'0 auto'}" :src="vuex_baseImgUrl && `${vuex_baseImgUrl}internship_bg.png`" width="480rpx"
height="480rpx"></u-image>
</view>
<view class="btn">
<text>登录后可查看待办事项</text>
<u-button type="primary" text="登录" color="var(--primary-color)" :customStyle="{width:'340rpx'}" @click="handelLOgin">
</u-button>
</view>
</view>
<custom-tabbar></custom-tabbar>
</view>
</template>
<script>
import {
mapGetters,
mapState,
mapActions
} from 'vuex'
import listMixin from "@/common/mixins/list-mixin.js";
import {
getClassListApi,
} from '@/config/api.js';
export default {
mixins: [listMixin],
data() {
return {
keyword: '',
list: [],
search: {
keySearch: "",
},
}
},
onLoad() {
// this.search.keySearch = '';
// this.finished = false;
// this.loading = "loadmore";
// this.page = 0;
// this.list = [];
},
onShow() {
this._getList();
if (this.hasLogin) {
}
},
computed: {
...mapState({
hasLogin: 'hasLogin',
vuex_user: 'vuex_user',
teacher: (state) => state.vuex_user.teacher,
}),
},
methods: {
timeFormat(timestamp, format = 'yyyy-mm-dd') {
return timestamp > 0 ? uni.$u.timeFormat(timestamp, format) : '--'
},
handelLOgin() {
this.$u.route('/pages/main/my/loginStyle/loginStyle');
},
handelSearch(value) {
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
},
handelDetail(record) {
this.$u.route({
url: `pages/main/internship/studentList/studentList?classInfoId=${record.classInfoId}`
})
},
// scroll-view到底部加载更多
onreachBottom() {},
// 搜索
searchSubmit() {
// 调用混合搜索
this._searchData();
},
// 模拟后端分页
async getData(requestParams) {
const {
search = {}
} = requestParams;
let params = {};
params.pageNumber = requestParams.page + 1;
params.pageSize = 10;
if (this.keyword) {
params.keySearch = this.keyword
}
return await getClassListApi(params);
},
// 数据请求(没错就是这么少的代码)
async _getList() {
if (this.page == 0) {
this.list = [];
}
// 根据实际情况修改自己修改key
let result = await this.getData({
page: this.page, // 传入页码
size: this.size, // 传入每页条数
search: this.search, // 传入搜索的对象
});
this.total = result.total;
if (this.list.length == 0 && result.records.length == 0) {
this.shownoData = false
} else {
this.shownoData = true
}
this.list = this.list.concat(result.records)
// 判断是否全部加载完成
if (this.total == this.list.length) {
this.finished = true;
this.loading = 'nomore';
} else {
this.loading = 'loadmore';
}
},
}
}
</script>
<style lang="scss" scoped>
.internship_box {
background-color: #F7F7F7;
min-height: 100%;
height: auto;
.internship {
width: 100%;
margin: 0 auto;
.search_box {
padding: 36rpx 0;
background-color: #FFFFFF;
.search {
width: 690rpx;
margin: 0 auto;
}
}
.list_box {
padding: 0 0 50rpx 0;
.item {
position: relative;
width: 630rpx;
margin: 30rpx auto;
padding: 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
.info {
display: flex;
flex-flow: row nowrap;
align-items: center;
position: relative;
.title_name {
.title {
font-size: 24rpx;
line-height: 36rpx;
color: var(--primary-color);
margin: 0 12rpx;
}
.time {
padding: 12rpx 0 0 12rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #202131;
}
}
.num {
display: flex;
flex-flow: row nowrap;
position: absolute;
top: 26rpx;
right: 0rpx;
text {
font-size: 24rpx;
line-height: 36rpx;
color: #909097;
}
}
}
}
}
}
.no_login {
padding: 180rpx 0 0 0;
text-align: center;
.image {
width: 480rpx;
margin: 0 auto;
}
.btn {
position: relative;
top: -80rpx;
text {
font-size: 24rpx;
line-height: 52rpx;
color: #909097;
}
}
}
}
</style>