<template>
	<view>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 			1、学习地图
			2、能力矩阵图
			3、任务一进度条 -->
			<uni-section title="仪表盘">
				<uni-row>
					<uni-col :span="8" v-for="(item, index) in arr1" :index="index" :key="index">
						<view class="grid-item-box" style="margin: 30rpx auto;display: flex; flex-direction: column; justify-content: center; align-items: center;">
							<uv-image :src="item.icon" height="38" width="38"></uv-image>
							<text class="text">{{ item.title }}</text>
						</view>
					</uni-col>
				</uni-row>
				<!-- <uni-grid :column="3" :highlight="false" :showBorder="false" @change="onNavigation">
					<uni-grid-item v-for="(item, index) in arr1" :index="index" :key="index">
						<view class="grid-item-box" style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
							<uv-image :src="item.icon" height="38" width="38"></uv-image>
							<text class="text">{{ item.title }}</text>
						</view>
					</uni-grid-item>
				</uni-grid> -->
			</uni-section>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 暂无通知 -->
			<uni-section title="通知条">
				<!-- <uv-alert title="uv-ui" type="warning" description="uv-ui的目标是成为uni-app生态最优秀的UI框架"></uv-alert> -->
				<uni-list>
					<uni-list-item link title="XXXX通知1" />
					<uni-list-item link title="XXXX通知2" />
					<uni-list-item link title="XXXX通知3" />
				</uni-list>
			</uni-section>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 暂无课程表 -->
			<uni-section title="培训计划">
				<uni-list>
					<uni-list-item link title="xxx培训课程表1" note="（课程导图、理论培训、课程观看、题库练习、自学教材），实操培训（视频、仿真）" />
					<uni-list-item link title="xxx培训课程表2" note="（课程导图、理论培训、课程观看、题库练习、自学教材），实操培训（视频、仿真）" />
					<uni-list-item link title="xxx培训课程表3" note="（课程导图、理论培训、课程观看、题库练习、自学教材），实操培训（视频、仿真）" />
				</uni-list>
			</uni-section>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 1、培训一（课程导图、理论培训、课程观看、题库练习、自学教材），实操培训（视频、仿真）
			2、培训二（同上）
			3、培训三（同上） -->
			<uni-section title="培训任务">
				<uni-list>
					<uni-list-item link title="培训一" note="理论、实操" />
					<uni-list-item link title="培训二" note="理论、实操" />
					<uni-list-item link title="培训三" note="理论、实操）" />
				</uni-list>
			</uni-section>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 1、考试一（理论、实操） 2、考试二（理论、实操） 3、考试三（理论、实操） -->
			<uni-section title="考试任务">
				<uni-list>
					<uni-list-item link title="考试一（理论、实操）" />
					<uni-list-item link title="考试二（理论、实操）" />
					<uni-list-item link title="考试三（理论、实操）" />
				</uni-list>
			</uni-section>
		</uni-card>
		<uni-card title="竞赛任务" :border="false" :is-shadow="false" :padding="0">
			<!-- 1、竞赛一 2、竞赛一 3、竞赛一 -->
			<uni-grid :column="3" :highlight="true" :showBorder="false" @change="onNavigation">
				<uni-grid-item v-for="(item, index) in arr2" :index="index" :key="index">
					<view class="grid-item-box" style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh">
						<uv-avatar :src="item.icon" shape="square" class="image" style="width: 38px; height: 38px"></uv-avatar>
						<text class="text">{{ item.title }}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<!-- 1、申报任务 2、荣誉申报流程 3、补贴申报流程 -->
			<uni-section title="申报任务">
				<uni-list>
					<uni-list-item link title="申报任务" />
					<uni-list-item link title="荣誉申报流程" />
					<uni-list-item link title="补贴申报流程" />
				</uni-list>
			</uni-section>
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<uni-section title="调研任务">
				<uni-list>
					<uni-list-item thumb="https://oss.wsdns.cn/20240607/6f446190344b471ca8363523cfd2546b.png" link title="人才调研" />
					<uni-list-item thumb="https://oss.wsdns.cn/20240607/6f446190344b471ca8363523cfd2546b.png" link title="能力调研" />
					<uni-list-item thumb="https://oss.wsdns.cn/20240607/6f446190344b471ca8363523cfd2546b.png" link title="满意调研" />
				</uni-list>
			</uni-section>
			<!-- 1、人才调研 2、能力调研 3、满意调研 -->
		</uni-card>
		<uni-card :border="false" :is-shadow="false" :padding="0">
			<uni-section title="培训记录">
				<uni-list>
					<uni-list-item link title="培训记录1" rightText="推荐" />
					<uni-list-item link title="培训记录2" />
					<uni-list-item link title="培训记录3" />
				</uni-list>
			</uni-section>
		</uni-card>
	</view>
</template>

<script>
import { useTenantStore } from '@/store/modules/tenant';
import { openUrl } from '@/utils/common';
const tenantStore = useTenantStore();

export default {
	data() {
		return {
			arr1: [],
			arr2: [],
			fields: [],
			adsList: [],
			ads: []
		};
	},
	onLoad() {
		this.reload();
	},
	methods: {
		async reload() {
			const app = this;

			// 获取服务租户信息包
			const info = await tenantStore.fetchTenantInfo();

			// 登录状态
			if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
				app.isLogin = true;
			}

			// 解析小程序导航图标
			if (info.mpMenus) {
				app.arr1 = info.mpMenus.filter((d) => d.type == 5 && d.rows == 1);
				app.arr2 = info.mpMenus.filter((d) => d.type == 5 && d.rows == 2);
				app.arr3 = info.mpMenus.filter((d) => d.type == 5 && d.rows == 3);
			}
			// 请求数据
			// Promise.all([app.getMerchantList(), app.getItemList()]).then((res) => {
			// 	app.merchant = res[0];
			// 	app.itemList = res[1];
			// });
		}
	}
};
</script>

<style></style>
