Parcourir la source

接口联调;活动不同状态操作

htc il y a 2 jours
Parent
commit
9a02ed5cfa

+ 1 - 1
pages/my.vue

@@ -124,7 +124,7 @@
 	const getUserInfo = () => {
 		try{
 			proxy.$api.get(`/wx/${JSON.parse(uni.getStorageSync('userInfo')).id}`).then(({data:res})=>{
-				if(res.code!==0) return this.$showToast(res.msg)
+				if(res.code!==0) return proxy.$showToast(res.msg)
 				userInfo.value = res.data;
 			})
 		}catch(e){

+ 44 - 6
pagesHome/activityDetail.vue

@@ -79,7 +79,9 @@
 				</view>
 				<view class="box1-info-pre line">
 					<text>可获得义工时长</text>
-					<view class="hour"><text>{{activityInfo?.serviceHours||0}}</text> 小时</view>
+					<!-- typeId=='1977564860095348737'为义工活动,义工时长只有义工活动才有 -->
+					<view class="hour" v-if="activityInfo?.typeId=='1977564860095348737'"><text>{{activityInfo?.serviceHours||0}}</text> 小时</view>
+					<view class="hour" v-else>无</view>
 				</view>
 			</view>
 			<view class="box1-line" style="margin-top: 30rpx;"></view>
@@ -96,9 +98,9 @@
 		</view>
 		<view class="box box2">
 			<view class="box-title">活动详情</view>
-			<view class="box2-detail">
+			<view class="box2-detail" v-if="activityInfo&&activityInfo.activityDetails">
 				<up-read-more :toggle="true" showHeight="374rpx" color="#989998" fontSize="24rpx" openText="收起更多信息" closeText="展开更多信息">
-				    <rich-text :nodes="activityInfo?.activityDetails||''"></rich-text>
+				    <rich-text :nodes="activityInfo.activityDetails"></rich-text>
 				</up-read-more>
 			</view>
 		</view>
@@ -111,9 +113,14 @@
 					<up-icon name="share-square" color="#252525" size="48rpx"></up-icon>
 					<text>分享</text>
 				</view>
-				<view class="right" @click="handleApply" v-if="activityInfo?.activeState==1">立即报名</view>
+				<view class="right" @click="handleApply" v-if="activityInfo?.activeState==1&&activityInfo?.signupState==0">立即报名</view>
+				<view class="right" @click="handleCancel" v-else-if="activityInfo?.activeState==1&&activityInfo?.signupState==1">取消报名</view>
+				<view class="right" @click="handleSignup" v-else-if="activityInfo?.activeState==2&&activityInfo?.signupState==1">我要签到</view>
+				<view class="right" @click="handleFill" v-else-if="activityInfo?.activeState==3&&activityInfo?.signupState==1">填写公益档案</view>
 				<view class="right end" v-else-if="activityInfo?.activeState==0">活动未开始</view>
+				<view class="right end" v-else-if="activityInfo?.activeState==2&&activityInfo?.signupState==0">活动进行中不可报名</view>
 				<view class="right end" v-else-if="activityInfo?.activeState==3">活动已结束</view>
+				<view class="right end" v-else-if="activityInfo?.activeState==4">已报满暂无活动名额</view>
 			</view>
 		</view>
 		<view class="fail" v-if="fail">
@@ -210,6 +217,7 @@
 	const statusCfg = ref({
 		0:'未开始',
 		1:'报名中',
+		4:'报名中',
 		2:'进行中',
 		3:'已结束'
 	})
@@ -241,6 +249,7 @@
 		})
 	}
 	
+	//立即报名
 	const handleApply = async () => {
 		let { loveValue, ticketValue } = await getUserLoveValue();
 		// url:'/pagesHome/signSuccess'
@@ -254,6 +263,30 @@
 		}
 		uni.navigateTo({ url })
 	}
+	//取消报名
+	const handleCancel = () => {
+		uni.showModal({
+			title:'温馨提示',
+			content:'确认取消本地报名吗?取消后可再次报名本活动。',
+			success: (res) => {
+				if(res.confirm){
+					proxy.$api.get(`/core/activity/signup/cancelSignup/${activityInfo.value?.signupId||''}`).then(({data:res})=>{
+						if(res.code!==0) return proxy.$showToast(res.msg)
+						getActivityDetail(id.value)
+						proxy.$showToast('取消报名成功')
+					})
+				}
+			}
+		})
+	}
+	//我要签到
+	const handleSignup = () => {
+		
+	}
+	//填写公益档案
+	const handleFill = () => {
+		
+	}
 	
 	const getUserLoveValue = () => {
 		return new Promise(resolve=>{
@@ -543,10 +576,15 @@
 	  
 	const getActivityDetail = (id) => {
 		proxy.$api.get(`/core/activity/${id}`).then(({data:res})=>{
-			if(res.code!==0) return this.$showToast(res.msg)
+			if(res.code!==0) return proxy.$showToast(res.msg)
 			activityInfo.value = res.data;
+			if(activityInfo.value.signupState==0
+			&&activityInfo.value.activeState===1
+			&&activityInfo.value.recruitmentNow==(activityInfo.value.recruitmentMax||99999)){
+				activityInfo.value.activeState = 4;//已报满暂无活动名额
+			}
 			imgList.value = activityInfo.value?.imageFiles&&(activityInfo.value?.imageFiles.split(',')||[])
-			for(let i=0;i<activityInfo.recruitmentNow;i++){
+			for(let i=0;i<activityInfo.value.recruitmentNow;i++){
 				avatars.value.push('https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/10/565ca09a-88e2-4c2c-a89e-98bd51fbea7f.png')
 			}
 		})

+ 1 - 1
pagesHome/applyMemberVindicate.vue

@@ -102,7 +102,7 @@
 	
 	const getMemberInfo = (id) => {
 		proxy.$api.get(`/core/family/member/${id}`).then(({data:res})=>{
-			if(res.code!==0) return this.$showToast(res.msg)
+			if(res.code!==0) return proxy.$showToast(res.msg)
 			memberInfo.value = {...memberInfo.value,...res.data}
 		})
 	}

+ 5 - 3
pagesMy/familyMemberVindicate.vue

@@ -96,14 +96,16 @@
 				uni.redirectTo({
 					url:'/pagesMy/familyMember'
 				})
-			},1500)
+			},1000)
 		})
 	}
 	
 	const getMemberInfo = (id) => {
 		proxy.$api.get(`/core/family/member/${id}`).then(({data:res})=>{
-			if(res.code!==0) return this.$showToast(res.msg)
-			memberInfo.value = {...memberInfo.value,...res.data}
+			if(res.code!==0) return proxy.$showToast(res.msg)
+			if(res.data){
+				memberInfo.value = {...memberInfo.value,...res.data}
+			}
 		})
 	}
 	

+ 1 - 1
pagesMy/information.vue

@@ -133,7 +133,7 @@
 	const getUserInfo = () => {
 		try{
 			proxy.$api.get(`/wx/${JSON.parse(uni.getStorageSync('userInfo')).id}`).then(({data:res})=>{
-				if(res.code!==0) return this.$showToast(res.msg)
+				if(res.code!==0) return proxy.$showToast(res.msg)
 				userInfo.value = res.data;
 				if(userInfo.value?.avatarPath) fileList.value = [{name:'',url:userInfo.value?.avatarPath}];
 			})