<template>
	<view class="main">
		<view class="list">
			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
				<view class="title omit">
					<text class="icon" v-if="item.top === 1">&#xe61f;</text>
					<text>{{ item.title }}</text>
				</view>
				<view class="desc">
					<text>{{ item.type }}</text>
					<text>发布于 {{ item.createTime }}</text>
				</view>
			</view>
			<u-empty v-if="list.length == 0" text="你还未绑定就诊人"></u-empty>
		</view>
		<view class="mfooter">
			<button class="btn" @click="go('/pages/user/bind/add')">
				<text class="icon">&#xe8d5;</text>
				<text>去绑定</text>
			</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: []
		};
	},
	onLoad(e) {
		this.getData();
	},
	methods: {
		getData() {
			this.http.request({
				url: '/app/user/bind/list',
				data: this.param,
				loading: 'false',
				success: (res) => {
					this.list = res.data.data;
				}
			});
		},
		go(url) {
			uni.navigateTo({ url: url });
		}
	}
};
</script>

<style lang="scss">
.list {
	padding: 10px 12px;
	background-color: white;
	margin: 10px;
	border-radius: 10px;
	.item {
		border-radius: 5px;
		padding: 13px 12px 13px 12px;
		margin-bottom: 10px;
		overflow: hidden;
		border-bottom: 1px solid $line;
		.title {
			font-size: 15px;
			font-weight: bold;
			.icon {
				color: orangered;
				padding-right: 3px;
			}
		}
		.desc {
			font-size: 14px;
			padding-top: 10px;
			color: $font-c;
			text {
				padding-right: 30px;
			}
		}
	}
}
</style>
