<template>
	<view class="app">
		<view class="cards">
			<view class="item" style="background: #D43953;" @tap='gomymission'>
				<image src="../../static/dingdan.png" mode=""></image>
				<view class="title">
					我的任务
				</view>
			</view>
			<view class=" item" style="background: #4C7BC9; " @tap='gopersonal'>
				<image src="../../static/user.png" mode=""></image>
				<view class="title">
					个人信息
				</view>
			</view>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {
		nursePerson,
	} from '@/api/personnal/personal.js';
	export default {
		data() {
			return {
				phonenumber: null,
				password: null,
			};
		},
		onShow() {
			let that = this
			try {
				const value = uni.getStorageSync('phonenumber');
				const value2 = uni.getStorageSync('password');
				if (value && value2) {
					that.phonenumber = value
					that.password = value2
				}
			} catch (e) {}
		},
		methods: {
			gomymission() {
				nursePerson(this.phonenumber, this.password).then(res => {
					if (res.code == 200) {
						uni.navigateTo({
							url: '/pages/Mymission/Mymission'
						})
					} else if (res.code == 9999) {} else {
						this.$refs.uToast.show({
							title: '账号异常,请重新登录',
							type: 'error',
							duration: '1000'
						})
						setTimeout(e => {
							uni.reLaunch({
								url: '/pages/login/login'
							})
						}, 1000)
					}
				})
			},
			gopersonal() {
				nursePerson(this.phonenumber, this.password).then(res => {
					if (res.code == 200) {
						uni.navigateTo({
							url: '/pages/personal/personal'
						})
					} else if (res.code == 9999) {} else {
						this.$refs.uToast.show({
							title: '账号异常,请重新登录',
							type: 'error',
							duration: '1000'
						})
						setTimeout(e => {
							uni.reLaunch({
								url: '/pages/login/login'
							})
						}, 1000)
					}
				})
			},
		},
	}
</script>
<style lang="scss">
</style>
