Browse Source

取消报名

zhengkaixin 2 years ago
parent
commit
01360888e2
3 changed files with 55 additions and 3 deletions
  1. 11 0
      apis/pagejs/activity.js
  2. 37 1
      pages/staffHome/activityCenter/activityDetail.vue
  3. 7 2
      vue.config.js

+ 11 - 0
apis/pagejs/activity.js

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

+ 37 - 1
pages/staffHome/activityCenter/activityDetail.vue

@@ -20,7 +20,7 @@
 					<u-button  type="primary"  v-if="!info.isJoin"
 					@click="enrollMethod()" >线上报名</u-button>
 					
-					<u-button v-else >已报名</u-button>
+					<u-button v-else @click="cancelMethod()" >已报名</u-button>
 					<!-- <u-button type="info">发布作品</u-button> -->
 		 </view>
 	</view>
@@ -47,6 +47,26 @@
 			
 		},
 		methods: {
+			cancelActivity(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.cancelActivity(this.id).then((res) => {
+					//this.list=response.data.data
+					this.info.isJoin=false;
+					uni.hideLoading();
+					uni.showToast({
+						title:"取消报名"
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			joinActivity(){
 				uni.showLoading({
 					title: "加载中",
@@ -67,6 +87,22 @@
 					})
 				})
 			},
+			cancelMethod(){
+				
+					var _this=this;
+					uni.showModal({
+						title:_this.info.title,
+						content:"确认是否取消报名?",
+						confirmText:"取消报名",
+						showCancel:true,
+						success: (res)=> {
+							if(res.confirm){
+								_this.cancelActivity()
+							}
+							
+						}
+					})
+			},
 			enrollMethod(){
 				var _this=this;
 				uni.showModal({

+ 7 - 2
vue.config.js

@@ -58,8 +58,13 @@ if(process.env.NODE_ENV === "production"){
 			); */
 	
 				config.plugins.push(new webpack.ProgressPlugin(percentage => {
-					
-					percentage === 1 ? console.log('编译完成:100.00%') : console.log(`编译${Templates['NODE_NAME_T']}进度:${(percentage * 100).toFixed(2)}%,提示!构建请点击‘发行’-‘自定义发行’`)
+				
+				
+					var NODE_NAME_T="";
+					if(Templates){
+						NODE_NAME_T=Templates['NODE_NAME_T']
+					}
+						percentage === 1 ? console.log('编译完成:100.00%') : console.log(`编译${NODE_NAME_T}进度:${(percentage * 100).toFixed(2)}%,提示!构建请点击‘发行’-‘自定义发行’`)
 				}));
 			config.output.filename = `./static/js/[name].${Timestamp}.js`
 			config.output.chunkFilename = `./static/js/[name].${Timestamp}.js`