<template>
	<view class="container" :style="{ backgroundImage: `url(${hgjbj})` }">
		<view class="box">
			<view class="imgBox" v-for="(i, index) in dataList" :key="index" @click="btn(i)">
				<image class="imgs" mode="scaleToFill" :src="filesUrl + i.blogPic"></image>
				<text class="name">{{ i.title }}</text>
				<text class="name">{{ i.blogDesc }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../api/cms.js';
	import { BASE_URL } from '../../env.js';
	import requestLogin from '../../api/login.js';
	export default {
		data() {
			return {
				filesUrl: BASE_URL.fileUrl,
				dataList: [],
				hgjbj: '',
				alias: ''
			}
		},
		onLoad: function(option) {
			this.alias = option.alias;
		},
		async mounted() {
			const config = await requestLogin.getJson();
			const { hgjbj } = config.data;
			this.hgjbj = hgjbj;
			const res = await request.getArticleList({ pageNum: 1, pageSize: 100, typeName: this.alias });
			this.dataList = res.rows;
		},
		methods: {
			btn(e) {
				uni.navigateTo({ url: `/pages/details/cmsinfo?id=${e.id}` })
			}
		}
	}
</script>

<style>
	.container {
		width: 100%;
		height: 100vh;
		overflow-y: auto;
		background-size: 100% 100%;
	}
	.box {
		display: flex;
		flex-wrap: wrap;
		margin-top: 15px;
	}
	.imgBox {
		width: 30%;
		height: 50vw;
		margin-left: 2.5%;
		margin-top: 5px;
	}
	.imgs {
		display: block;
		width: 100%;
		height: 75%;
		border: 2px solid #CD7F32;
	}
	.name {
		width: 100%;
		display: block;
		text-align: center;
		color: #fff;
	}
	.uni-section {
		background-color: transparent !important;
		margin-top: 20px;
	}
	.uni-section-header {
		padding: 0 10px !important;
	}
	.uni-section__content-title {
		color: #fff !important;
	}
</style>
