修改社区报名取消功能
This commit is contained in:
@@ -17,4 +17,12 @@ export function applyDetail(id) {
|
||||
url: '/staff/OneStopRegistrationRecord/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
//取消报名
|
||||
export function cancelRegistration(recordId) {
|
||||
return request({
|
||||
url: '/staff/OneStopRegistrationRecord/cancelRegistration/' + recordId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -62,17 +62,29 @@
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 取消报名按钮 -->
|
||||
<view v-if="canCancel()">
|
||||
<button class="cancel-btn" @click="cancelApply"
|
||||
style="width: 100% !important; background-color: #ff4757 !important; color: white !important;
|
||||
border: none !important; font-size: 18px !important; line-height: 2.55555556 !important;
|
||||
border-radius: 5px !important; padding: 0 14px !important; box-sizing: border-box !important;
|
||||
text-align: center !important; min-height: 46px !important; margin-top: 50px !important;">
|
||||
取消报名
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {applyDetail} from '@/api/OneStopCommunity/apply.js'
|
||||
import { applyDetail, cancelRegistration } from '@/api/OneStopCommunity/apply.js';
|
||||
export default{
|
||||
data(){
|
||||
return{
|
||||
activityInfo:{},//活动信息
|
||||
applyInfo:{},//报名信息
|
||||
headcount:null
|
||||
headcount:null,
|
||||
recordId: null
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
@@ -83,9 +95,72 @@
|
||||
this.activityInfo=res.data.communityActivitiesList[0]
|
||||
this.applyInfo=res.data;
|
||||
}
|
||||
},
|
||||
// 判断是否可以取消报名
|
||||
canCancel() {
|
||||
// 只有待审核(0)或已通过(1)的报名可以取消,已拒绝(2)的不能取消
|
||||
if (this.applyInfo.auditStatus === 2) {
|
||||
return false; // 已拒绝的不能取消
|
||||
}
|
||||
|
||||
// 检查报名截止时间
|
||||
if (this.activityInfo.signUpEndTime) {
|
||||
const now = new Date();
|
||||
const endTime = new Date(this.activityInfo.signUpEndTime);
|
||||
if (now > endTime) {
|
||||
return false; // 报名已截止
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
// 取消报名
|
||||
cancelApply() {
|
||||
uni.showModal({
|
||||
title: '确认取消',
|
||||
content: '确定要取消报名吗?取消后如需重新报名,请在报名截止时间前重新提交申请。',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '取消中...'
|
||||
});
|
||||
|
||||
const result = await cancelRegistration(this.recordId);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '取消报名成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 返回上一页并刷新
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.msg || '取消报名失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '取消报名失败',
|
||||
icon: 'none'
|
||||
});
|
||||
console.error('取消报名失败:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.recordId = option.recordid;
|
||||
this.getdetail(option.recordid)
|
||||
},
|
||||
}
|
||||
@@ -184,5 +259,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background-color: #ff4757 !important;
|
||||
color: white;
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -6,34 +6,39 @@
|
||||
</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 v-for="(item,index) in list" :key="index" class="box">
|
||||
<view @click="detail(item)" class="content">
|
||||
<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>
|
||||
<text>活动时间:</text>
|
||||
<text>{{item.communityActivitiesList[0].activityTime}}</text>
|
||||
<!-- 取消报名按钮 -->
|
||||
<view class="cancel-btn-container" v-if="canCancel(item)">
|
||||
<button class="cancel-btn" @click.stop="cancelApply(item)">取消报名</button>
|
||||
</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>
|
||||
|
||||
@@ -56,8 +61,9 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
applyList
|
||||
} from '@/api/OneStopCommunity/apply.js'
|
||||
applyList,
|
||||
cancelRegistration
|
||||
} from '@/api/OneStopCommunity/apply.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -98,6 +104,72 @@
|
||||
url: `detail?recordid=${item.recordId}`
|
||||
})
|
||||
},
|
||||
// 判断是否可以取消报名
|
||||
canCancel(item) {
|
||||
// 只有待审核(0)或已通过(1)的报名可以取消,已拒绝(2)的不能取消
|
||||
// 同时需要检查报名截止时间
|
||||
if (item.auditStatus === 2) {
|
||||
return false; // 已拒绝的不能取消
|
||||
}
|
||||
|
||||
// 检查报名截止时间
|
||||
if (item.communityActivitiesList && item.communityActivitiesList.length > 0) {
|
||||
const activity = item.communityActivitiesList[0];
|
||||
if (activity.signUpEndTime) {
|
||||
const now = new Date();
|
||||
const endTime = new Date(activity.signUpEndTime);
|
||||
if (now > endTime) {
|
||||
return false; // 报名已截止
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
// 取消报名
|
||||
cancelApply(item) {
|
||||
uni.showModal({
|
||||
title: '确认取消',
|
||||
content: '确定要取消报名吗?取消后如需重新报名,请在报名截止时间前重新提交申请。',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '取消中...'
|
||||
});
|
||||
|
||||
const result = await cancelRegistration(item.recordId);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '取消报名成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 刷新列表
|
||||
this.queryParams.pageNum = 1;
|
||||
this.list = [];
|
||||
this.getlist();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.msg || '取消报名失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '取消报名失败',
|
||||
icon: 'none'
|
||||
});
|
||||
console.error('取消报名失败:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
async getlist() {
|
||||
let res = await applyList(this.queryParams)
|
||||
if (res.code == 200) {
|
||||
@@ -164,48 +236,66 @@
|
||||
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;
|
||||
.content {
|
||||
&>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;
|
||||
}
|
||||
}
|
||||
|
||||
&>view:nth-child(1) {
|
||||
.cancel-btn-container {
|
||||
margin-top: 20rpx;
|
||||
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;
|
||||
}
|
||||
justify-content: flex-end;
|
||||
|
||||
.dark {
|
||||
background-color: #FFDBDB;
|
||||
border: 1px solid #FF9292;
|
||||
color: #FF9292;
|
||||
.cancel-btn {
|
||||
background-color: #ff4757 !important;
|
||||
color: white;
|
||||
margin-top: 100rpx;
|
||||
|
||||
&:active {
|
||||
background-color: #ff3838;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
80
src/manifest.json
Normal file
80
src/manifest.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"sassImplementationName" : "node-sass",
|
||||
"name" : "学工系统",
|
||||
"appid" : "__UNI__CB00986",
|
||||
"description" : "",
|
||||
"versionName" : "1.1.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueCompiler" : "uni-app",
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"modules" : {},
|
||||
"distribute" : {
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
"quickapp" : {},
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxccd7e2a0911b3397",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"es6" : false,
|
||||
"minified" : true,
|
||||
"postcss" : true
|
||||
},
|
||||
"optimization" : {
|
||||
"subPackages" : true
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"vueVersion" : "2",
|
||||
"h5" : {
|
||||
"template" : "static/index.html",
|
||||
"devServer" : {
|
||||
"port" : 9090,
|
||||
"https" : false
|
||||
},
|
||||
"title" : "学工系统",
|
||||
"router" : {
|
||||
"mode" : "hash",
|
||||
"base" : "./"
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"qqmap" : {
|
||||
"key" : "OLUBZ-K7UKZ-2ELXV-TUHVT-LVBY5-KEFZS"
|
||||
},
|
||||
"tencent" : {
|
||||
"key" : "5DSBZ-VHIKV-35KPC-5RNQW-XAMUQ-PMFAC"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/pages.json
Normal file
19
src/pages.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user