移动端V1.0

This commit is contained in:
2025-07-16 15:34:34 +08:00
commit 194b0750fd
1083 changed files with 178295 additions and 0 deletions

View File

@@ -0,0 +1,238 @@
<template>
<view class="detail">
<view class="message">
<view class="title">活动信息</view>
<view>
<text>活动主题</text>
<text>{{activity.activityTheme}}</text>
</view>
<!-- 活动开始 知无涯 -->
<view>
<text>活动开始时间</text>
<text>{{ activity.activityStartTime }}</text>
</view>
<!-- 活动结束 知无涯 -->
<view>
<text>活动结束时间</text>
<text>{{ activity.activityEndTime }}</text>
</view>
<view>
<text>活动地点</text>
<text>{{activity.activityPlace}}</text>
</view>
<view>
<text>活动可容纳人数</text>
<text>{{activity.galleryful}}</text>
</view>
<view>
<text>当前报名人数</text>
<text>{{headcount}}</text>
</view>
</view>
<view class="require">
<view class="title">
具体要求
</view>
<view>
<text>具体要求</text>
<text>{{activity.specificRequirements}}</text>
</view>
</view>
<view class="feedback" v-if="activity.activityStatus==2">
<view class="title">
活动结束反馈
</view>
<view>
<text>活动反馈</text>
<text>{{activity.feedback}}</text>
</view>
<view>
<text>活动图</text>
<view class="feedback-imgs">
<image @tap="previewImg(feedbackImgs,index)" :src="basePath+item" mode="aspectFill"
v-for="(item,index) in feedbackImgs"></image>
</view>
</view>
</view>
<button class="apply" @tap="onActivitiesApply" :disabled="applyStatus==1">{{applyStatus==1?'已报名':'报名'}}</button>
</view>
</template>
<script>
import {
activitiesDetail,
activitiesApply
} from '@/api/OneStopCommunity/activity.js'
import {
getCurrentTime
} from "@/utils/getCurrentDateTime.js";
import {
baseUrl
} from "@/config.js";
import {
previewImg
} from "@/utils/uploadImg.js"
export default {
data() {
return {
activity: {},
activityId: "", //活动id
activityTheme: "", //活动主题
initiator: "", //活动发起人
registrationTime: "", //报名时间
headcount: null,
applyStatus: 0,
feedbackImgs: [],
basePath: baseUrl
}
},
onLoad(option) {
this.activityId = option.activityId;
this.activityTheme = option.activityTheme;
this.initiator = option.initiator;
this.getdetail(this.activityId)
},
methods: {
async getdetail(activityid) {
let res = await activitiesDetail(activityid)
if (res.code == 200) {
this.activity = res.data
this.headcount = res.data.oneStopRegistrationRecords.filter(item => (item
.auditStatus === 0 || item.auditStatus === 1)).length
if (res.data.feedbackImgs != null) {
this.feedbackImgs = res.data.feedbackImgs.split(",")
}
res.data.oneStopRegistrationRecords.forEach(item => {
if (item.jobNumber == uni.getStorageSync('stuNo')) {
this.applyStatus = 1;
}
})
}
},
onActivitiesApply() {
uni.showModal({
title: "确定报名吗?",
success: async (bool) => {
if (bool.confirm) {
let formData = {
activityId: this.activityId,
activityTheme: this.activityTheme,
initiator: this.initiator,
registrationTime: getCurrentTime()
}
let res = await activitiesApply(formData);
if (res.code == 200) {
uni.showToast({
title: "报名成功"
})
setTimeout(() => {
uni.redirectTo({
url: "/pages/OneStopCommunity/apply/index"
})
}, 1000)
}
}
}
})
},
previewImg(imgs, index) {
let images = imgs.map(img => {
return {
path: baseUrl + img
}
})
previewImg(images, index);
}
},
}
</script>
<style lang="scss" scoped>
.detail {
min-height: 100vh;
background-color: #F5F5F7;
padding: 40rpx;
.message {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 40rpx 20rpx 40rpx;
.title {
font-size: 32rpx;
font-weight: 700;
color: #202020;
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
&>view:nth-child(n+2) {
font-size: 28rpx;
line-height: 50rpx;
}
}
.require {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 40rpx;
&>view:nth-child(1) {
font-size: 32rpx;
font-weight: 700;
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
}
.feedback {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 40rpx;
.feedback-imgs {
margin-top: 10rpx;
display: flex;
flex-wrap: wrap;
image {
margin-bottom: 10rpx;
width: 23.5%;
border-radius: 8rpx;
height: 136rpx;
&:not(:nth-child(4n)) {
margin-right: 2%;
}
}
}
&>view:nth-child(1) {
font-size: 32rpx;
font-weight: 700;
}
&>view:not(:first-child) {
margin-top: 20rpx;
}
}
.apply {
background-color: #1890FF !important;
color: white;
margin-top: 100rpx;
}
uni-button[disabled] {
opacity: 0.5;
}
}
</style>

View File

@@ -0,0 +1,256 @@
<template>
<view class="index">
<view class="search">
<uni-search-bar @confirm="search" cancelButton="none" @clear="onClear" v-model="queryParams.activityTheme">
</uni-search-bar>
</view>
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
<view class="list">
<view v-for="(item,index) in list" :key="index" @click="detail(item)" class="box">
<view>
<view>活动主题{{item.activityTheme}}</view>
<view v-if="item.activityStatus==0" class="active">进行中</view>
<view v-if="item.activityStatus==1" class="active">报名中</view>
<view v-else-if="item.activityStatus==2" class="dark">已结束</view>
</view>
<view>
<text>
<image mode="aspectFill" :src="basePath+item.activityImgs"></image>
</text>
</view>
<view>
<text>活动地点</text>
<text>{{item.activityPlace}}</text>
</view>
<view>
<text>可容纳人数</text>
<text>{{item.galleryful}}</text>
</view>
<view>
<text>当前报名人数</text>
<text>{{item.numberApplicants}}</text>
</view>
<!--活动开始时间 知无涯 -->
<view>
<text>活动开始时间</text>
<text>{{item.activityStartTime}}</text>
</view>
<!-- 活动结束时间 知无涯 -->
<view>
<text>活动结束时间</text>
<text>{{item.activityEndTime}}</text>
</view>
<view>
<text>具体要求</text>
<text>{{item.specificRequirements}}</text>
</view>
</view>
</view>
<view class="empty" v-if="list.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&&list.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
</template>
<script>
import {
activitiesList
} from '@/api/OneStopCommunity/activity.js'
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
basePath: baseUrl,
list: [],
loading: false,
topLoading: true,
queryParams: {
pageNum: 1,
pageSize: 10,
activityTheme: "",
publishStatus: 0
}
}
},
methods: {
search(res) {
// uni.showToast({
// title: '搜索:' + res.value,
// icon: 'none'
// })
this.getlist()
},
onClear() {
this.queryParams.pageNum = 1;
this.queryParams.activityTheme = "";
this.getlist();
},
toDetailPage(item) {
},
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
//请求参数
this.getlist()
}, 1000)
} else {
}
},
detail(item) {
uni.navigateTo({
url: `detail?activityId=${item.activityId}&activityTheme=${item.activityTheme}&initiator=${item.eventPromoter}`
})
},
async getlist() {
let res = await activitiesList(this.queryParams)
if (res.code == 200) {
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.list = res.rows; // 如果是第一页,直接显示新数据
} else {
this.list = this.list.concat(res.rows); // 否则追加新数据到列表中
}
this.list.forEach(element => {
element.numberApplicants = element.oneStopRegistrationRecords.filter(item => (item
.auditStatus === 0 || item.auditStatus === 1)).length
});
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
}
},
onLoad() {},
onShow() {
this.topLoading = true;
this.queryParams.pageNum = 1;
this.list = [];
this.getlist();
},
}
</script>
<style lang="scss" scoped>
.index {
background-color: #F5F5F7;
min-height: 100vh;
.search {
width: 100%;
background-color: white;
position: fixed;
z-index: 10;
top: 80rpx;
padding: 0rpx 8rpx;
background-color: #F5F5F7;
/deep/ .uni-searchbar__box {
background-color: white !important;
}
}
.scroll-views {
height: calc(100vh - 10px);
.list {
margin-top: 100rpx;
padding: 24rpx;
&>view:nth-child(n+2) {
margin-top: 30rpx;
}
.box {
width: 100%;
// height: 364rpx;
padding: 20rpx 40rpx;
border-radius: 16rpx;
background-color: white;
font-size: 28rpx;
&>view {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
}
&>view:nth-child(1) {
display: flex;
justify-content: space-between;
image {
width: 100%;
height: 334rpx;
}
.active {
background-color: #E7FAF0;
border: 1px solid #D0F5E0;
padding: 4rpx;
font-size: 20rpx;
color: #71E2A3;
}
.dark {
background-color: #F5F5F7;
border: 1px solid #C1CCDF;
padding: 4rpx;
font-size: 20rpx;
color: #A7A8AC;
}
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
&>view:nth-child(n+2) {
line-height: 50rpx;
}
}
}
.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;
}
}
}
}
</style>

View File

@@ -0,0 +1,188 @@
<template>
<view class="detail">
<view class="box">
<view class="up">
<view>
<view>活动信息</view>
</view>
<view>
<text>活动主题</text>
<text>{{applyInfo.activityTheme}}</text>
</view>
<view>
<text>活动时间</text>
<text>{{activityInfo.activityTime}}</text>
</view>
<view>
<text>活动地点</text>
<text>{{activityInfo.activityPlace}}</text>
</view>
<view>
<text>活动可容纳人数</text>
<text>{{activityInfo.galleryful}}</text>
</view>
<view>
<text>当前报名人数</text>
<text>{{applyInfo.numberApplicants}}</text>
</view>
</view>
<view class="lnthe">
<view>
具体要求
</view>
<view>
<text>具体要求</text>
<text>{{activityInfo.specificRequirements}}</text>
</view>
</view>
<view class="underthe">
<view>
<view>
报名信息
</view>
<view v-if="applyInfo.auditStatus==1" class="active">报名通过</view>
<view v-else-if="applyInfo.auditStatus==2" class="dark">不通过</view>
<view v-else class="staydark">待审核</view>
</view>
<view>
<text>报名人</text>
<text>{{applyInfo.applicant}}</text>
</view>
<view>
<text>报名时间</text>
<text>{{applyInfo.registrationTime}}</text>
</view>
</view>
<!-- <view v-if="applyInfo.auditStatus==1">
<view>
活动注意事项
</view>
<view>
<text>请你于2024年06月12日上午9点前到综合楼1楼大厅集合不允许迟到</text>
</view>
</view> -->
</view>
</view>
</template>
<script>
import {applyDetail} from '@/api/OneStopCommunity/apply.js'
export default{
data(){
return{
activityInfo:{},//活动信息
applyInfo:{},//报名信息
headcount:null
}
},
methods:{
async getdetail(recordid){
let res = await applyDetail(recordid)
console.log(res)
if(res.code==200){
this.activityInfo=res.data.communityActivitiesList[0]
this.applyInfo=res.data;
}
}
},
onLoad(option) {
this.getdetail(option.recordid)
},
}
</script>
<style lang="scss" scoped>
.detail{
min-height: 100vh;
background-color: #F5F5F7;
.box{
padding: 40rpx;
.up {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 40rpx 20rpx 40rpx;
&>view:nth-child(1){
view{
font-size: 32rpx;
font-weight: 700;
color: #202020;
}
&>view:nth-child(2){
}
}
&>view:nth-child(2){
margin-top: 40rpx;
}
&>view:nth-child(n+2){
font-size: 28rpx;
line-height: 50rpx;
}
}
.lnthe{
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 20rpx;
&>view:nth-child(1){
font-size: 32rpx;
font-weight: 700;
}
&>view:nth-child(2){
margin-top: 40rpx;
}
}
.underthe{
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 20rpx;
&>view:nth-child(1){
font-size: 32rpx;
font-weight: 700;
display: flex;
justify-content: space-between;
.active{
background-color: #E7FAF0;
border: 1px solid #D0F5E0;
font-size: 20rpx;
color: #71E2A3;
padding: 8rpx 18rpx;
}
.dark{
background-color: #FFDBDB;
border: 1px solid #FF9292;
font-size: 20rpx;
color:#FF9292;
padding: 8rpx 18rpx;
}
.staydark{
background-color: #FFF8E6;
border: 1px solid #FFE399;
font-size: 20rpx;
color:#FFBA00;
padding: 8rpx 18rpx;
}
}
&>view:nth-child(2){
margin-top: 40rpx;
}
}
&>view:nth-child(4){
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 20rpx;
color: #1890ff;
&>view:nth-child(1){
font-size: 32rpx;
font-weight: 700;
}
&>view:nth-child(2){
margin-top: 40rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,234 @@
<template>
<view class="index">
<view class="search">
<uni-search-bar @confirm="search" cancelButton="none" @clear="onClear" v-model="queryParams.activityTheme">
</uni-search-bar>
</view>
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
<view class="list">
<view v-for="(item,index) in list" :key="index" @click="detail(item)" class="box">
<view>
<view>活动主题{{item.activityTheme}}</view>
<view v-if="item.auditStatus==1" class="active">报名通过</view>
<view v-else-if="item.auditStatus==2" class="dark">不通过</view>
<view v-else class="staydark">待审核</view>
</view>
<view>
<text>活动时间</text>
<text>{{item.communityActivitiesList[0].activityTime}}</text>
</view>
<view>
<text>活动地点</text>
<text>{{item.communityActivitiesList[0].activityPlace}}</text>
</view>
<view>
<text>活动可容纳人数</text>
<text>{{item.communityActivitiesList[0].galleryful}}</text>
</view>
<view>
<text>当前报名人数</text>
<text>{{item.numberApplicants}}</text>
</view>
<view>
<text>具体要求</text>
<text>{{item.communityActivitiesList[0].specificRequirements}}</text>
</view>
</view>
</view>
<view class="empty" v-if="list.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&&list.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
</template>
<script>
import {
applyList
} from '@/api/OneStopCommunity/apply.js'
export default {
data() {
return {
list: [],
loading: false,
topLoading: true,
queryParams: {
pageNum: 1,
pageSize: 10,
activityTheme: "",
jobNumber:uni.getStorageSync("stuNo")
}
}
},
methods: {
search(res) {
this.getlist()
},
onClear(){
this.queryParams.pageNum = 1;
this.queryParams.activityTheme="";
this.getlist();
},
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
//请求参数
this.getlist()
}, 1000)
} else {
}
},
detail(item) {
uni.navigateTo({
url: `detail?recordid=${item.recordId}`
})
},
async getlist() {
let res = await applyList(this.queryParams)
if (res.code == 200) {
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.list = res.rows; // 如果是第一页,直接显示新数据
// for (var i = 0; i < res.rows.length; i++) {
// this.list =res.rows.communityActivitiesList[i]
// }
} else {
this.list = this.list.concat(res.rows); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
console.log(res)
}
},
onLoad() {},
onShow() {
this.topLoading = true;
this.queryParams.pageNum = 1;
this.list = [];
this.getlist();
},
}
</script>
<style lang="scss" scoped>
.index {
background-color: #F5F5F7;
min-height: 100vh;
.search {
width: 100%;
background-color: white;
position: fixed;
z-index: 10;
top: 80rpx;
padding: 0rpx 8rpx;
background-color: #F5F5F7;
/deep/ .uni-searchbar__box {
background-color: white !important;
}
}
.scroll-views {
height: calc(100vh - 10px);
.list {
margin-top: 100rpx;
padding: 24rpx;
&>view:nth-child(n+2) {
margin-top: 30rpx;
}
.box {
width: 100%;
// height: 364rpx;
padding: 20rpx 40rpx;
border-radius: 16rpx;
background-color: white;
font-size: 28rpx;
&>view {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
}
&>view:nth-child(1) {
display: flex;
justify-content: space-between;
&>view:last-child{
padding:8rpx 10rpx;
font-size: 22rpx;
}
.active {
background-color: #E7FAF0;
border: 1px solid #D0F5E0;
color: #71E2A3;
}
.dark {
background-color: #FFDBDB;
border: 1px solid #FF9292;
color: #FF9292;
}
.staydark {
background-color: #FFF8E6;
border: 1px solid #FFE399;
color: #FFBA00;
}
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
&>view:nth-child(n+2) {
line-height: 50rpx;
}
}
}
.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;
}
}
}
}
</style>

View File

@@ -0,0 +1,544 @@
<template>
<view class="detail" v-if="detail!=null">
<view style="margin: 40rpx;">
<uni-swiper-dot :info="swiperList" :current="current" :dots-styles="dotStyles" field="content" mode="round">
<swiper interval="2000" autoplay class="swiper-box" @change="change">
<swiper-item v-for="(img ,index) in swiperList" :key="index">
<view class="swiper-item">
<image mode="aspectFill" :src="basePath+img">
</image>
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</view>
<view class="content">
<view class="title">
<view class="title-a">
<text>{{detail.roomName}}</text>
<view class="open-up">开放中</view>
</view>
<view class="title-b">
<view>
<uni-icons color="#FFBB12" type="staff-filled" size="24"></uni-icons>
</view>
<view>
<text>{{detail.staffOneStopRoom[0].roomCapacity}}/</text>
</view>
</view>
</view>
<view class="introduction">
<text>
{{detail.roomInfo}}
</text>
</view>
</view>
<view class="time-zone">
<view>预定详情</view>
<view>
<view>
<text>活动</text><text>{{detail.rtTheme}}</text>
</view>
<view>
<text>活动房</text><text>{{detail.roomName}}</text>
</view>
<view>
<text>预约时间</text><text>{{detail.rtTime}} {{detail.rtTimePeriod}}</text>
</view>
<view>
<text>参与人员类型</text><text>{{detail.rtRole}}</text>
</view>
<view>
<text>预约用途</text><text>{{detail.rtPurpose}}</text>
</view>
<view>
<text>使用部门/学院</text><text>{{detail.rtDepar}}</text>
</view>
<view>
<text>参与人数</text><text>{{detail.rtPeople}}</text>
</view>
<view class="status">
<text>审批状态</text>
<text v-for="(tab,index) in auStatelist" :key="index" :class="tab.dictValue|formateAuStatus"
v-show="detail.auditStatus==tab.dictValue">
{{tab.dictLabel}}
</text>
</view>
<view>
<text>使用状态</text>
<text v-for="(tab,index) in rtstatelist" :key="index"
v-if="tab.dictValue==detail.rtState">{{tab.dictLabel}}</text>
</view>
<view v-if="detail.auditStatus==2">
<text>不同意原因</text>
<text>{{detail.editOpinion}}</text>
</view>
<view style="display: flex;flex-wrap: wrap;">
<view>
<text style="color:#9C9C9C ;">使用事项</text>
</view>
<view>
<view>
<text>{{detail.staffOneStopRoom[0].roomMatter}}</text>
</view>
</view>
</view>
<view style="display: flex;flex-wrap: wrap;">
<view>
<text style="color:#9C9C9C ;">使用反馈</text>
</view>
<view>
<view>
<text>{{detail.feedback}}</text>
</view>
</view>
</view>
</view>
<view class="button-a" v-show="detail.auditStatus<2&&detail.rtState<2">
<button v-if="detail.auditStatus==0" @click="cancelMake()"><text>取消预约</text> </button>
<button v-else-if="detail.auditStatus==1" @click="finish()"><text>使用结束</text></button>
</view>
<view class="button-b" v-show="detail.auditStatus==2&&detail.rtState<2">
<view><button @click="updateMake()">修改预约</button></view>
<view><button type="default" @click="cancelMake()">取消预约</button></view>
</view>
<uni-popup ref="popup" class="finish-popup">
<view class="content">
<view class="title">图片上传</view>
<view><text class="tip">*</text>请上传使用期间图片</view>
<view class="upload-img" v-if="tempSceneImgs.length==0" @tap="uploadSceneImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempSceneImgs">
<image :src="img.path" @tap="previewImg(tempSceneImgs)" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveSceneImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempSceneImgs.length<3" class="btn" @tap="uploadSceneImg">
+ 添加照片
</view>
</view>
<view @click="submit" class="bottom">
确定
</view>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
import {
getDetailList,
Deleteid,
Update
} from '@/api/OneStopCommunity/appointment.js'
import {
uploadImg,
previewImg,
removeImg
} from "../common/uploadImg.js"
import {
baseUrl
} from "@/config.js";
import {
getDicts
} from '@/api/system/dict/data.js'
import {
toBackPage
} from "@/utils/toBack.js"
export default {
data() {
return {
current: 0,
dotStyles: {
width: 12,
backgroundColor: 'rgba(255, 255, 255, 0.4)',
border: '1px rgba(255, 255, 255, 0.4) solid',
color: '#fff',
selectedBackgroundColor: '#1890FF',
selectedBorder: '1px #1890FF solid'
},
swiperList: [],
tempSceneImgs: [],
rwPicture: "",
rtId: null,
detail: null,
auStatelist: [],
basePath: baseUrl,
submitlist: {
},
rtstatelist: [],
auditlist: {}
}
},
filters: {
formateAuStatus(val) {
if (val == 1) {
return "agree"
} else if (val == 2) {
return "refuse"
} else {
return "pending"
}
}
},
methods: {
change(e) {
this.current = e.detail.current;
},
updateMake() {
uni.navigateTo({
url: `./reservation?item=${JSON.stringify(this.detail)}`
})
},
cancelMake() {
uni.showModal({
title: "确定取消预约吗?",
success: async (bool) => {
if (bool.confirm) {
let res = await Deleteid(this.detail.rtId)
if (res.code == 200) {
uni.showToast({
title: "取消成功"
})
toBackPage(500)
}
}
}
})
},
finish() {
this.$refs.popup.open("center")
},
uploadSceneImg() {
uploadImg('/common/upload', this.rwPicture, this.tempSceneImgs, baseUrl, (error, result) => {
if (!error) {
this.rwPicture = result.photo
}
});
},
onRemoveSceneImg(index, path) {
removeImg(index, path, this.rwPicture, this.tempSceneImgs, baseUrl, (error, result) => {
if (!error) {
this.rwPicture = result.photo
}
});
},
previewImg(imgs) {
previewImg(imgs);
},
submit() {
if (this.rwPicture == "") {
uni.showToast({
title: "请上传使用图片",
icon: "none"
})
return;
}
uni.showModal({
title: "确定结束使用吗?",
success: async (bool) => {
if (bool.confirm) {
this.submitlist.rtImgs = this.rwPicture;
this.submitlist.rtId = this.detail.rtId;
this.submitlist.rtState = 2;
// this.submitlist.auditStatus=3
this.submitlist.staffOneStopRoomOpeningHoursList = this.detail.staffOneStopRoomOpeningHoursList
console.log(this.submitlist)
let res = await Update(this.submitlist)
this.$refs.popup.close()
if (res.code == 200) {
uni.showToast({
title: "提交成功"
})
}
toBackPage(500)
}
}
})
},
async getDetail() {
let res = await getDetailList(this.rtId);
if (res.code == 200) {
this.detail = res.data;
var split=[]
if(res.data.staffOneStopRoom[0].roomImgs!=null){
split = res.data.staffOneStopRoom[0].roomImgs.split(",")
}
this.swiperList = split
}
console.log(res)
},
async getstate() {
let res = await getDicts('rt_fu_audit_au_status')
this.auStatelist = res.data
},
async getRtstate() {
let res = await getDicts('routine_rtfureservation_rt_state')
this.rtstatelist = res.data
},
},
onLoad(option) {
this.rtId = option.rtId
this.getstate()
this.getRtstate()
this.getDetail()
},
onShow() {
}
}
</script>
<style lang="scss" scoped>
.detail {
background-color: rgba(244, 244, 244, .6);
.swiper-box {
width: 100%;
height: 600rpx;
border-radius: 16rpx;
overflow: hidden;
.swiper-item {
border-radius: 16rpx;
height: 600rpx;
image {
width: 100%;
height: 600rpx;
border-radius: 16rpx;
}
}
}
.content {
margin: 0rpx 40rpx;
.title {
display: flex;
justify-content: space-between;
text-align: center;
.title-a {
display: flex;
text {
font-size: 40rpx;
font-weight: 600;
font-family: PingFang SC;
}
.open-up {
width: 80rpx;
height: 32rpx;
background-color: #E7FAF0;
border: 1px #D0F5E0 solid;
margin-left: 20rpx;
font-size: 20rpx;
margin-top: 4rpx;
text-align: center;
margin-top: 6px;
color: #71E2A3;
}
}
.title-b {
display: flex;
font-size: 35rpx;
}
}
.introduction {
margin-top: 20rpx;
text {
line-height: 35rpx;
letter-spacing: 3rpx;
font-size: 24rpx;
color: #202020;
}
}
}
.time-zone {
width: 100%;
border-radius: 40rpx 40rpx 0rpx 0rpx;
background-color: #ffffff;
padding: 40rpx;
margin-top: 40rpx;
&>view:nth-child(1) {
font-size: 40rpx;
font-weight: 550;
}
&>view:nth-child(2) {
font-size: 32rpx;
margin-top: 30rpx;
margin-bottom: 84rpx;
&>view {
margin-top: 10rpx;
}
&>view>text:first-child {
color: #9C9C9C;
}
}
.button-a {
button {
color: #FFFFFF;
background-color: #1890FF;
}
}
.button-b {
display: flex;
justify-content: space-between;
&>view {
width: 46%;
}
&>view:nth-child(2)>button {
color: #FFFFFF;
background-color: #1890FF;
}
&>view:nth-child(1)>button {
color: #1890FF;
border: 1px solid #1890FF !important;
}
}
.finish-popup {
.content {
background-color: white;
border-radius: 16rpx;
width: 90vw;
&>view:nth-child(-n+3) {
margin: 40rpx 40rpx;
}
.title {
padding: 40rpx 0 20rpx;
display: flex;
justify-content: center;
font-size: 38rpx;
font-weight: 550;
}
.tip {
color: red;
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
.bottom {
background-color: #1890FF;
height: 88rpx;
line-height: 88rpx;
text-align: center;
color: white;
border-radius: 0 0 16rpx 16rpx;
margin-top: 100rpx;
}
}
}
.status {
.pending {
color: #FFBA00;
}
.refuse {
color: #FF9292;
}
.agree {
color: #71E2A3;
}
}
}
}
</style>

View File

@@ -0,0 +1,320 @@
<template>
<view class="index">
<view class="search">
<uni-search-bar placeholder="请输入房间名" @clear="clear" @cancel="cancel" @confirm="search"
v-model="queryParams.roomName">
</uni-search-bar>
</view>
<view style="height: 50rpx;width: 100%;"></view>
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
<view class="list">
<view class="box" v-for="(item,index) in list" :key="index" @click="detail(item)">
<view>
<view>
<text>{{item.roomName}}</text>
</view>
<view v-for="(tab,index) in rolelist" :key="index" v-show="item.auditStatus==tab.dictValue"
class="status">
{{tab.dictLabel}}
</view>
</view>
<view>
<view>
<image mode="aspectFill"
:src="basePath+item.staffOneStopRoom[0].roomImgs"></image>
</view>
<view>
<view><text>活动房</text><text>{{item.rtTheme}}</text></view>
<view><text>预约时间</text><text>{{item.rtTime}} {{item.rtTimePeriod}}</text></view>
<view>
<text>用途</text><text>{{item.rtPurpose}}</text>
</view>
<view><text>人数</text><text>{{item.rtPeople}}</text></view>
<view style="flex: 1;text-align: end;"><text>{{item.rtCreattime}} 提交</text><text
style="color: #1890FF;" @click="detail(item)">详情</text></view>
</view>
</view>
</view>
</view>
<view class="empty" v-if="list.length==0&&!topLoading">
<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&&list.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
</template>
<script>
import {
getDicts
} from '@/api/system/dict/data.js'
import {
listRoomReservation,
getDetailList,
listByUserName
} from '@/api/OneStopCommunity/appointment.js'
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
basePath: baseUrl,
list: [],
loading: false,
topLoading: true,
queryParams: {
pageNum: 1,
pageSize: 10,
roomName: ""
},
srclist: [],
rolelist: []
}
},
filters: {
formatPath(pathJSON) {
if (pathJSON.indexOf(',') !== -1) {
let arr = pathJSON.split(',');
return arr[0]
}else{
return pathJSON;
}
}
},
methods: {
cancel(res) {
this.queryParams.roomName = ""
this.getlist()
},
clear(res) {
this.queryParams.roomName = ""
this.getlist()
},
async getlist() {
let res = await listByUserName(this.queryParams)
var arr = res.rows
for (var i = 0; i < res.rows.length; i++) {
if(res.rows[i].staffOneStopRoom[0].roomImgs!=null){
var split = res.rows[i].staffOneStopRoom[0].roomImgs.split(",")
arr[i].staffOneStopRoom[0].roomImgs=split[0]
}else{
}
}
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.list = arr; // 如果是第一页,直接显示新数据
} else {
this.list = this.list.concat(arr); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
// console.log(res)
},
detail(item) {
uni.navigateTo({
url: `detail?rtId=${item.rtId}`
})
},
search() {
this.getlist()
},
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
//请求参数
this.getlist()
}, 1000)
} else {
}
},
async getrole() {
let res = await getDicts('rt_fu_audit_au_status')
this.rolelist = res.data
console.log(res.data)
}
},
onShow() {
this.getlist();
this.getrole();
},
}
</script>
<style lang="scss" scoped>
.index {
min-height: 100vh;
background-color: #F5F5F7;
// padding: 40rpx;
.search {
width: 100%;
background-color: white;
position: fixed;
z-index: 10;
top: 80rpx;
background-color: #F5F5F7;
/deep/ .uni-searchbar__box {
background-color: white !important;
}
}
.scroll-views {
height: calc(100vh - 10px);
.list {
padding: 24rpx;
.box {
width: 100%;
background-color: white;
border-radius: 16rpx;
position: relative;
padding: 30rpx 20rpx 20rpx 20rpx;
margin-top: 40rpx;
&>view:nth-child(1) {
&>view:nth-child(1) {
text {
font-size: 38rpx;
font-weight: 600;
}
}
.status {
position: absolute;
width: 20%;
height: 56rpx;
line-height: 56rpx;
border-radius: 0rpx 16rpx 0rpx 16rpx;
right: 0;
top: 0;
text-align: center;
align-content: center;
font-size: 24rpx;
font-weight: 600;
}
&>view:nth-child(2) {
background-color: #FFF8E6;
border: 1px solid #FFE399;
color: #FFBA00;
}
&>view:nth-child(3) {
background-color: #e7faf0;
border: 1px solid #D0F5E0;
color: #71E2A3;
}
&>view:nth-child(4) {
background-color: #FFDBDB;
border: 1px solid #FFEDED;
border-radius: 0rpx 16rpx 0rpx 16rpx;
color: #FF9292;
}
&>view:nth-child(5) {
background-color: #ebebec;
border: 1px solid #e9e9eb;
border-radius: 0rpx 16rpx 0rpx 16rpx;
color: #909399;
}
}
&>view:nth-child(2) {
width: 100%;
height: 334rpx;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin-top: 40rpx;
&>view:nth-child(1) {
width: 45%;
image {
width: 100%;
height: 334rpx;
}
}
&>view:nth-child(2) {
width: 52%;
height: 334rpx;
line-height: 50rpx;
display: flex;
flex-direction: column;
align-self: flex-start;
font-size: 26rpx;
&>view {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
}
&>view:last-child {
display: flex;
justify-content: space-between;
align-items: flex-end;
}
&>view>text:first-child {
color: #9C9C9C;
}
&>view>text:last-child {
color: black;
font-weight: 500;
}
}
}
}
}
.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;
}
}
}
}
</style>

View File

@@ -0,0 +1,453 @@
<template>
<view class="reservation">
<view style="padding: 40rpx;">
<form>
<view class="form-item">
<label>功能房</label>
<input type="text" v-model="list.roomName" disabled placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>主题</label>
<input type="text" v-model="formData.rtTheme" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>申请人</label>
<input type="text" v-model="formData.rtCreatRole" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>使用部门/学院</label>
<input type="text" v-model="formData.rtDepar" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>参与人数</label>
<input type="number" v-model="formData.rtPeople"
:placeholder="'当前功能房最大人数为'+list.staffOneStopRoom[0].roomCapacity+'人'"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>预约用途</label>
<picker range-key="dictLabel" :value="rangeIndex" :range="Reserveduse" @change="classChange">
<view class="uni-input">
<text v-if="Reserveduse.length" class="val">{{Reserveduse[rangeIndex].dictLabel}}</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>人员类型</label>
<picker mode="multiSelector" :value="typeValues" :range="rolelist" @change="typeChange">
<view class="uni-input">
<!-- 显示所有选中的值 -->
<text v-if="typeValues.length" class="val">
{{ typeValues.map(value => rolelist.find(item => item.dictLabel === value).dictLabel).join(', ') }}
</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
</form>
</view>
<view class="time-zone">
<view>
<view>
<text>开放时间</text>
</view>
<view>
<text style="color: red;">*</text>
<text>请点击下方时间段进行预约确认</text>
</view>
</view>
<view>
<view v-for="(item,index) in slotslist" :key="index">
<button @click="make(item,index)" :disabled="item.isOccupy==1"
:class="timeindex==index?'active':'dark'">{{item.openingHours}}</button>
</view>
</view>
<view>
<text>使用事项</text>
<view>
<text>{{list.roomMatter}}</text>
</view>
</view>
<view>
<button v-if="slotslist.length!=0" type="primary" :disabled="isSubmitting" class="submit-btn"
@tap="onSubmit">提交</button>
<button v-else type="primary" :disabled="true" class="submit-btn">当前功能房时间未开放</button>
</view>
</view>
</view>
</template>
<script>
import {
selectRtFuReservationTime,
updateRoomReservation,
addRoomReservation
} from '@/api/OneStopCommunity/room.js'
import {
getDetailList,
Update
} from '@/api/OneStopCommunity/appointment.js'
import {
getDicts
} from '@/api/system/dict/data.js'
import {
toBackPage
} from "@/utils/toBack.js"
export default {
data() {
return {
isSubmitting: false, //表单提交标志位
timeindex: null,
formData: {
rtTheme: "",
rtRole: "",
rtPurpose: "",
rtPeople: "",
rtTimePeriod: "",
rtCreatRole: "",
rtDepar: "",
roomName: "",
},
rangeIndex: 0,
typeIndex: 0,
roomNo: "",
rtTime: "",
list: {},
slotslist: [],
Reserveduse: [],
rolelist: []
}
},
methods: {
classChange(e) {
this.rangeIndex = e.detail.value;
},
typeChange(e) {
this.typeIndex = e.detail.value;
},
onSubmit() {
this.isSubmitting = true; // 设置为正在提交
if (this.timeindex == null) {
uni.showToast({
title: "请填写完整内容!",
icon: 'none' // 根据需要设置图标
});
this.isSubmitting = false;
return;
}
this.formData.rtPurpose = this.Reserveduse[this.rangeIndex].dictLabel;
this.formData.rtRole = this.rolelist[this.typeIndex].dictLabel;
this.formData.roomNo = this.list.roomNo
var arr = this.list.rtTimePeriod.split(" ")
this.formData.rtTime = this.list.rtTime
this.formData.rtTimePeriod = this.slotslist[this.timeindex].openingHours
this.formData.roomName = this.list.roomName
this.formData.rtNo = this.slotslist[this.timeindex].rtNo
this.formData.staffOneStopRoomOpeningHoursList = this.list.staffOneStopRoomOpeningHoursList
console.log(this.formData)
if (parseInt(this.formData.rtPeople) <= 0) {
uni.showToast({
title: "功能房参与人数不能小于0",
icon: 'none' // 根据需要设置图标
});
this.isSubmitting = false;
return;
}
if (parseInt(this.formData.rtPeople) > parseInt(this.list.staffOneStopRoom[0].roomCapacity)) {
uni.showToast({
title: "功能房最大人数为" + this.list.staffOneStopRoom[0].roomCapacity + "",
icon: 'none' // 根据需要设置图标
});
this.isSubmitting = false;
return;
}
for (let var2 in this.formData) {
if (this.formData[var2] == null || this.formData[var2] == '') {
uni.showToast({
title: "请填写完整内容!",
icon: 'none' // 根据需要设置图标
});
this.isSubmitting = false;
return; // 停止执行后续操作
}
}
this.add()
},
make(item, index) {
// this.formData.rtYuyue = item
this.timeindex = index
},
async getlist() {
let obj = {
roomNo: this.list.roomNo,
rtTime: this.list.rtTime
}
// console.log(obj)
let res = await selectRtFuReservationTime(obj)
console.log(res)
this.slotslist = res.data
},
async getReserved() {
let res = await getDicts('routine_rtfureservations_rt_purpose')
this.Reserveduse = res.data
},
async getrole() {
let res = await getDicts('routine_rtfureservation_rt_role')
this.rolelist = res.data
},
async add() {
this.formData.rtId = this.list.rtId
this.formData.auditStatus = 0
this.formData.rtState = 0
let res = await Update(this.formData)
console.log(res)
if (res.code == 200) {
uni.showToast({
title: "提交成功"
})
setTimeout(() => {
uni.redirectTo({
url: "../appointment/index"
})
}, 1000)
this.isSubmitting = false;
} else {
uni.showToast({
title: "已被预约",
icon: 'error'
})
this.isSubmitting = false;
}
},
async getDetail() {
let res = await getDetailList(this.list.rtId);
if (res.code == 200) {
this.detail = res.data;
}
},
},
onLoad(option) {
this.list = JSON.parse(option.item)
console.log(this.list)
this.formData.rtPurpose = this.list.rtDepar;
this.formData.rtRole = this.list.rtRole;
this.formData.roomName = this.list.roomName
this.formData.rtTheme = this.list.rtTheme
this.formData.rtCreatRole = this.list.rtCreatRole
this.formData.rtDepar = this.list.rtDepar
this.formData.rtPeople = this.list.rtPeople
this.getlist()
this.getReserved()
this.getrole()
this.getDetail()
},
}
</script>
<style lang="scss" scoped>
.reservation {
background-color: rgba(244, 244, 244, .6);
.form-item {
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.uni-icons {
opacity: .5;
font-weight: bold
}
label {
margin-bottom: 20rpx;
display: inline-block;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
.input-placeholder {
color: #b6b6b6;
}
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
border-radius: 10rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.time-zone {
width: 100%;
border-radius: 40rpx 40rpx 0rpx 0rpx;
background-color: #ffffff;
padding: 40rpx;
// margin-top: 10rpx;
&>view:nth-child(1) {
display: flex;
justify-content: space-between;
height: 65rpx;
text-align: center;
align-items: center;
&>view:nth-child(1) {
text {
font-size: 40rpx;
font-weight: 550;
}
}
&>view:nth-child(2) {
&>text:nth-child(2) {
font-size: 24rpx;
color: #202020;
opacity: .5;
}
}
}
&>view:nth-child(2) {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
view {
width: 30%;
margin: 10rpx;
button {
font-size: 24rpx;
}
button[disabled] {
height: 80rpx;
line-height: 80rpx;
color: #C1CCDF;
background-color: rgba(234, 241, 255, .8);
border-radius: 20rpx;
border: none;
}
.active {
height: 80rpx;
line-height: 80rpx;
border: 1px #1890FF solid;
background-color: #f9fbfc;
color: #ffffff;
background-color: #1890FF;
border-radius: 20rpx;
}
.dark {
height: 80rpx;
line-height: 80rpx;
border: 1px #1890FF solid;
background-color: #f9fbfc;
color: #1890FF;
border-radius: 20rpx;
}
}
}
&>view:nth-child(3) {
margin-top: 40rpx;
font-size: 24rpx;
color: rgba(32, 32, 32, .5);
line-height: 40rpx;
}
}
.submit-btn {
margin-top: 60rpx;
}
}
</style>

View File

@@ -0,0 +1,55 @@
import uploadFile from "@/plugins/upload.js";
import {
checkPic
} from "@/utils/checkPic.js"
export function uploadImg(uploadUrl, photo, tempImgs, baseUrl, callback) {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile(uploadUrl, img.tempFilePaths[0]).then((res) => {
let fileName = JSON.parse(res).fileName;
if (photo) {
photo += "," + fileName
} else {
photo = fileName
}
tempImgs.push({
path: baseUrl + fileName
});
// 调用回调函数
var Name = JSON.parse(res).newFileName
console.log(fileName)
callback && callback(null, {
fileName,
Name,
photo,
tempImgs
});
})
}
},
fail: (error) => {}
});
}
export function previewImg(imgs) {
let urls = [];
urls = imgs.map(img => img.path);
uni.previewImage({
urls: urls
})
}
export function removeImg(index,path,photo,tempImgs,baseUrl,callback) {
tempImgs.splice(index, 1);
let newImgs = tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
photo = newImgs;
// 调用回调函数
callback && callback(null, {
photo
});
}

View File

@@ -0,0 +1,310 @@
<template>
<view class="add-complaint">
<view class="form-item">
<label><text>*</text> 联系人</label>
<input type="text" placeholder="请输入" v-model="formData.contact" />
</view>
<view class="form-item">
<label><text>*</text> 联系电话</label>
<input type="number" maxlength="11" placeholder="请输入" v-model="formData.contactNumber" />
</view>
<view class="form-item">
<label><text>*</text> 关键词</label>
<input type="text" placeholder="请输入" v-model="formData.keyWords" />
</view>
<view class="form-item">
<label>问题描述</label>
<textarea type="text" placeholder="请输入" v-model="formData.desc" />
</view>
<view class="form-item">
<label><text>*</text>照片</label>
<view class="upload-img" v-if="tempImgs.length==0" @tap="uploadImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempImgs">
<image @tap="previewImg(tempImgs)" :src="img.path" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempImgs.length<3" class="btn" @tap="uploadImg">
+ 添加照片
</view>
</view>
</view>
<view class="btns">
<button @click="onSubmit" :disabled="isSubmitting">提交</button>
</view>
</view>
</template>
<script>
import {
uploadImg,
previewImg,
removeImg
} from "@/utils/uploadImg.js"
import uploadFile from "@/plugins/upload.js";
import {
checkPic
} from "@/utils/checkPic.js";
import {
baseUrl
} from "@/config.js";
import {
complaintAdd
} from '@/api/OneStopCommunity/complaint.js'
export default {
data() {
return {
isSubmitting: false,
tempImgs: [],
formData: {
contact: "",
contactNumber: "",
keyWords: "",
photos: "",
}
}
},
methods: {
onSubmit() {
var reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if(!reg_tel.test(this.formData.contactNumber)){
uni.showToast({
title: `请正确填写您的手机号码`,
icon: "none"
})
return;
}
const requiredFields = [
'contact',
'contactNumber',
'keyWords',
//'photos',
];
const emptyField = requiredFields.find(field => this.formData[field] === "");
if (emptyField) {
uni.showToast({
title: `请填写完 * 必填内容`,
icon: "none"
})
return;
}
this.isSubmitting = true; // 设置为正在提交
console.log(this.formData);
uni.showLoading({
title: "正在提交",
success: async () => {
let res = await complaintAdd(this.formData);
if (res.code == 200) {
uni.showToast({
title: "提交成功"
})
this.isSubmitting = false;
uni.navigateBack({
success: () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const prevPage = pages[pages.length - 2]
if (prevPage && typeof prevPage
.getlist ===
'function') {
prevPage.queryParams.pageNum = 1;
prevPage.getlist();
}
}
}
})
}
}
})
},
uploadImg() {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
if (this.formData.photos !== "") {
this.formData.photos = this.formData.photos + "," + JSON.parse(res)
.fileName;
} else {
this.formData.photos = JSON.parse(res).fileName;
}
this.tempImgs.push({
path: baseUrl + JSON.parse(res).fileName
});
})
}
}
})
},
onRemoveImg(index, path) {
this.tempImgs.splice(index, 1);
let newImgs = this.tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
this.formData.photos = newImgs;
},
previewImg(imgs) {
previewImg(imgs);
}
}
}
</script>
<style lang="scss" scoped>
.add-complaint {
background-color: #F5F5F7;
padding: 10px;
padding-bottom: 80px;
.form-item {
display: flex;
flex-direction: column;
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.tip {
color: red;
font-size: 24rpx;
}
label {
margin-bottom: 20rpx;
display: inline-block;
text {
color: red;
}
}
textarea {
height: 200rpx;
border: 1px solid #E1E1E1;
padding: 20rpx;
width: 100%;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.btns {
padding: 10px;
display: flex;
background: white;
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 999;
button {
flex: 1;
background-color: #1890FF;
color: white;
}
}
}
</style>

View File

@@ -0,0 +1,171 @@
<template>
<view class="detail" v-if="detail!=null">
<view class="feedback-info">
<view class="title">
<text>处理反馈</text>
<text v-if="detail.status==1" class="processed">已处理</text>
<text v-else class="pending">待处理</text>
</view>
<view v-if="detail.status==1">
<!-- 你反馈的问题已经处理设备已进行升级 -->
{{detail.feedback}}
</view>
<view v-else>
你反馈的问题正在处理中请耐心等待~~~
</view>
</view>
<view class="submit-info">
<view class="title">
<text>提交信息</text>
</view>
<view>
<text>联系人:</text>
<text>{{detail.contact}}</text>
</view>
<view>
<text>联系电话:</text>
<text>{{detail.contactNumber}}</text>
</view>
<view>
<text>关键词:</text>
<text>{{detail.keyWords}}</text>
</view>
<view>
<text>问题反馈:</text>
<text>{{detail.desc}}</text>
</view>
<view>
<text>照片:</text>
<view class="photos">
<image @tap="previewImg(photoUrls,index)" v-for="(img,index) in photoUrls" :src="basePath+img"
mode="aspectFill"></image>
</view>
</view>
</view>
</view>
</template>
<script>
import {
complaintDetail
} from '@/api/OneStopCommunity/complaint.js';
import {
baseUrl
} from "@/config.js";
import {
previewImg
} from "@/utils/uploadImg.js"
export default {
data() {
return {
detail: null,
id: "",
photoUrls: [],
basePath: baseUrl
}
},
onLoad(option) {
this.id = option.id;
this.getDetail();
},
methods: {
async getDetail() {
let res = await complaintDetail(this.id)
if (res.code == 200) {
this.detail = res.data;
if (this.detail.photos != null) {
this.photoUrls = this.detail.photos.split(',');
}
}
},
previewImg(imgs,index) {
let images = imgs.map(img => {
return {
path: baseUrl + img
}
})
previewImg(images,index);
}
}
}
</script>
<style scoped lang="scss">
.detail {
background-color: #F5F5F7;
padding: 40rpx;
height: calc(100vh - 44px);
.feedback-info {
padding: 40rpx;
border-radius: 20rpx;
background-color: white;
.title {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 26rpx;
margin-bottom: 26rpx;
border-bottom: 1px solid #F5F5F7;
text:first-child {
font-weight: bold;
}
text:last-child {
padding: 4rpx 10rpx;
}
.processed {
border: 1px solid #D0F5E0;
color: #71E2A3;
background-color: #E7FAF0;
}
.pending {
border: 1px solid #FFE399;
color: #FFBA00;
background-color: #FFF8E6;
}
}
}
.submit-info {
margin-top: 40rpx;
border-radius: 20rpx;
padding: 40rpx;
background-color: white;
&>view {
margin-bottom: 20rpx;
}
.photos {
margin-top: 10rpx;
display: flex;
flex-wrap: wrap;
image {
margin-bottom: 10rpx;
width: 23.5%;
border-radius: 8rpx;
height: 136rpx;
&:not(:nth-child(4n)) {
margin-right: 2%;
}
}
}
.title {
font-weight: bold;
padding-bottom: 15rpx;
margin-bottom: 15rpx;
border-bottom: 1px solid #F5F5F7;
}
}
}
</style>

View File

@@ -0,0 +1,243 @@
<template>
<view class="index">
<view class="search">
<uni-search-bar @confirm="search" cancelButton="none" :focus="true" @clear="onClear" v-model="queryParams.keyWords">
</uni-search-bar>
</view>
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
<view class="list">
<view v-for="(item,index) in list" :key="index" @click="detail(item)" class="box">
<view>
<view>提交时间{{item.createTime}}</view>
<view v-if="item.status==1" class="active">已处理</view>
<view v-else class="staydark">待处理</view>
</view>
<view>
<text>关键词</text>
<text>{{item.keyWords}}</text>
</view>
<view>
<text>联系人</text>
<text>{{item.contact}}</text>
</view>
<view>
<text>联系电话</text>
<text>{{item.contactNumber}}</text>
</view>
<view>
<text>问题反馈</text>
<text>{{item.desc}}</text>
</view>
</view>
</view>
<view class="empty" v-if="list.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&&list.length!=0">
到底啦~~
</view>
</scroll-view>
<view class="add" @tap="addComplaint">
+
</view>
</view>
</template>
<script>
import {
complaintList
} from '@/api/OneStopCommunity/complaint.js'
export default {
data() {
return {
list: [],
loading: false,
topLoading: true,
totalPages:0,
queryParams: {
pageNum: 1,
pageSize: 10,
keyWords:"",
createId:uni.getStorageSync("stuId")
}
}
},
onLoad() {
this.getlist();
},
methods: {
scrolltolower() {
console.log(this.totalPages);
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
//请求参数
this.getlist()
}, 1000)
} else {
}
},
search(res) {
this.queryParams.pageNum = 1;
this.getlist()
},
onClear(){
this.queryParams.pageNum = 1;
this.queryParams.keyWords="";
this.getlist();
},
addComplaint(){
uni.navigateTo({
url:"./add"
})
},
async getlist() {
let res = await complaintList(this.queryParams)
if (res.code == 200) {
this.loading = false;
console.log(this.queryParams.pageNum);
if (this.queryParams.pageNum == 1) {
this.list = res.rows; // 如果是第一页,直接显示新数据
}else {
this.list = this.list.concat(res.rows); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
},
detail(item){
uni.navigateTo({
url:"./detail?id="+item.id
})
}
}
}
</script>
<style scoped lang="scss">
.index {
background-color: #F5F5F7;
min-height: 100vh;
.search {
margin-top:5rpx;
width: 100%;
background-color: white;
position: fixed;
z-index: 10;
top: 80rpx;
padding: 0rpx 8rpx;
background-color: #F5F5F7;
/deep/ .uni-searchbar__box {
background-color: white !important;
}
}
.scroll-views {
height: calc(100vh - 10px);
.list {
margin-top: 100rpx;
padding: 24rpx;
&>view:nth-child(n+2) {
margin-top: 30rpx;
}
.box {
width: 100%;
// height: 364rpx;
padding: 20rpx 40rpx;
border-radius: 16rpx;
background-color: white;
font-size: 28rpx;
&>view {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
}
&>view:nth-child(1) {
display: flex;
justify-content: space-between;
&>view:last-child {
padding: 8rpx 10rpx;
font-size: 22rpx;
}
.active {
background-color: #E7FAF0;
border: 1px solid #D0F5E0;
color: #71E2A3;
}
.staydark {
background-color: #FFF8E6;
border: 1px solid #FFE399;
color: #FFBA00;
}
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
&>view:nth-child(n+2) {
line-height: 50rpx;
}
}
}
.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;
}
}
}
.add {
background-color: #1890FF;
width: 90rpx;
height: 90rpx;
border-radius: 50%;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-size: 60rpx;
position: fixed;
bottom: 50px;
right: 25px;
}
}
</style>

View File

@@ -0,0 +1,262 @@
<template>
<view class="detail">
<!-- 轮播图区域 -->
<view style="margin: 40rpx;">
<uni-swiper-dot :info="swiperlist" :current="current" :dots-styles="dotStyles" field="content" mode="round">
<swiper interval="2000" autoplay class="swiper-box" @change="change">
<swiper-item v-for="(item, index) in list.roomImgs" :key="index">
<view class="swiper-item">
<image mode="aspectFill" :src="basePath+item"></image>
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</view>
<!-- 房间信息区域 -->
<view class="content">
<view class="title">
<view class="title-a">
<text>{{list.roomName}}</text>
<view v-for="(tab,index) in rolelist" :key="index" v-if="list.status==tab.dictValue"
:class="[list.status==0?'open-up':'',list.status==1?'shutdown':'',list.status==2?'maintenance':'']">
{{tab.dictLabel}}
</view>
</view>
<view class="title-b">
<uni-icons color="#FFBB12" type="staff-filled" size="24"></uni-icons>
<text>{{list.roomCapacity}}/</text>
</view>
</view>
<view class="introduction">
<text>{{list.roomInfo}}</text>
</view>
</view>
<!-- 时间选择区域 -->
<view class="time-zone">
<view class="time-header">
<text>开放时间</text>
<text><text style="color: red;">*</text>请选择日期进行预约</text>
</view>
<!-- 日历组件 -->
<uni-calendar
:insert="true"
:lunar="true"
:start-date="startDate"
:end-date="endDate"
:selected="selectedDates"
@change="onCalendarChange"
/>
<view class="usage-matters">
<text>使用事项</text>
<text>{{list.roomMatter}}</text>
</view>
</view>
</view>
</template>
<script>
import { getRoom } from '@/api/OneStopCommunity/room.js';
import { getDicts } from '@/api/system/dict/data.js';
import { baseUrl } from "@/config.js";
export default {
data() {
return {
basePath: baseUrl,
swiperlist: [],
list: [],
current: 0,
dotStyles: {
width: 12,
backgroundColor: 'rgba(255, 255, 255, 0.4)',
border: '1px rgba(255, 255, 255, 0.4) solid',
color: '#fff',
selectedBackgroundColor: '#1890FF',
selectedBorder: '1px #1890FF solid'
},
id: "",
rolelist: [],
startDate: this.getTodayDate(),
endDate: this.getFourteenDaysLaterDate(),
selectedDates: []
};
},
onLoad(option) {
this.id = option.id;
Promise.all([
this.getRoomdetail(),
this.getstate()
]).catch(error => {
console.error('初始化失败:', error);
uni.showToast({ title: '数据加载失败', icon: 'none' });
});
},
methods: {
change(e) {
this.current = e.detail.current;
},
async getRoomdetail() {
try {
const res = await getRoom(this.id);
if (res.code === 200) {
this.list = res.data;
this.list.roomImgs = this.list.roomImgs ? this.list.roomImgs.split(",") : [];
this.swiperlist = this.list.roomImgs.map(img => this.basePath + img);
}
} catch (error) {
throw error;
}
},
async getstate() {
try {
const res = await getDicts('rt_fu_room_status');
this.rolelist = res.data;
} catch (error) {
throw error;
}
},
getTodayDate() {
const today = new Date();
return `${today.getFullYear()}-${String(today.getMonth()+1).padStart(2,'0')}-${String(today.getDate()).padStart(2,'0')}`;
},
getFourteenDaysLaterDate() {
const date = new Date();
date.setDate(date.getDate() + 14);
return `${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,'0')}-${String(date.getDate()).padStart(2,'0')}`;
},
onCalendarChange(e) {
uni.navigateTo({
url: `./reservation?rtTime=${e.fulldate}&list=${JSON.stringify(this.list)}`
});
}
}
};
</script>
<style lang="scss" scoped>
.detail {
background-color: rgba(244, 244, 244, 0.6);
padding-bottom: 40rpx;
.swiper-box {
width: 100%;
height: 600rpx;
border-radius: 16rpx;
overflow: hidden;
.swiper-item {
height: 600rpx;
image {
width: 100%;
height: 100%;
border-radius: 16rpx;
}
}
}
.content {
margin: 0 40rpx;
.title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.title-a {
display: flex;
align-items: center;
text {
font-size: 40rpx;
font-weight: 600;
font-family: PingFang SC;
}
.open-up, .shutdown, .maintenance {
margin-left: 20rpx;
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 8rpx;
}
.open-up {
background-color: #E7FAF0;
border: 1px solid #D0F5E0;
color: #71E2A3;
}
.shutdown {
background-color: #FFEDED;
border: 1px solid #FF9292;
color: #FF9292;
}
.maintenance {
background-color: #eeeeee;
border: 1px solid #cfcfcf;
color: #818181;
}
}
.title-b {
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
uni-icons {
margin-right: 8rpx;
}
}
}
.introduction {
font-size: 28rpx;
color: #555;
line-height: 1.6;
}
}
.time-zone {
background-color: #fff;
border-radius: 40rpx 40rpx 0 0;
padding: 40rpx;
margin-top: 40rpx;
.time-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
text:first-child {
font-size: 36rpx;
font-weight: 550;
}
text:last-child {
font-size: 24rpx;
color: #999;
}
}
.usage-matters {
margin-top: 40rpx;
font-size: 28rpx;
color: #666;
text:first-child {
font-weight: bold;
margin-right: 10rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,495 @@
<template>
<view class="functionhouse">
<scroll-view class="nav-scroll" scroll-x="true">
<view class="navs">
<text @tap="tabChange(item,index)" :class="[tabIndex==index?'active':'']" v-for="(item,index) in tabs"
:key="index">{{item}}</text>
</view>
<view class="notices">
<uni-notice-bar @click="toggle()" show-icon scrollable :text="noticeText" color="#202020"
background-color="white" />
</view>
<view class="search">
<uni-search-bar cancel-text="搜索" placeholder="请输入房间名" @clear="clear" @cancel="search" @confirm="search"
show-action v-model="queryParams.roomName">
</uni-search-bar>
</view>
</scroll-view>
<view style="padding-bottom: 300rpx;"></view>
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
<view class="list">
<view v-for="(item,index) in list" :key="index" class="item" @tap="toDetailPage(item)">
<image :src="basePath+item.roomImgs"></image>
<!-- <image v-else></image> -->
<view class="box">
<view class="title">
<text>{{item.roomName}}</text>
<view v-for="(tab,index) in rolelist" :key="index" v-if="item.roomStatus==tab.dictValue"
:class="[item.roomStatus==1?'open-up':'',item.roomStatus==0?'shutdown':'',item.roomStatus==2?'maintenance':'']"
style="">{{tab.dictLabel}}</view>
</view>
<view>
<text class="introduction">{{item.roomInfo}}</text>
</view>
<view class="bottom">
<view style="display: flex;">
<view>
<uni-icons color="#FFBB12" type="staff-filled" size="21"></uni-icons>
</view>
<view>
<text>{{item.roomCapacity}}/</text>
</view>
</view>
<view>
<text>
详情
</text>
<uni-icons color="#272636" type="forward" size="16"></uni-icons>
</view>
</view>
</view>
</view>
</view>
<view class="empty" v-if="list.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&&list.length!=0">
到底啦~~
</view>
</scroll-view>
<uni-popup ref="popup">
<view class="container">
<view class="title">
<text>
学生社区简介
</text>
</view>
<view class="introduction">
<text class="introduction-1">
一站式学生社区欢迎你~~
</text>
<view class="introduction-a">
<view>
<text>联系电话0771-2033319</text>
</view>
<view>
<text>QQ2848561721</text>
</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
listRoom
} from '@/api/OneStopCommunity/room.js';
import {
getDicts
} from '@/api/system/dict/data.js';
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
basePath: baseUrl,
topLoading: true,
loading: false,
tabs: ["全部", "开放中", "关闭中"],
tabIndex: 0,
noticeText: "一站式社区欢迎你 ",
queryParams: {
pageNum: 1,
pageSize: 10,
roomStatus: ""
},
list: [
],
rolelist: [],
imgsrc: ""
}
},
methods: {
cancel(res) {
this.queryParams.roomName = ""
this.getlist()
},
clear(res) {
this.queryParams.roomName = ""
this.search() // 直接调用统一的搜索方法 知无涯
},
search() {
// 重置为第一页并清空当前列表 知无涯
this.queryParams.pageNum = 1
this.list = [] // 清空现有数据 知无涯
this.topLoading = true // 显示顶部加载状态 知无涯
this.getlist()
},
toggle() {
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
this.$refs.popup.open("center")
},
tabChange(item, index) {
this.tabIndex = index;
switch (item) {
case "全部":
this.queryParams.roomStatus = ""
this.getlist()
break;
case "开放中":
this.queryParams.roomStatus = 1
this.getlist()
break;
case "关闭中":
this.queryParams.roomStatus = 0
this.getlist()
break;
default:
}
},
//详情
toDetailPage(item) {
console.log(item)
uni.navigateTo({
url: `./detail?id=${item.roomId}`
})
},
scrolltolower() {
if (!this.loading && this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++
this.loading = true
this.getlist()
}
},
async getlist() {
let res = await listRoom(this.queryParams)
if (res.code == 200) {
// 处理图片数据 知无涯
const arr = res.rows.map(item => {
return {
...item,
roomImgs: item.roomImgs ? item.roomImgs.split(",")[0] : null
}
})
// 统一处理数据追加逻辑 知无涯
this.list = this.queryParams.pageNum === 1 ?
arr : [...this.list, ...arr]
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize)
this.loading = false
this.topLoading = false
}
},
async getstate() {
let res = await getDicts('rt_fu_room_status')
this.rolelist = res.data
console.log(res.data)
},
},
onShow() {
this.getlist()
this.getstate()
},
}
</script>
<style lang="scss" scoped>
.functionhouse {
background-color: #F5F5F7;
.search {
width: 100%;
background-color: white;
// position: fixed;
z-index: 10;
// top: 80rpx;
// background-color: #F5F5F7;
/deep/ .uni-searchbar__box {
// .uni-searchbar__box
// background-color: white !important;
}
}
.nav-scroll {
position: fixed;
white-space: nowrap;
width: 100%;
background-color: white;
z-index: 2;
.navs {
padding: 26rpx 47rpx;
text {
font-size: 28rpx;
margin-right: 55rpx;
color: #202020;
opacity: 0.5;
&.active {
opacity: 1;
font-weight: bold;
border-bottom: 5px solid #1890FF;
padding-bottom: 2px;
}
}
}
.notices {
border-top: 1px solid #ECF1F7;
/deep/ .uni-icons {
color: #1890FF !important;
}
.uni-noticebar {
margin-bottom: 0;
}
}
scroll-view {
position: fixed;
z-index: 2;
}
}
.scroll-views {
height: calc(100vh - 10px);
.list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: flex-start;
padding: 0rpx 24rpx;
.item {
width: 48%;
// width: 324rpx;
// height: 480rpx;
background-color: white;
border-radius: 20rpx;
&:nth-child(n+3) {
// background-color: #202020 !important;
margin-top: 20rpx;
}
.box {
padding: 20rpx 20rpx;
.introduction {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
font-size: 26rpx;
word-spacing: 4rpx;
letter-spacing: 4rpx;
color: #202020;
opacity: .5;
margin-top: 20rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
margin-top: 34rpx;
}
}
image {
border-radius: 20rpx 20rpx 0rpx 0rpx;
width: 100%;
height: 300rpx;
}
.title {
display: flex;
justify-content: space-between;
text {
font-family: PingFang SC;
font-size: 32rpx;
font-weight: 700;
}
}
}
}
.no-more {
text-align: center;
color: gray;
padding-bottom: 10px;
padding-top: 20rpx;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 200rpx;
color: #9E9E9E;
font-size: 36rpx;
image {
width: 250rpx;
margin-bottom: 50rpx;
}
}
}
.container {
width: 60vw;
height: 400rpx;
border-radius: 20rpx;
background-color: white;
padding: 20rpx 30rpx;
.title {
text-align: center;
font-size: 40rpx;
font-weight: 700;
}
.introduction {
margin-top: 40rpx;
padding-top: 20rpx;
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 500;
height: 300rpx;
border-top: 1px solid silver;
.introduction-1 {
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.introduction-a {
margin-top: 40rpx;
font-size: 28rpx;
color: #787878;
&>view {
margin-bottom: 20rpx;
}
}
}
}
/* 搜索框外层容器样式 知无涯 */
.search {
width: 100%; // 宽度100%撑满父容器
background-color: white; // 白色背景
padding: 10rpx 24rpx; // 内边距上下10rpx左右24rpx
display: flex; // 启用flex布局
align-items: center; // 子元素垂直居中
/* 深度选择器(穿透组件样式) */
/deep/ .uni-searchbar {
flex: 1; // 占据剩余空间
display: flex; // 启用flex布局
align-items: center; // 子元素垂直居中
/* 搜索输入框样式 */
&__box {
flex: 1; // 占据剩余空间
display: flex; // 启用flex布局
align-items: center; // 子元素垂直居中
background-color: white !important; // 强制白色背景
border: 1px solid #1890FF !important; // 蓝色边框
border-radius: 30rpx; // 30rpx圆角
height: 60rpx; // 固定高度60rpx
}
/* 占位符文本样式 */
&__text-placeholder {
color: #999 !important; // 浅灰色文字
}
/* 搜索按钮样式 */
&__cancel {
background-color: #1890FF !important; // 蓝色背景
color: white !important; // 白色文字
border-radius: 20rpx; // 30rpx圆角
height: 60rpx; // 高度与输入框保持一致
line-height: 60rpx; // 行高=高度实现垂直居中
font-size: 28rpx; // 文字大小
margin-left: 5rpx; // 与输入框的间距
min-width: 75rpx; // 最小宽度(避免文字过短时变形)
/* 按钮点击态效果 */
&:active {
background-color: #1070CC !important; // 点击时变为深蓝色
}
}
}
}
.open-up {
width: 80rpx;
height: 32rpx;
background-color: #E7FAF0;
border: 1px #D0F5E0 solid;
color: #71E2A3;
font-size: 20rpx;
margin-top: 4rpx;
text-align: center;
}
.shutdown {
width: 80rpx;
height: 35rpx;
line-height: 35rpx;
background-color: #FFEDED;
border: 1px #FF9292 solid;
color: #FF9292;
font-size: 20rpx;
margin-top: 4rpx;
text-align: center;
}
.maintenance {
width: 80rpx;
height: 35rpx;
line-height: 35rpx;
background-color: #eeeeee;
border: 1px #cfcfcf solid;
color: #818181;
font-size: 20rpx;
margin-top: 4rpx;
text-align: center;
}
}
</style>

View File

@@ -0,0 +1,211 @@
<template>
<u-popup :show="pickShow" mode="bottom" :round="10" closeOnClickOverlay @close="onCancel">
<view class="multiple-pick-content">
<view class="top">
<view class="cancel" @tap="onCancel">取消</view>
<view class="confirm" @tap="onConfirm">确认</view>
</view>
<view class="list-container">
<view class="item-container">
<view class="item" :class="{'selected': isSelected(item), 'disabled': isDisabled(item)}"
v-for="(item, index) in list" :key="index" @tap="onClick(item, index)">
<view>
{{ keyName ? item[keyName] : item }}
</view>
<u-icon v-if="isSelected(item)" name="checkmark" :color="isDisabled(item) ? '#959595' : '#2979ff'"
size="18"></u-icon>
</view>
</view>
</view>
</view>
</u-popup>
</template>
<script>
export default {
name: "multiplePick",
components: {UIcon, UPopup},
data() {
return {
pickShow: false,
selecteds: []
};
},
props: {
/**
* 开启单选
*/
single: Boolean,
/**
* 可选最多项
*/
max: Number,
/**
* 超出最大项提示
*/
maxMessage: String,
/**
* 数据集合
*/
list: Array,
/**
* 默认选择
*/
defaults: Array,
/**
* 主键名,如果没有,则识别为字符串数组
*/
keyName: String,
/**
* 禁用属性名前提是有keyName
*/
disabledKey: String,
/**
* 禁用值前提是有disabledKey
*/
disabledValue: String
},
watch: {
defaults: {
handler(n) {
// 不能直接赋值否则selecteds变化时会改变默认值
this.selecteds = n.slice(0, n.length);
},
immediate: true
}
},
methods: {
/**
* 当前项是否禁用
*/
isDisabled(item) {
return this.keyName && this.disabledKey && this.disabledValue && item[this.disabledKey] === this.disabledValue;
},
/**
* 当前项是否选中
*/
isSelected(item) {
return this.selecteds.includes(this.keyName ? item[this.keyName] : item);
},
/**
* 打开选择器
*/
show() {
this.pickShow = true;
},
/**
* 关闭选择器
*/
close() {
this.pickShow = false;
},
/**
* 数据项点击监听
*/
onClick(item, index) {
if (this.isDisabled(item)) {
// 如果是禁用的,不执行
return;
}
// 获取当前项值
const value = this.keyName ? item[this.keyName] : item;
if (this.single) {
// 开启单选
this.selecteds = [];
this.selecteds.push(value);
} else {
// 获取当前项在已选中的集合中的位置
const i = this.selecteds.indexOf(value);
// 存在则删除,不存在则添加
if (i !== -1) {
this.selecteds.splice(i, 1);
} else {
if (this.max && this.selecteds.length >= this.max) {
// 如果有最大值且已选超过最大值
if (this.maxMessage) {
// 有提示提示内容
uni.showToast({
icon: 'none',
title: this.maxMessage
});
return;
}
// 否则删掉最旧的数据
this.selecteds.shift();
}
this.selecteds.push(value);
}
}
},
/**
* 确认按钮事件
*/
onConfirm() {
this.$emit('confirm', this.selecteds);
},
/**
* 取消按钮事件
*/
onCancel() {
// 重新赋值选中的集合
this.selecteds = this.defaults.slice(0, this.defaults.length);
this.pickShow = false;
this.$emit('cancel');
}
}
}
</script>
<style lang="scss" scoped>
.multiple-pick-content {
padding: 20px;
box-sizing: border-box;
min-height: 200px;
max-height: 50vh;
.top {
padding: 0 0 10px 0;
width: 100%;
display: flex;
justify-content: space-between;
line-height: 32px;
.cancel {
color: #f43d18;
}
.confirm {
color: #0066ff;
}
}
.list-container {
padding: 10px 0px 40px 0px;
box-sizing: border-box;
max-height: calc(50vh - 42px);
height: 100%;
overflow-y: auto;
}
.item-container {
width: 100%;
.item {
padding: 10px 0;
box-sizing: border-box;
width: 100%;
display: flex;
justify-content: space-between;
&.selected {
color: #2979ff !important;
}
&.disabled {
color: #959595 !important;
}
}
}
}
</style>

View File

@@ -0,0 +1,511 @@
<template>
<view class="reservation">
<view class="form-container">
<form>
<view class="form-item">
<label>功能房</label>
<input type="text" v-model="list.roomName" disabled placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>主题</label>
<input type="text" v-model="formData.rtTheme" placeholder="请输入活动主题" placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>申请人</label>
<input type="text" v-model="formData.rtCreatRole" placeholder="请输入申请人姓名" placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>使用部门/学院</label>
<picker mode="selector" :range="deptXZJGList" @change="handleDeptChange">
<view class="picker">
{{ formData.rtDepar || '请选择' }}
</view>
</picker>
</view>
<view class="form-item">
<label>参与人数</label>
<input type="number" v-model="formData.rtPeople" :placeholder="'最多可容纳'+list.roomCapacity+'人'" placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>预约用途</label>
<picker range-key="dictLabel" :value="rangeIndex" :range="Reserveduse" @change="classChange">
<view class="uni-input">
<text v-if="Reserveduse.length" class="val">{{Reserveduse[rangeIndex].dictLabel}}</text>
<text v-else class="placeholder">请选择预约用途</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>人员类型</label>
<view class="trigger" @click="showDrawer = true">
<view class="uni-input">
<text v-if="selectedRoles.length">{{ selectedRoles.join(", ") }}</text>
<text v-else class="placeholder">请选择人员类型</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</view>
</view>
</form>
</view>
<view class="time-selection">
<view class="time-header">
<text>选择时间段</text>
<text><text style="color: red;">*</text>请选择可用时间段</text>
</view>
<view class="time-slots">
<view v-for="(item,index) in slotslist" :key="index" class="slot-item">
<button @click="selectTimeSlot(item,index)"
:disabled="item.isOccupy==1"
:class="{
'active': timeindex===index,
'disabled': item.isOccupy==1,
'warning': formData.rtPeople > list.roomCapacity
}">
{{item.openingHours}}
</button>
</view>
</view>
<view class="usage-matters">
<text>使用事项</text>
<text>{{list.roomMatter}}</text>
</view>
<button type="primary"
:disabled="isSubmitting || !isFormValid"
class="submit-btn"
@tap="onSubmit">
{{isSubmitting ? '提交中...' : '提交预约'}}
</button>
</view>
<!-- 人员类型选择抽屉 -->
<view v-if="showDrawer" class="drawer-overlay" @click="showDrawer = false"></view>
<view v-if="showDrawer" class="drawer">
<view class="drawer-header">
<text>选择人员类型</text>
<text class="drawer-close" @click="showDrawer = false">完成</text>
</view>
<view class="drawer-body">
<uni-data-checkbox
:multiple="true"
v-model="selectedRoles"
mode="tag"
:map="{text:'dictLabel',value:'dictValue'}"
:localdata="rolelist">
</uni-data-checkbox>
</view>
</view>
</view>
</template>
<script>
import {
selectRtFuReservationTime,
addRoomReservation,
getXZJGDept
} from '@/api/OneStopCommunity/room.js';
import { getDicts } from '@/api/system/dict/data.js';
export default {
data() {
return {
showDrawer: false,
selectedRoles: [],
isSubmitting: false,
timeindex: null,
formData: {
rtTheme: "",
rtCreatRole: "",
rtDepar: "",
rtPeople: "",
},
rangeIndex: 0,
roomNo: "",
rtTime: "",
list: {},
slotslist: [],
Reserveduse: [],
rolelist: [],
deptXZJGList: []
};
},
computed: {
isFormValid() {
return (
this.formData.rtTheme &&
this.formData.rtCreatRole &&
this.formData.rtDepar &&
this.formData.rtPeople > 0 &&
this.formData.rtPeople <= this.list.roomCapacity &&
this.Reserveduse.length > 0 &&
this.selectedRoles.length > 0 &&
this.timeindex !== null
);
}
},
methods: {
handleDeptChange(e) {
this.formData.rtDepar = this.deptXZJGList[e.detail.value];
},
classChange(e) {
this.rangeIndex = e.detail.value;
},
selectTimeSlot(item, index) {
this.timeindex = index;
},
async getXZJGDeptList() {
try {
const res = await getXZJGDept();
//二级学院排列位置调整
let depts = res.data;
let quList = depts.slice(14,25)
depts.splice(14,11);
depts.splice(0, 0, ...quList);
this.deptXZJGList = depts;
//this.deptXZJGList = res.data;
} catch (error) {
console.error('获取部门列表失败:', error);
uni.showToast({ title: '获取部门列表失败', icon: 'none' });
}
},
async getlist() {
try {
const res = await selectRtFuReservationTime({
roomNo: this.list.roomNo,
rtTime: this.rtTime
});
this.slotslist = res.data || [];
} catch (error) {
console.error('获取时间段失败:', error);
uni.showToast({ title: '获取可用时间段失败', icon: 'none' });
}
},
async getReserved() {
try {
const res = await getDicts('routine_rtfureservations_rt_purpose');
this.Reserveduse = res.data;
} catch (error) {
console.error('获取预约用途失败:', error);
}
},
async getrole() {
try {
const res = await getDicts('routine_rtfureservation_rt_role');
this.rolelist = res.data;
} catch (error) {
console.error('获取人员类型失败:', error);
}
},
validateForm() {
if (!this.formData.rtTheme) {
uni.showToast({ title: '请输入活动主题', icon: 'none' });
return false;
}
if (!this.formData.rtCreatRole) {
uni.showToast({ title: '请输入申请人姓名', icon: 'none' });
return false;
}
if (!this.formData.rtDepar) {
uni.showToast({ title: '请选择使用部门/学院', icon: 'none' });
return false;
}
if (!this.formData.rtPeople || this.formData.rtPeople <= 0) {
uni.showToast({ title: '请输入有效的参与人数', icon: 'none' });
return false;
}
if (this.formData.rtPeople > this.list.roomCapacity) {
uni.showToast({
title: `人数超过限制(最多${this.list.roomCapacity}人)`,
icon: 'none'
});
return false;
}
if (!this.Reserveduse.length || !this.Reserveduse[this.rangeIndex]) {
uni.showToast({ title: '请选择预约用途', icon: 'none' });
return false;
}
if (this.selectedRoles.length === 0) {
uni.showToast({ title: '请选择人员类型', icon: 'none' });
return false;
}
if (this.timeindex === null) {
uni.showToast({ title: '请选择预约时间段', icon: 'none' });
return false;
}
return true;
},
async onSubmit() {
if (this.isSubmitting) return;
if (!this.validateForm()) return;
this.isSubmitting = true;
try {
const form = {
...this.formData,
rtPurpose: this.Reserveduse[this.rangeIndex].dictLabel,
rtRole: this.selectedRoles.join(","),
roomNo: this.list.roomNo,
roomName: this.list.roomName,
rtNo: this.slotslist[this.timeindex].rtNo,
rtTime: this.rtTime,
rtTimePeriod: this.slotslist[this.timeindex].openingHours
};
console.log('提交数据:', form);
const res = await addRoomReservation(form);
if (res.code === 200) {
uni.showToast({ title: '预约成功' });
setTimeout(() => {
uni.redirectTo({ url: "../appointment/index" });
}, 1500);
} else {
uni.showToast({ title: res.msg || '预约失败', icon: 'none' });
}
} catch (error) {
console.error('预约提交失败:', error);
uni.showToast({ title: '预约提交失败', icon: 'none' });
} finally {
this.isSubmitting = false;
}
}
},
onLoad(option) {
this.rtTime = option.rtTime;
this.list = JSON.parse(option.list);
this.formData.roomName = this.list.roomName;
Promise.all([
this.getlist(),
this.getReserved(),
this.getrole(),
this.getXZJGDeptList()
]).catch(error => {
console.error('初始化失败:', error);
});
}
};
</script>
<style lang="scss" scoped>
.reservation {
background-color: #f4f4f4;
min-height: 100vh;
padding-bottom: 40rpx;
.form-container {
padding: 40rpx;
background-color: #fff;
margin-bottom: 20rpx;
.form-item {
margin-bottom: 30rpx;
padding: 20rpx;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
label {
display: block;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
font-weight: 500;
}
input, .picker {
height: 80rpx;
line-height: 80rpx;
padding: 0 20rpx;
border: 1rpx solid #e1e1e1;
border-radius: 10rpx;
font-size: 28rpx;
color: #333;
}
.uni-input {
display: flex;
align-items: center;
justify-content: space-between;
.val {
flex: 1;
}
.placeholder {
color: #b6b6b6;
}
}
.trigger {
.uni-input {
height: 80rpx;
line-height: 80rpx;
padding: 0 20rpx;
border: 1rpx solid #e1e1e1;
border-radius: 10rpx;
}
}
}
}
.time-selection {
background-color: #fff;
padding: 40rpx;
border-radius: 20rpx 20rpx 0 0;
.time-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
text:first-child {
font-size: 32rpx;
font-weight: 550;
}
text:last-child {
font-size: 24rpx;
color: #999;
}
}
.time-slots {
display: flex;
flex-wrap: wrap;
margin: 0 -10rpx;
.slot-item {
width: 33.33%;
padding: 10rpx;
box-sizing: border-box;
button {
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
border-radius: 10rpx;
background-color: #f9fbfc;
color: #1890FF;
border: 1rpx solid #1890FF;
&.active {
background-color: #1890FF;
color: #fff;
}
&.disabled {
background-color: #f5f5f5;
color: #c1c1c1;
border-color: #e1e1e1;
}
&.warning {
border-color: #ff9900;
color: #ff9900;
}
}
}
}
.usage-matters {
margin-top: 40rpx;
font-size: 26rpx;
color: #666;
line-height: 1.6;
text:first-child {
font-weight: bold;
margin-right: 10rpx;
}
}
.submit-btn {
margin-top: 50rpx;
height: 90rpx;
line-height: 90rpx;
font-size: 32rpx;
border-radius: 45rpx;
background-color: #1890FF;
&[disabled] {
background-color: #c1ccdf;
}
}
}
.drawer-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 998;
}
.drawer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
border-radius: 20rpx 20rpx 0 0;
padding: 30rpx;
z-index: 999;
box-shadow: 0 -5rpx 20rpx rgba(0, 0, 0, 0.1);
.drawer-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #eee;
text:first-child {
font-size: 32rpx;
font-weight: bold;
}
.drawer-close {
color: #1890FF;
font-size: 28rpx;
}
}
.drawer-body {
max-height: 60vh;
overflow-y: auto;
padding-bottom: 40rpx;
}
}
}
.input-placeholder {
color: #b6b6b6;
font-size: 28rpx;
}
</style>