<template>
	<view class="content-view">
		<view style="width: 90%;background-color: #ffffff;margin-top: 180rpx;border-radius: 20rpx;
		box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.2);display: flex;flex-direction: column;align-items: center;">
			<image style="width: 200rpx;height: 200rpx;margin-top: -100rpx;" src="/static/my/icon1.png"></image>
			<view style="margin-top: 10rpx;display: flex;flex-direction: row;justify-content: space-between;
			align-items: center;">
				<view style="background-color: #a0d9f6;width: fit-content;padding: 0rpx 20rpx;height: fit-content;
				border-radius: 20rpx;box-shadow: 2px 2px 0px 0 rgba(0, 0, 0);font-size: 26rpx;margin-right: 50rpx;">用户</view>
				<button class="transparent-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
					<text style="color: black;">{{phoneNum===''||phoneNum===null?'点击一键登录':phoneNum}}</text>
				</button>
			</view>
		</view>
		
		<view style="width: 90%;background-color: #ffffff;margin-top: 30rpx;border-radius: 20rpx;
		box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.2);display: flex;flex-direction: column;">
			<text style="font-size: 36rpx;margin: 40rpx;">我的服务</text>
			<view @click="navToDetail(1)" style="display: flex;height: 90rpx;flex-direction: row;align-items: center;border-bottom: 1px solid #b2b2b2;margin: 0rpx 10rpx;">
				<image style="width: 60rpx;height: 60rpx;margin-left: 30rpx;" src="/static/my/icon2.png"></image>
				<text style="font-size: 28rpx;margin-left: 20rpx;">线索二维码</text>
			</view>
			<view @click="navToDetail(2)" style="display: flex;height: 90rpx;flex-direction: row;align-items: center;border-bottom: 1px solid #b2b2b2;margin: 0rpx 10rpx;">
				<image style="width: 60rpx;height: 60rpx;margin-left: 30rpx;" src="/static/my/icon3.png"></image>
				<text style="font-size: 28rpx;margin-left: 20rpx;">切换账号</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phoneNum:uni.getStorageSync('phonenumber')
			}
		},
		methods: {
			getPhoneNumber (e) {
				let _this = this
				if(e.detail.code !== undefined){
					_this.$http.post('appraisal/WeiXin/getPhoneNumber',{openid:uni.getStorageSync('openId'),code:e.detail.code}).then(res=>{
						console.log(res)
						this.phoneNum = res.data.phoneNumber;
						uni.setStorageSync('phonenumber',res.data.phoneNumber);
					}).catch(err=>{
						
					})
				}
			},
			navToDetail(type){
				if(type === 1){
					uni.navigateTo({
						url:'/pages/applicationList/index'
					})
				}
				if(type === 2){
					uni.navigateTo({
						url:'/pages/onlionAppointmentList/onlionAppointmentList'
					})
				}
			}
		}
	}
</script>

<style>
.content-view{
	width: 100%;
	height: 100vh; /* 视口高度 */
	background-color: aliceblue;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.transparent-btn {
    background-color: transparent !important;
}
.transparent-btn::after{
	border: none !important;
}
</style>
