<template src="./template.html">

</template>

<script>
import util from "../../utils/util";
import {loginService} from '@/services'
import { Toast } from "mint-ui";
    export default {
        data() {
            var serverUrl="http://skyforest.static.elab-plus.com/";
            return {
                serverUrl:serverUrl,
                name:"",
                pwd:'',
                coverBgStyle: `background:url('${serverUrl}Login-BG.png') 100% 100% / 100% 100%;`,
            }
        },
        mounted() {
            console.log("*******asgdjhasdjkapp.vue*******")
            // localStorage.removeItem('_accout');
            //localStorage.removeItem('_miniappQrcode');
            //localStorage.removeItem('_projectId');
        },
        methods: {
            async enter(){
                // console.log('标签');
                if(this.name==''){
                    Toast('用户名不能为空');
                    return
                }
                if(this.pwd==''){
                     Toast('密码不能为空');
                    return
                }
                let data={
                    account:this.name,
                    password:this.pwd
                };
                let result = await loginService.login(data);
                 if (result.data.success) {
                     Toast('登录成功')
                     console.log(result.data);
                     localStorage.setItem('_accout',result.data.single.account);
                     localStorage.setItem('_miniappQrcode',result.data.single.miniappQrcode);
                     localStorage.setItem('_appQrcode',result.data.single.appQrcode);
                     localStorage.setItem('_projectId',result.data.single.projectId);
                     localStorage.setItem('_projectTel',result.data.single.tel);
                     this.$router.push({ name: "detail"});

                 }else{
                     Toast(result.data.message)
                 }
            }
        }
    }
</script>

<style lang="scss" scoped>
  @import "./style.scss"
</style>
