<template>
	<view class="my">
		<u-navbar back-text=" " title=" " :background="{backgroundColor: 'transparent'}"></u-navbar>
		<image class="myBGC" src="../../static/img/myBGC.png" mode=""></image>
		<view class="info flex">
			<view class="text">
				<view class="name">
					{{data.name}}
				</view>
				<view>{{data.dwname}}</view>
			</view>
			<image :src="data.avatar" mode=""></image>
		</view>
		<view class="con">
			<view class="li flex">
				<view class="label">科室名称</view>
				<text>{{data.ksname}}</text>
			</view>
			<view class="li flex">
				<view class="label">联系方式</view>
				<text>{{data.phone}}</text>
			</view>
			<view class="li flex">
				<view class="label">身份证号</view>
				<text>{{data.card ? data.card.replace(/(\d{6})\d{8}(\d{4})/, '$1********$2') : ''}}</text>
			</view>
			<!-- <view class="li flex">
				<view class="label">本月问卷提交次数</view>
				<text>{{count}}</text>				
			</view> -->
		</view>
		<view class="con">
			<view class="li flex" @click="tozhuanzhang()" v-if="data.yzh == 1">
				<image src="../../static/img/zhuanzhang.png" mode=""></image>
				<text>转账记录</text>
			</view>
			<view class="li flex" @click="password()">
				<image src="../../static/img/my1.png" mode=""></image>
				<text>修改密码</text>
			</view>
			<view class="li flex" @click="out()">
				<image src="../../static/img/my2.png" mode=""></image>
				<text>退出登录</text>
			</view>
		</view>
		<u-modal v-model="show" @confirm="confirm" :show-cancel-button="true" @cancel="cancel" content="您确定要退出登录状态吗？"></u-modal>
		<tabBar :pagePath="'/pages/index/my'"></tabBar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				data: {},
				// count:0
			}
		},
		onLoad(option) {
			this.getUserInfo()
		},
		// onShow() {
		// 	this.$http.getTopicNum().then(res => {
		// 		this.count = res.data.result
		// 	})
		// },
		methods: {
			tozhuanzhang(){
				uni.navigateTo({
					url:"/pages/index/jilu"
				})
			},
			password() {
				uni.navigateTo({
					url: '/pages/user/password',
				})
			},
			out() {
				this.show = true
			},
			confirm() {
				uni.removeStorageSync('token');
				uni.reLaunch({
					url: '/pages/login/login'
				});
			},
			cancel() {
				this.show = false
			},
			getUserInfo() {
				this.$http.getUserInfo().then(res => {
					if (res.data.code == 200) {
						console.log(res)
						this.data = res.data.result
						// console.log(this.data)
					}
				})
			},

		}
	}
</script>

<style lang="scss">
	.my {
		height: 100%;
		position: relative;
		background: #F5F8FF;

		.myBGC {
			position: absolute;
			width: 100%;
			top: 0;
			height: 600rpx;
		}

		.info {
			position: relative;
			z-index: 1;
			width: 680rpx;
			margin: 24rpx auto;

			.text {
				flex: 1;
				color: rgba(0, 0, 0, 0.6);
				font-size: 28rpx;

				.name {
					font-size: 44rpx;
					font-family: PingFang SC-Semibold, PingFang SC;
					font-weight: 600;
					color: rgba(0, 0, 0, 0.8);
					margin-bottom: 10rpx;
				}
			}

			image {
				width: 120rpx;
				height: 120rpx;
				opacity: 1;
				border: 1px solid #FFFFFF;
				border-radius: 50%;
				box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.05), inset 0px 2rpx 2rpx 0px rgba(255, 255, 255, 0.25);
			}
		}

		.con {
			z-index: 1;
			position: relative;
			width: 680rpx;
			margin: 24rpx auto;
			padding: 32rpx 32rpx 0;
			background: linear-gradient(180deg, #F2F9FB 0%, #FFFFFF 100%);
			box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.05), inset 0px 2rpx 2rpx 0px rgba(255, 255, 255, 0.25);
			border-radius: 24rpx;

			.li {
				padding-bottom: 32rpx;
				font-size: 28rpx;
				color: rgba(0, 0, 0, 0.6);

				.label {
					margin-right: 20rpx;
				}

				image {
					width: 40rpx;
					height: 40rpx;
					margin-right: 20rpx;
				}
			}
		}
	}
</style>