<template>
	<view class="content">
		<view class="param">
			<view class="all-text">创建项目需求</view>
			<view class="proName">项目标题</view>
			<input class="proINname" placeholder="请输入项目标题"/>
			<view class="proMiao">项目描述</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择项目描述"
				:localdata="range"
				@change="change"
			></uni-data-select>
			<view class="proMiao">附件</view>
			<view class="upload-img">
				<uni-file-picker limit="3" 
					@select='selectUpload' 
					:auto-upload='false' 
					file-extname='pdf,docx,xlsx,' 
					file-mediatype="all" 
					@success='uploadSuccess'	
					@fail='uploadFail' 
					:list-styles='listStyles' 
					v-model='fileList'
				></uni-file-picker>
			</view>
			<span style="margin: 20rpx 0 0 20rpx;">支持pdf/word/xlsx格式，单个文件大小不超过5MB</span>
			<view class="proMiao">主办单位</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择主办单位"
				:localdata="range"
				@change="change"
			></uni-data-select>
			<view class="proMiao">协办单位</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择协办单位"
				:localdata="range"
				@change="change"
			></uni-data-select>
			
			<view class="proMiao">项目级别</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择项目级别"
				:localdata="range"
				@change="change"
			></uni-data-select>
			<view class="proMiao">关联流程</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择关联流程"
				:localdata="range"
				@change="change"
			></uni-data-select>
			<view class="proMiao">项目来源</view>
			<uni-data-select class="proINname"
				v-model="value" placeholder="请选择项目来源"
				:localdata="range"
				@change="change"
			></uni-data-select>
			<view class="proMiao jindu">完成进度</view>
			<view class="weidu">维度权重40%</view>
			<view class="addRen" @click="addRen">新增任务</view>
			<!-- 任务列表 -->
			<view style="width: 100%;margin: 50rpx 0 0 20rpx;">
				<view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu">
					<view>{{item.name}}</view>
					<view>{{item.time}}</view>
					<view style="display: flex;">
						<view class="renwu-bu bianji">编辑</view>
						<view class="renwu-bu delete">删除</view>
					</view>
				</view>
			</view>
			<view class="project">
				<view class="butt quxiao">取消</view>
				<view class="butt queren">确认创建</view>
			</view>
			<view style="width: 100%;height: 60rpx;"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: 1,
				  range: [
					{ value: 0, text: "篮球" },
					{ value: 1, text: "足球" },
					{ value: 2, text: "游泳" },
				  ],
				fileList: [],
				listStyles: {
					"borderStyle": {
						"width": "0", // 边框宽度
					},
					"border": false, // 是否显示边框
					"dividline": false
				},
				renwu:[
					{name:'xxx任务',time:'2024-04-11'},
					{name:'xxx任务',time:'2024-04-11'},
					{name:'xxx任务',time:'2024-04-11'},
				],
			}
		},
		onLoad() {
	
		},
		methods: {
			 change(e) {
			  console.log("e:", e);
			},
			//新增任务
			addRen(){
				uni.navigateTo({
					url:'/pages/project/addRenwu'
				})
			},
			//任务详情
			clickRenwu(){
				uni.navigateTo({
					url:'/pages/project/renwuX'
				})
			},
			// 上传附件
			uploadSuccess(e) {
			console.log('上传成功', e)
			},
			uploadFail(e) {
				console.log('上传失败：', e)
			},
			selectUpload(e) {
				console.log('上传：', e)
			
				uni.uploadFile({
					url: 'url', //仅为示例，非真实的接口地址
					filePath: e.tempFilePaths[0],
					name: 'file',
					// formData: {
					// 	'file': ''
					// },
					success: (uploadFileRes) => {
						console.log(uploadFileRes.data);
					},
					fail: (err) => {
						console.log(err);
					}
				})
			},
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.param{
		margin: 20rpx 0 0 0;
		width: 100%;
		background-color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 41rpx;
		color: rgba(0, 0, 0, 1);
	}
	.all-text{
		margin: 22rpx 0 0 20rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(0, 0, 0, 1);
	}
	.proName{
		margin: 23rpx 0 0 20rpx;
	}
	.proINname{
		margin: 25rpx 0 0 21rpx;
		width: 709rpx;
		height: 90rpx;
		border-radius: 13rpx;
		background: rgba(245, 248, 252, 1);
		border: 1rpx solid rgba(229, 229, 229, 1);
		font-size: 28rpx;
		line-height: 90rpx;
		color: rgba(179, 179, 179, 1);
	}
	.proMiao{
		margin: 31rpx 0 0 20rpx;
	}
	/* 上传附件 */
	.upload-img{
		margin: 25rpx 0 0 21rpx;
		width: 200rpx;
		height: 80rpx;
		opacity: 1;
		border-radius: 13rpx;
		background: rgba(0, 97, 255, 0.1);
		
		border: 1rpx solid rgba(0, 97, 255, 1);
	}
	.jindu{
		font-size: 32rpx;
		font-weight: 500;
		line-height: 46rpx;
	}
	.weidu{
		margin: 7rpx 0 0 20rpx;
		font-size: 24rpx;
		line-height: 35rpx;
		color: rgba(128, 128, 128, 1);
	}
	.addRen{
		margin: -80rpx 0 0 581rpx;
		width: 149rpx;
		height: 59rpx;
		border-radius: 92rpx;
		background: rgba(0, 97, 255, 1);
		font-size: 28rpx;
		line-height: 59rpx;
		color: rgba(255, 255, 255, 1);
		text-align: center;
	}
	/* 任务列表 */
	.renwu{
		display: flex;
		margin-top: 6rpx;
		width: 709rpx;
		height: 90rpx;
		border-radius: 13rpx;
		background: rgba(245, 248, 252, 1);
		border: 1rpx solid rgba(229, 229, 229, 1);
		font-size: 28rpx;
		justify-content: space-evenly;
		align-items: center;
	}
	.renwu-bu{
		width: 105rpx;
		height: 50rpx;
		border-radius: 110rpx;
		line-height:50rpx;
		text-align: center;
	}
	.bianji{
		border: 1rpx solid rgba(0, 97, 255, 1);
		color: rgba(0, 97, 255, 1);
	}
	.delete{
		margin-left: 20rpx;
		border: 1rpx solid rgba(212, 48, 48, 1);
		color: rgba(212, 48, 48, 1);
	}
	.project{
		display: flex;
		margin: 61rpx 0 0 0;
		justify-content: space-evenly;
	}
	.butt{
		width: 330rpx;
		height: 90rpx;
		border-radius: 117rpx;
		font-size: 32rpx;
		line-height: 90rpx;
		text-align: center;
	}
	.quxiao{
		border: 1rpx solid rgba(0, 97, 255, 1);
		color: rgba(0, 97, 255, 1);
	}
	.queren{
		background: rgba(0, 97, 255, 1);
		color: rgba(255, 255, 255, 1);
	}
</style>