agreementList.vue
4.0 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
<template>
<view class="registration_review">
<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="company">
<text>实践课程</text>
<text>{{item.courseName || '--'}}</text>
</view>
<view class="company">
<text>实习计划</text>
<text>{{item.planName|| '--'}}</text>
</view>
<view class="company">
<text>实习项目</text>
<text>{{item.projectName|| '--'}}</text>
</view>
<view class="company">
<text>学生名称</text>
<text>{{item.studentName|| '--'}}</text>
</view>
<view class="time">
<text>申请时间</text>
<text>{{timeFormat(item.createdTime, 'yyyy-mm-dd hh:MM')}}</text>
</view>
</view>
<c-loading :loading="loading"></c-loading>
</view>
<view v-else class="no_data">
<c-no-data></c-no-data>
</view>
</view>
</template>
<script>
import {
mapGetters,
mapState,
mapActions
} from 'vuex'
import listMixin from "@/common/mixins/list-mixin.js";
import {
getAgreementListApi,
} from '@/config/api.js';
export default {
mixins: [listMixin],
data() {
return {
list: [], //列表必须为key list的数组
search: {
//搜索对象必须为key search的对象
status: 'wait,pass,reject',
},
}
},
onLoad(option) {
this.studentId = option.studentId;
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
},
onShow() {
},
computed: {
},
methods: {
handelDetail(record) {
this.$u.route({
url: `pages/main/internship/agreementDetail/agreementDetail?&id=${record.id}`
})
},
timeFormat(timestamp, format = 'yyyy-mm-dd') {
return timestamp > 0 ? uni.$u.timeFormat(timestamp, format) : '--'
},
// scroll-view到底部加载更多
onreachBottom() {},
// 搜索
searchSubmit() {
// 调用混合搜索
this._searchData();
},
// 模拟后端分页
async getData(requestParams) {
const {
search = {}
} = requestParams;
let params = {};
params.pageNumber = requestParams.page + 1;
params.pageSize = 5;
if (this.studentId) {
params.studentId = this.studentId
}
return await getAgreementListApi(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)
},
}
}
</script>
<style lang="scss" scoped>
.registration_review {
width: 100%;
min-height: 100%;
height: auto;
background-color: #F7F7F7;
.list_box {
padding: 30rpx 0 50rpx 0;
.item {
position: relative;
width: 630rpx;
margin: 0 auto 30rpx ;
padding: 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
.company {
display: flex;
flex-flow: row nowrap;
margin: 0 0 30rpx 0;
text {
width: 120rpx;
font-size: 28rpx;
line-height: 32rpx;
color: #909097;
margin: 0 0 0 16rpx;
}
text:last-child {
width: 450rpx;
color: #202131;
margin: 0 0 0 30rpx;
}
}
.time {
border-top: 2rpx solid #E2E2E8;
padding: 28rpx 0 0 0;
text {
width: 120rpx;
font-size: 28rpx;
line-height: 32rpx;
color: #909097;
}
text:last-child {
width: 450rpx;
color: #202131;
margin: 0 0 0 78rpx;
}
}
}
}
}
</style>