Files
zhxg_app_v1.0/pages/dormitory/index.vue
2025-07-16 15:34:34 +08:00

285 lines
8.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="award">
<view class="top-bar">
<view class="tool">
<view class="left" @tap="applydormitory">
<svg t="1723014673503" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="1470" width="100" height="100">
<path
d="M0 0m170.666667 0l682.666666 0q170.666667 0 170.666667 170.666667l0 682.666666q0 170.666667-170.666667 170.666667l-682.666666 0q-170.666667 0-170.666667-170.666667l0-682.666666q0-170.666667 170.666667-170.666667Z"
fill="#F3F7FF" p-id="1471"></path>
<path
d="M826.88 566.613333c5.589333 0 10.496 2.645333 14.592 7.808a29.312 29.312 0 0 1 6.144 18.56v142.634667a41.514667 41.514667 0 1 1-83.072 0v-63.744H266.837333v62.592a42.666667 42.666667 0 0 1-42.666666 42.666667h-3.968a42.666667 42.666667 0 0 1-42.666667-42.666667V277.333333c0-7.168 2.133333-13.354667 6.186667-18.517333 4.138667-5.290667 8.96-7.808 14.592-7.808h47.786666c5.632 0 10.538667 2.602667 14.592 7.808a29.056 29.056 0 0 1 6.144 18.517333v289.322667H826.88z m20.650667-31.402666v-25.344c0-16.981333-3.84-34.133333-28.245334-63.744-24.32-29.696-61.866667-44.117333-96.170666-44.117334H494.933333a18.432 18.432 0 0 0-14.592 7.509334 27.306667 27.306667 0 0 0-6.144 17.834666v107.861334h373.333334z m-474.709334 0a65.493333 65.493333 0 1 0 0-130.986667 65.493333 65.493333 0 0 0 0 130.986667z"
fill="#1890FF" p-id="1472"></path>
</svg>
申请
</view>
<view class="right" @tap="toPlan">
<svg t="1723014605442" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="1215" width="60" height="60">
<path
d="M665 81v105H369V81h296m20-80H349c-33.1 0-60 26.9-60 60v145c0 33.1 26.9 60 60 60h336c33.1 0 60-26.9 60-60V61c0-33.1-26.9-60-60-60zM298.5 689c-37.2 0-67.5-30.3-67.5-67.5s30.3-67.5 67.5-67.5 67.5 30.3 67.5 67.5-30.3 67.5-67.5 67.5z m0-80c-6.9 0-12.5 5.6-12.5 12.5s5.6 12.5 12.5 12.5 12.5-5.6 12.5-12.5-5.6-12.5-12.5-12.5zM298.5 884c-37.2 0-67.5-30.3-67.5-67.5s30.3-67.5 67.5-67.5 67.5 30.3 67.5 67.5-30.3 67.5-67.5 67.5z m0-80c-6.9 0-12.5 5.6-12.5 12.5s5.6 12.5 12.5 12.5 12.5-5.6 12.5-12.5-5.6-12.5-12.5-12.5zM642 661H477c-22.1 0-40-17.9-40-40s17.9-40 40-40h165c22.1 0 40 17.9 40 40s-17.9 40-40 40zM762 859H477c-22.1 0-40-17.9-40-40s17.9-40 40-40h285c22.1 0 40 17.9 40 40s-17.9 40-40 40zM762 469H477c-22.1 0-40-17.9-40-40s17.9-40 40-40h285c22.1 0 40 17.9 40 40s-17.9 40-40 40z"
fill="#1890FF" p-id="1216"></path>
<path
d="M863 177v767H171V177h118v9c0 44.2 35.8 80 80 80h296c44.2 0 80-35.8 80-80v-9h118m20-80H665v89H369V97H151c-33.1 0-60 26.9-60 60v807c0 33.1 26.9 60 60 60h732c33.1 0 60-26.9 60-60V157c0-33.1-26.9-60-60-60z"
fill="#1890FF" p-id="1217"></path>
<path
d="M298.8 493.6c-10.2 0-20.4-3.9-28.2-11.6l-35.8-35.6c-15.7-15.6-15.8-40.9-0.2-56.6 15.6-15.7 40.9-15.8 56.6-0.2l7.6 7.6 52-51.6c15.7-15.6 41-15.5 56.6 0.2 15.6 15.7 15.5 41-0.2 56.6L327 482c-7.8 7.7-18 11.6-28.2 11.6z"
fill="#1890FF" p-id="1218"></path>
</svg>
调宿计划
</view>
</view>
<view>
当前宿舍{{now_dorm}}
</view>
</view>
<!-- 学生信息结束 -->
<scroll-view scroll-y="true" @scrolltolower="scrolltolower">
<view class="awardList">
<!-- <view class="List" v-for="(item,index) in 10" :key="index">
<view class="awardListleft">
<text class="title">调宿申请</text>
<text>姓名sophie</text>
<text>学号2013007005</text>
<text>申请理由与黑色有不糊</text>
</view>
<view class="awardListright">
<uni-tag :inverted="true" :text="getStatus(item.status)" type="success" />
</view>
</view> -->
<view class="List" v-for="(item,index) in awardList" :key="index">
<view class="awardListleft">
<text class="title"> {{item.type == "1" ? "调宿申请" : "退宿申请"}}</text>
<text>姓名{{item.stuName}}</text>
<text>学号{{item.stuNo}}</text>
<text>申请理由{{item.reason}}</text>
</view>
<view class="awardListright">
<uni-tag :inverted="true" :text="getStatus(item.status)" type="success" />
</view>
</view>
</view>
<view class="empty" v-if="awardList.length==0&&topLoading==false">
<image src="@/static/empty.png" mode="widthFix"></image>
暂时没有数据
</view>
<view class="loading-more-top" v-if="topLoading">
<uni-load-more style="padding-top: 90px;" status="loading" />
</view>
<view class="loading-more" v-if="loading">
<uni-load-more status="loading" />
</view>
<view class="no-more" v-if="!loading&&awardList.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
</template>
<script>
import {
getOwnLog,
listOwnApply,
getStatus
} from "@/api/dms/index.js";
export default {
data() {
return {
now_dorm: "暂无",
awardList: [],
status_list: [],
loading: false,
topLoading: true,
queryParams: {
pageNum: 1,
pageSize: 10
},
}
},
async onShow() {
await this.getDictStatus();
await this.getOwnLog();
await this.listOwnApply();
},
methods: {
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
this.listOwnApply()
}, 1000)
} else {
}
},
async getDictStatus() {
let res = await getStatus();
if (res.code == 200) {
this.status_list = [...res.data];
}
},
getStatus(status) {
let data = this.status_list.filter(x => x.dictValue == status.toString());
if (data != null && data.length != 0) {
return data[0].dictLabel;
} else {
return "无";
}
},
async listOwnApply() {
let res = await listOwnApply(this.queryParams);
if (res.code == 200) {
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.awardList = res.rows;
} else {
this.awardList = this.awardList.concat(res.rows); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
},
async getOwnLog() {
let res = await getOwnLog();
if (res.code == 200) {
let data = {
...res.data
};
if (data.dormStu != null) {
let temp = {
...data.dormStu
};
this.now_dorm = temp.campusName + " " + temp.parkName + " " + temp.buildingName + " " + temp
.floorName + "层" + temp.roomNo;
}
}
},
applydormitory() {
uni.navigateTo({
url: "./apply"
})
},
toPlan() {
uni.navigateTo({
url: "./plan"
})
},
}
}
</script>
<style lang="less" scoped>
.award {
background-color: #F5F5F7;
.top-bar {
background-color: white;
position: fixed;
z-index: 99;
left: 0;
right: 0;
top: 80rpx;
padding: 20rpx;
color: #1890FF;
.tool {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15rpx 0 20rpx;
.left {
display: flex;
align-items: center;
svg {
margin-right: 8rpx;
width: 50rpx;
height: 50rpx;
color: red;
}
}
.right {
display: flex;
align-items: center;
svg {
margin-right: 8rpx;
width: 35rpx;
height: 35rpx;
color: red;
}
}
}
&>view:last-child {
margin-top: 20rpx;
}
}
scroll-view {
height: calc(100vh - 45px);
.no-more {
text-align: center;
color: gray;
padding-bottom: 10px;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 200rpx;
color: #9E9E9E;
font-size: 36rpx;
image {
width: 250rpx;
margin-bottom: 50rpx;
}
}
}
.awardList {
margin-top: 200rpx;
display: flex;
align-items: center;
flex-direction: column;
.List {
display: flex;
justify-content: space-between;
width: 90%;
background-color: white;
border-radius: 10rpx;
padding: 40rpx 30rpx 30rpx 30rpx;
margin-bottom: 30rpx;
.awardListleft {
display: flex;
flex-direction: column;
.title {
font-size: 40rpx;
color: black;
width: 400rpx;
margin-bottom: 10rpx;
}
text {
width: 400rpx;
padding-bottom: 20rpx;
color: #9C9C9C;
}
}
}
}
}
</style>