<template name="basics">
  <view>
    <cu-custom class="home-custom" bgColor=".bg-sancolor"
               bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/64bdccea7bd72.png">
      <block slot="content">精准大田专家填报系统</block>
    </cu-custom>
    <scroll-view scroll-y class="page">

		<view class="nav-list" style="margin-top: 40%;">
			<navigator hover-class="none" @tap="toPage(index)"  class="nav-li" :class="'bg-'+item.color"
			 v-for="(item,index) in elements" :key="index" style="width: 60%;margin-left: 20%">
				<view class="nav-title" style="text-align: center;font-size: 50rpx;">{{item.title}}</view>  
				<view class="nav-name"></view>
			</navigator>
		</view>
		
		
		
		<view class="footer">
			<view>主办单位：安徽省农业农村厅质监处</view>
			<view>技术支持：安徽省北斗精准农业信息工程实验室</view>
		</view>
      <view class="cu-tabbar-height"></view>
    </scroll-view>
  </view>
</template>

<script>
  import { Messages } from "prettier/parser-postcss";
  import { _home } from "./home.js";
  

  export default {
    name: "basics",
    data() {
      return {
		elements: [{
			title: '信息填报',
			name: 'layout',
			color: 'green',
			cuIcon: 'shengchanjidi',
			subTitle:'基地'
		},
		{
		    title: '填报记录',
		    name: 'layout',
		    color: 'blue',
		    cuIcon: 'renzheng',
		    subTitle:'检测'
		}],
        cardCur: 0,
        dotStyle: false,
        towerStart: 0,
        direction: "",
		userInfo:{},
		imgList: [],//图片list
		caseTypeList:[],//'黑塔镇蒋杨村','韦集镇陈圩村','灵城镇界沟村','支河镇鸭湖村'
      };
    },
	computed: {
		pickerRange() {
		  return this.caseTypeList.map(item => item.site);
		}
	},
	created() {
		
		this.toNextPage();

		
	},
    methods: {
		toPage(index){
			console.log("选择index" + index);
			if(index==0){
				uni.navigateTo({
					url:'/pages/check/index'
				})
			}else if(index==1){
				uni.navigateTo({
				url:'/pages/check-record/index'
				})
			}
		},
		toNextPage() {
        console.log("判断登录");
        //判断有没有登录，没有登录直接跳到登录，登录了 跳到任务详情
        let username = wx.getStorageSync("username");
        if (username == "") {
          //没有登录
          console.log("没有登录");
          //跳入登录
          uni.navigateTo({
            url: "/pages/login/index"
          });
        } else {
			console.log("已登录")
          /* let role = uni.getStorageSync("role");
           console.log(index)
          if (index == 2 ) { //抽样人员的角色id
            //表示点了抽样单位且角色是抽样单位
              if(role === '85f63893de834bb898edc01cfd2cc46c'){
                  //检测机构人员
                  uni.navigateTo({
                      url: "/pages/sample-check-list/home"
                  });
              } else if(role === "f35551e4a06647dea5c2c43aaba22c2a"){
                  uni.navigateTo({
                      url: "/pages/task-list/index"
                  });
              }else{
                  uni.showToast({
                      icon: 'error',
                      title: "当前角色不可查看",
                      duration: 1500
                  })
              }

          }


          if (index == 0 && role == "a1cbf841b0514b47bbdd3f50c80b729f") { //快检站的角色
            //表示点了检测单位且角色是检测单位
            uni.navigateTo({
              url: "/pages/quick-task/list"
            });
          } 
		  
		  if (index == 1) {
              // && role == "a1cbf841b0514b47bbdd3f50c80b729f"
			uni.navigateTo({
			  url: "/pages/quick-task/quick-list"
			});
		  } */

        }

      }
    }
  };
</script>

<style>
    .page {
        height: 100vh;
    }

    .footer {
        position: fixed;
        text-align: center;
        line-height: 40px;
        margin-bottom: 2px;
        bottom: 10vh;
        width: 100%;
        font-size: 12px;
    }

    .footer view {
        line-height: 22px;
    }
</style>