<template>
	<view class="award">

		<!-- 学生信息 -->
		<view class="userinfo">
			<view class="left">
				<!-- <text>姓名：{{credit}}</text> -->
				<text>项目：{{ranking}}</text>
			</view>
			<view class="right">
				<button @click="toapply">申请</button>
			</view>
		</view>
		<!-- 学生信息结束 -->
		<view class="awardList">
			<view class="List" v-for="(item,index) in awardList" :key="item.index">
				<view class="awardListleft">
					<text class="title"> {{item.ruleName }}</text>
					<text>分数：{{item.operateScore}}</text>
					<text>时间：{{item.submitTime}}</text>
				</view>
				<view class="awardListright">
					<uni-tag :inverted="true" :text="getAuditType(item.auditStatus)" type="success" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		listOwnIamApply
	} from "@/api/cqScore/cqscore.js";

	import {
		getDict,
		isEmpty
	} from "@/api/helpFunc/index.js";

	export default {
		data() {
			return {
				credit: "李三",
				ranking: "思想品德大类",
				awardList: [],

				dictData: []
			}
		},
		async onShow() {
			await this.getDict();
			await this.listOwnIamApply();
		},
		methods: {
			getAuditType(value) {
				if (!isEmpty(this.dictData)) {
					let arr = this.dictData.filter(x => x.dictValue == value);
					if (!isEmpty(arr)) {
						return arr[0].dictLabel;
					} else {
						return "";
					}
				} else {
					return "";
				}

			},
			async getDict() {
				let res = await getDict("audius_detail_type");
				if (res.code == 200) {
					this.dictData = [...res.data];
				}
			},
			toapply() {
				// 在这里编写申请逻辑
				uni.navigateTo({
					url: "/pages/addapply/addapply"
				})
			},
			async listOwnIamApply() {
				let res = await listOwnIamApply();
				if (res.code == 200) {
					console.log(res);
					this.awardList = [...res.rows];
				}
			},
			// openPopup() {
			// 	wx.showModal({
			// 		title: '申请条件',
			// 		content: '一等奖学金：平均学分绩班级排名前3%，学年综合素质测评班级排名前50%；\n\n二等奖学金：平均学分绩班级排名前6%，学年综合素质测评班级排名前50%；\n\n三等奖学金：平均学分绩班级排名前9%，学年综合素质测评班级排名前50%。',
			// 		showCancel: false,
			// 		confirmText: '关闭',
			// 	});
			// },
		}
	}
</script>
<style lang="less" scoped>
	.award {
		width: 100%;
		min-height: 100vh;
		background-color: #F5F7FB;

		.userinfo {
			width: 100%;
			display: flex;
			background-color: #3388CC;
			justify-content: space-between;
			align-items: center;
			padding: 20rpx 0;

			.left {
				padding: 10rpx 40rpx;

				display: flex;
				flex-direction: column;
				color: white;

				text {
					/* 强制文本内部换行 */
					white-space: pre-wrap;
					margin-bottom: 10rpx;
				}
			}

			.right {
				margin-right: 20rpx;

				button {
					width: 180rpx;
					background-color: #E3F4FF;
					border: 1px solid #009DFF;
					color: #009DFF;
				}

			}
		}

		.awardList {
			width: 100%;
			margin-top: 20rpx;
			display: flex;
			align-items: center;
			flex-direction: column;

			.List {
				// align-items: center;
				display: flex;
				justify-content: space-between;
				width: 90%;
				background-color: white;
				border-radius: 10rpx;
				padding: 40rpx 30rpx 30rpx 30rpx;
				margin-bottom: 30rpx;

				.awardListleft {
					display: flex;
					flex-direction: column;

					.title {
						font-size: 40rpx;

						color: black;
						width: 500rpx;
						margin-bottom: 10rpx;
					}

					text {
						width: 500rpx;
						padding-bottom: 20rpx;
						color: #9C9C9C;
					}
				}
			}
		}



	}
</style>