zhengkaixin 2 年之前
父节点
当前提交
8d473943e5
共有 2 个文件被更改,包括 59 次插入38 次删除
  1. 11 0
      apis/pagejs/activity.js
  2. 48 38
      pages/staffHome/activityCenter/activityDetail.vue

+ 11 - 0
apis/pagejs/activity.js

@@ -46,3 +46,14 @@ export function myAwards(id) {
 }
 
 
+export function joinActivity(id) {
+	return request({
+		url: '/mobile/activityUser/joinActivity',
+		data: {
+			activityId:id
+		},
+		method: 'post',	
+	//	header:{'Content-Type':'application/json'},
+	})
+}
+

+ 48 - 38
pages/staffHome/activityCenter/activityDetail.vue

@@ -1,28 +1,27 @@
 <template>
 	<view>
 		<u-navbar title="活动详情"></u-navbar>
+		
 		<view class="main" v-html="info.content">
 			
 		
 		
 		
 		</view>
-		<view class="bottom2" v-if="!userInfo" >
-					
-					<u-button type="info" @click="issueMethod()">未登录</u-button>
-		</view>
-		<view class="bottom2" v-else-if="info.status=='eaab19ae-893f-40e7-b730-85a13af00137'" >
+		<view class="bottom" v-if="!userInfo" >
 					
-					<u-button type="info">活动未开始</u-button>
+					<u-button  @click="issueMethod()">未登录</u-button>
 		</view>
-		 <view class="bottom2" v-else-if="info.status=='77d93870-e1e1-4369-b2b6-629e8645e8d9'" >
-			
-			<u-button type="info">活动已过期</u-button>
+		
+		 <view class="bottom" v-else-if="info.status=='77d93870-e1e1-4369-b2b6-629e8645e8d9'" >
+			<u-button  >活动已结束</u-button>
 		 </view>
-		 <view class="bottom" v-else @click="gotoUrl('pages/mine/issue?id='+info.id)" >
-		 			<button>发布作品</button>
+		 <view class="bottom" v-else   >
+					<u-button  type="primary"  v-if="!info.isJoin"
+					@click="enrollMethod()" >线上报名</u-button>
+					
+					<u-button v-else >已报名</u-button>
 					<!-- <u-button type="info">发布作品</u-button> -->
-
 		 </view>
 	</view>
 </template>
@@ -48,6 +47,41 @@
 			
 		},
 		methods: {
+			joinActivity(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.joinActivity(this.id).then((res) => {
+					//this.list=response.data.data
+					this.info.isJoin=true;
+					uni.hideLoading();
+					uni.showToast({
+						title:"报名成功!"
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			enrollMethod(){
+				var _this=this;
+				uni.showModal({
+					title:_this.info.title,
+					content:"确认是否参与本活动报名?",
+					confirmText:"报名",
+					showCancel:true,
+					success: (res)=> {
+						if(res.confirm){
+							_this.joinActivity()
+						}
+						
+					}
+				})
+			},
 			issueMethod(){
 				uni.showModal({
 					title:"提示",
@@ -178,31 +212,7 @@
 	   left: 0;
 	   right: 0;
 	   font-family: Arial;
-	   uni-button{
-		   border-radius: 8px;
-		   background-color: rgba(31, 74, 153, 1);
-		   color: rgba(255, 255, 255, 1);
-		   font-size: 16px;
-		   line-height: 40px;
-		   
-	   }
-	   
-   }
-   .bottom2{
-   	   padding: 16rpx 32rpx;
-   	   background-color: rgba(243, 244, 244, 1);
-   	   position: fixed;
-   	   bottom: 0;
-   	   left: 0;
-   	   right: 0;
-   	   uni-button{
-   		   border-radius: 8px;
-   		   background-color: rgba(255, 255, 255, 1);
-   		   color: #303133;
-   		   font-size: 16px;
-   		   line-height: 40px;
-   		   
-   	   }
-   	   
+	 
    }
+  
 </style>