<template>
    <div class="app-container">
      <van-row style="background: url('../../../static/images/onlineHome/bg11.png') no-repeat left -20px;background-size: 100%;height: 220px;border-radius:0 0 50px 50px;">
        <van-cell center  style="padding-top: 50px;background: none">
          <template #title>
            <p style="color: #fff;margin-left: 10px;font-size: 20px">{{nickName}}</p>
          </template>
          <template #label>
            <p style="color:#fff;margin-left: 10px">{{deptName}}</p>
          </template>
          <template  #right-icon>
            <van-image width="62"
                       height="62"
                       style="border-radius: 10px;overflow: hidden;margin-right: 8px"
                       :src="avatar">

            </van-image>
          </template>
        </van-cell>
      </van-row>
      <van-cell-group style="width: 96%;margin:-50px 2% 2% 2%;border-radius: 6px;overflow: hidden;padding-top: 20px;padding-bottom: 20px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);">
<!--        <van-cell title="我的业务" is-link :to="{path:'done',query:{fr:'my'}}">-->
<!--          <template #icon>-->
<!--            <van-image-->
<!--              fit="contain"-->
<!--              height="22"-->
<!--              style="margin-right: 15px"-->
<!--              src="../../../static/images/onlineHome/myIcon2.png"-->
<!--            />-->
<!--          </template>-->
<!--        </van-cell>-->
        <!-- <van-cell title="画像（个人/农户）" is-link :to="{path:'personalPicture',params:{id:'1'}}">
          <template #icon>
            <van-image
              fit="contain"
              height="22"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon1.png"
            />
          </template>
        </van-cell>
        <van-cell title="通讯录" is-link to="mailList">
          <template #icon>
            <van-image
              fit="contain"
              height="22"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon5.png"
            />
          </template>
        </van-cell>
        <van-cell title="生活缴费" is-link to="livePay">
          <template #icon>
            <van-image
              fit="contain"
              height="22"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon4.png"
            />
          </template>
        </van-cell> -->
<!--        <van-cell title="找房找地" is-link to="../plotPremisesMobile/index" >
          <template #icon>
            <van-image
              fit="contain"
              height="22"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon6.png"
            />
          </template>
        </van-cell>-->
        <van-cell title="阳光村务" center is-link @click="sunVillage">
          <template #icon>
            <van-image
              fit="contain"
              height="20"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon01.png"
            />
          </template>
        </van-cell>

        <van-cell title="基本资料" center is-link to="basicInformation">
          <template #icon>
            <van-image
              fit="contain"
              height="20"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon00.png"
            />
          </template>
        </van-cell>
        <van-cell title="电子签名" center is-link to="signature">
          <template #icon>
            <van-image
              fit="contain"
              height="20"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon02.png"
            />
          </template>
        </van-cell>
        <van-cell title="修改密码" center is-link to="password">
          <template #icon>
            <van-image
              fit="contain"
              height="20"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon03.png"
            />
          </template>
        </van-cell>
        <van-cell title="退出登录" center is-link @click="logout">
          <template #icon>
            <van-image
              fit="contain"
              height="20"
              style="margin-right: 15px"
              src="../../../static/images/onlineHome/myIcon04.png"
            />
          </template>
        </van-cell>
      </van-cell-group>
      <yinnongIndex></yinnongIndex>
    </div>
</template>

<script>
  import yinnongIndex from "../yinnongIndex";
  import {getInfo, logout} from "../../api/login";
  import request from '@/utils/request'
  export default {
      components: {
        yinnongIndex
      },
        name: "my",
      data() {
        return {
          list: [],
          loading: false,
          finished: false,
          nickName:"",
          deptName:"",
          userId:"",
          avatar:"",
        };
      },
      created() {
        getInfo().then(response => {
          this.nickName = response.user.nickName
          this.deptName = response.user.dept.deptName
          this.userId = response.user.userId
          this.avatar = location.protocol+"//"+location.host+request.defaults.baseURL+response.user.avatar
        });
      },
      methods: {
        logout(){
          this.$store.dispatch('LogOut').then(() => {
            this.$router.push({path:"../yinnongLogin"})
          });
        },
        sunVillage(){
          this.$router.push({path:"../sunVillage_info/index"})
        }
      },
    }
</script>

<style scoped>
>>>  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 22px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }
</style>
