<template>
	<view class="list">
		<headers :showBack="!isNull" themeType="white" showRightIcon @select="toDept">
			<view class="headerName">
				我的资质
			</view>
			<template #right>
				<u-icon v-if="isNull" @click="exit" size="40" name="more-dot-fill"></u-icon>
			</template>
		</headers>
		<view class="item" v-for="(item,index) in list" :key="index" @click="go(item.url)">
			<image :src="'/static/supplierImg/' + item.icon +'.png'" mode="widthFix"></image>
			<text class="title">{{ item.title }}</text>
			<u-icon name="arrow-right" color="#999"></u-icon>
		</view>
	</view>
</template>

<script>
	import {
		exitApp
	} from "@/utils/tool.js"
	export default {
		data() {
			return {
				isNull: false,
				list: [{
          icon:"g1",
					title: "基本信息",
					url: "/pages/supplier/qualifications/info"
				}, {
          icon:"g2",
					title: "资质文件",
					url: "/pages/supplier/qualifications/fileList"
				}, {
          icon:"g3",
					title: "资质申请",
					url: "/pages/supplier/qualifications/apply"
				}]
			};
		},
		onLoad(option) {
			console.log(option);
			if (option.isNull) {
				this.isNull = true;
			}
		},
		methods: {
			exit() {
				// 退出APP
				uni.showModal({
					title: '提醒',
					content: '是否退出当前账号',
					success: function(res) {
						if (res.confirm) {
							exitApp()
						} else if (res.cancel) {

						}
					}
				});

			},
			go(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		.item {
			display: flex;
			align-items: center;
			padding: 35rpx;
			box-shadow: 0 5rpx 8rpx 1rpx #E8EDFC;

			&:active {
				background-color: rgba(0, 0, 0, .01);
			}

			image {
				width: 40rpx;
				height: auto;
			}

			.title {
				flex: 1;
				padding: 0 20rpx;
			}
		}
	}
</style>
