<template>
	<view class="content">
		<view class="main">
			<view class="main-item flex" v-for="(item,index) in list" :key="index">
				<view class="main-left">
					{{item.name}}
				</view>
				<view class="main-right">
					<text class="num">{{item.score}}</text>分
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {
		new_project,
		my_point
	} from '@/api/project.js'
	export default {
		data() {
			return {
				list: [],
			};
		},
		computed: {
			...mapState('user', ['userInfo', 'hasLogin', 'urlFile'])
		},
		onLoad() {},
		onShow() {
			if (this.userInfo.user_type != 2) {
				uni.setTabBarItem({
					index: 1,
					"pagePath": "pages/user/grade",
					"iconPath": "../../static/tabbar/tab-grade.png",
					"selectedIconPath": "../../static/tabbar/tab-grade-current.png",
					"text": "我的成绩",
					"visible": true
				});
			}
			this.loadData()
		},
		onReachBottom() {},
		onReady() {},
		methods: {
			loadData() {
				new_project().then(e => {
					console.log(e);
					my_point({}, e.data.new.id).then(({
						data
					}) => {
						this.list = data;
						console.log(data);
					})
				})
			}
		}
	};
</script>

<style lang="scss">
	page,
	.content {
		min-height: 100%;
		height: auto;
	}

	.main {
		width: 702rpx;
		background: #FFFFFF;
		box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
		border-radius: 20rpx;
		margin: 20rpx auto;
		padding: 0 25rpx;

		.main-item {
			padding: 36rpx 0;
			border-bottom: 1px solid #F0F0F0;

			.main-left {
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
			}

			.main-right {
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #000000;

				.num {
					display: inline-block;
					margin-right: 10rpx;
					color: #FF4C4C;
				}
			}
		}
	}
</style>