<template>
	<view class="">
		<u-upload :action="action" :file-list="fileList" @on-success='uploadSuccess' :form-data='imageDate'></u-upload>
		<view class="buttom" @click="upLoad">
			点击上传
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				action: '',
				imageDate: {
					file_type: 'img',
					type: 'activity_scenes'
				}, //上传图片携带参数
				fileList: [],
				paths:[],
				activity_id:'',//活动id
			}
		},
		onLoad(options) {
		
			this.activity_id=options.activity_id
			this.action = '/api/common/upload'
		
		},
		methods: {
			
			uploadSuccess(data) {
				
				this.paths.push(data.data)
				
			},
			upLoad(){
				let data={
					activity_id:this.activity_id,
					organization_id:this.$store.state.vuex_user.organization_id,
					paths:this.paths
				}
				this.$u.post('/page/organization-activity-scenes',data).then(res=>{
					
					uni.reLaunch({
						url:'active_detail?id='+this.activity_id 
					})
				})
			//点击上传
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		padding: 0 15px;
	}

	.buttom {
		height: 45px;
		line-height: 45px;
		color: #fff;
		font-size: 14px;
		text-align: center;
		border-radius: 8px;
		width: 45%;
		margin: 0 auto;
		margin-top:30%;
		background-color: #79573D;
	}
</style>
