<template>
	<view class="content" v-if="list.length > 0">
		<view class="title">
			<view class="text">我的常用</view>
			<view class="bars" @click="go_bars()">
				<uni-icons type="bars" color="#999" size="18"></uni-icons>
			</view>
		</view>
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index" @click="go_record(item.page_id)">
				<view class="icon">
					<image v-if="index%7 == 1" src="./icon/01.png" mode=""></image>
					<image v-if="index%7 == 2" src="./icon/02.png" mode=""></image>
					<image v-if="index%7 == 3" src="./icon/03.png" mode=""></image>
					<image v-if="index%7 == 4" src="./icon/04.png" mode=""></image>
					<image v-if="index%7 == 5" src="./icon/05.png" mode=""></image>
					<image v-if="index%7 == 6" src="./icon/06.png" mode=""></image>
					<image v-if="index%7 == 7" src="./icon/07.png" mode=""></image>
					<image v-if="index%7 == 0" src="./icon/08.png" mode=""></image>
				</view>
				<view class="name">{{item.page_name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "t-i-common",
		data() {
			return {
				list: []
			};
		},
		created() {
			this.get_link()
		},
		methods: {
			go_bars() {
				uni.navigateTo({
					url: "../../index/bars_sort/bars_sort"
				})
			},

			get_link() {
				this.$api.getCommonMenuList({

				}).then((res) => {
					// console.log(res.data)

					this.list = res.data.data
				})
			},
			
			go_record(pageId){
				uni.navigateTo({
					url:"../../index/record/record?pageId=" + pageId + "&mine_code=" + uni.getStorageSync('mine_code')
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		margin-bottom: 30rpx;
		background-color: #FFFFFF;

		box-sizing: border-box;
		padding: 50rpx 25rpx;
	}

	.title {
		display: flex;
		align-items: baseline;
		justify-content: space-between;

		.text {
			font-size: 36rpx;
		}

		.bars {
			width: 100rpx;
			text-align: right;

		}
	}

	.list {
		width: 700rpx;
		overflow: hidden;

		.item {
			margin-top: 30rpx;

			display: flex;
			align-items: center;

			height: 90rpx;

			.icon {
				width: 40rpx;
				margin-right: 30rpx;

				image {
					display: block;
					width: 40rpx;
					height: 40rpx;
				}
			}

			.name {
				width: 620rpx;
				line-height: 90rpx;
				font-size: 28rpx;

				border-bottom: 1rpx solid #DBDBDB;
			}
		}

	}
</style>
