You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
4.4 KiB
190 lines
4.4 KiB
<template>
|
|
<view class="container safe-area-inset-bottom">
|
|
<view class="search-bar">
|
|
<view class="search-bar__input">
|
|
<u-input
|
|
v-model="select.keyword"
|
|
:height="26"
|
|
placeholder="请输入学校名称"
|
|
style="flex: 1; margin-right: 40rpx"
|
|
></u-input>
|
|
<u-icon name="search" color="#333" :size="30"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-dropdown ref="uDropdown" inactive-color="#333" :height="80" menu-icon="arrow-down-fill">
|
|
<u-dropdown-item v-model="select.year" title="年份">
|
|
<view class="slot-content">
|
|
<u-picker
|
|
:has-popup="false"
|
|
mode="time"
|
|
:default-time="defaultTime"
|
|
:start-year="new Date().getFullYear() - 30"
|
|
:end-year="new Date().getFullYear() + 30"
|
|
:params="{
|
|
year: true,
|
|
month: false,
|
|
day: false,
|
|
hour: false,
|
|
minute: false,
|
|
second: false,
|
|
}"
|
|
@cancel="closeDropdown"
|
|
@confirm="({ year }) => {
|
|
select.year = year
|
|
closeDropdown()
|
|
changeYear()
|
|
}"
|
|
></u-picker>
|
|
</view>
|
|
</u-dropdown-item>
|
|
</u-dropdown>
|
|
<view class="wrap">
|
|
<view class="table">
|
|
<view class="table__header">
|
|
<text class="table__header-item">学校</text>
|
|
<text class="table__header-item">名额</text>
|
|
</view>
|
|
<view
|
|
class="table__row"
|
|
v-for="(item, index) in details"
|
|
:key="item.id"
|
|
>
|
|
<text class="table__row-item">{{ item.name }}</text>
|
|
<text class="table__row-item">{{ item.total }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
defaultTime: '',
|
|
select: {
|
|
year: new Date().getFullYear().toString(),
|
|
school_id: "",
|
|
},
|
|
scrollTop: 0,
|
|
detail: {},
|
|
details: []
|
|
};
|
|
},
|
|
methods: {
|
|
async changeYear() {
|
|
try {
|
|
const { list } = await this.$u.api.middleSchoolIndicatorList(this.select)
|
|
this.details = list.data.map(i => i.details || [])?.flat()
|
|
} catch (err) {
|
|
console.error(err)
|
|
}
|
|
},
|
|
async getDetail(id) {
|
|
try {
|
|
const { list } = await this.$u.api.middleSchoolIndicatorDetail({
|
|
id
|
|
})
|
|
const { school_id, year } = list
|
|
this.select.year = year
|
|
this.select.school_id = school_id
|
|
this.detail = list
|
|
this.details = this.detail.details
|
|
} catch (err) {
|
|
console.error(err)
|
|
}
|
|
},
|
|
closeDropdown() {
|
|
this.$refs.uDropdown.close();
|
|
}
|
|
},
|
|
onReady() {
|
|
this.defaultTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
|
|
},
|
|
onLoad(options) {
|
|
if (options.id) {
|
|
this.getDetail(options.id)
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.u-dropdown__menu__item {
|
|
justify-content: flex-end !important;
|
|
padding: 0 26rpx;
|
|
position: relative;
|
|
|
|
&::after {
|
|
content: '各高中给苏州中学的名额';
|
|
font-size: 24rpx;
|
|
text-transform: uppercase;
|
|
color: #333333;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 26rpx;
|
|
transform: translateY(-50%);
|
|
}
|
|
}
|
|
.u-dropdown {
|
|
background: #fff;
|
|
}
|
|
.container {
|
|
min-height: 100vh;
|
|
background: #eaf8fe;
|
|
}
|
|
.search-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
background-color: #fff;
|
|
padding: 20rpx 25rpx;
|
|
|
|
&__input {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
border-radius: 80rpx;
|
|
background: rgba(51, 51, 51, 0.1);
|
|
padding: 18rpx 40rpx 18rpx 46rpx;
|
|
}
|
|
}
|
|
.wrap {
|
|
padding: 50rpx 24rpx;
|
|
|
|
.table {
|
|
width: 100%;
|
|
border-radius: 20px;
|
|
overflow: hidden;
|
|
background-color: #f0f8ff;
|
|
filter: drop-shadow(-2.179px 3.355px 2.5px rgba(208,209,209,0.3));
|
|
|
|
&__header,
|
|
&__row {
|
|
display: flex;
|
|
padding: 28rpx 0;
|
|
justify-content: space-between;
|
|
border-bottom: 1px solid #ccc;
|
|
}
|
|
|
|
&__header-item,
|
|
&__row-item {
|
|
flex-basis: calc(100% / 2);
|
|
text-align: center;
|
|
}
|
|
|
|
&__header {
|
|
background-color: #4693d4;
|
|
color: #fff;
|
|
}
|
|
|
|
&__row:nth-child(even) {
|
|
background-color: #f9f9f9;
|
|
}
|
|
&__row:nth-last-child(1) {
|
|
border-bottom: none;
|
|
}
|
|
}
|
|
}
|
|
</style>
|