<template>
	<view class="">
		<u-navbar :border-bottom="false" back-icon-size="35" title-size="32" :background="background"
			:back-text-style="hhyanm" title-color="#374B6E" back-icon-color="#374B6E"></u-navbar>
		<view style="margin-top: -80rpx;">
			<image src="/static/index/uying.png" style="width: 750rpx;height: 1624rpx;" mode=""></image>
		</view>
		<view class="fzddrew dltoor">
			<view class="dlyhr" hover-class="none" @click="gomy(0)">
				<text>我是用户</text>
			</view>
			<view class="dlyzxs" hover-class="none" v-if="identity == 1" @click="gomy(1)">
				<text>我是咨询师</text>
			</view>
			<view class="dlyzxs" hover-class="none" v-if="identity != 1" @click="toApply(1)">
				<text>申请成为咨询师</text>
			</view>
			<view class="dlyzxs" hover-class="none" v-if="identity == 2" @click="gomy(2)">
				<text>我是机构</text>
			</view>
			<view class="dlyzxs" hover-class="none" v-if="identity != 2" @click="toApply(2)">
				<text>申请机构</text>
			</view>
		</view>
	</view>
</template>
<style>
	page {
		background: #374B6E;
	}
</style>
<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#374B6E',
				},
				hhyanm: {
					color: '#374B6E',
				},
				userinfo: null,
				is_lecturer:false,
				identity: 0,
			}
		},
		onLoad() {
			console.log(uni.getStorageSync('is_lecturer'));
			if(uni.getStorageSync('is_lecturer')==0){
				this.is_lecturer = false
			}else{
				this.is_lecturer = true
			}
			this.getuserinfo();
		},
		methods:{
			//获取用户信息
			getuserinfo(loading = true) {
				let id = uni.getStorageSync('id');
				this.$request.getuserinfo({
					id
				}).then( res =>{
					console.log(res)
					this.userinfo = res.data;
					this.identity = res.data.identity;
				}).catch( e=>{
					console.log(e)
				})
			},
			getMyIdentity: function(e) {
				this.$post({
					data: {
				 	do: 'GetMyIdentity',
						data: {
							user_id: uni.getStorageSync('id'),
						}
					}
				}).then(res => {
					this.state = res.data.state;
				})
			},
			gomy(type){
				uni.setStorageSync('type',type);
				uni.navigateBack();
			},
			toApply(n){
				uni.navigateTo({
				    url:'/pages/index/apply?identity=' + n
				})
			}
		}
	}
</script>

<style lang="scss" scoped>


</style>
