|
|
@@ -0,0 +1,296 @@ |
|
|
|
<template> |
|
|
|
<div class="home_wrapper"> |
|
|
|
<div class="return_btn" @click="onClickLeft"></div> |
|
|
|
<div class="focus_head"> |
|
|
|
</div> |
|
|
|
<div class="focus_info"> |
|
|
|
<div class="icon"></div> |
|
|
|
<div class="title"></div> |
|
|
|
</div> |
|
|
|
<van-form @submit="handleLogin"> |
|
|
|
<div class="login_from"> |
|
|
|
<div class="flex_block"> |
|
|
|
<div class="flex_input_main"> |
|
|
|
<div class="icon_wrap user"></div> |
|
|
|
<div class="input_wrap"> |
|
|
|
<input type="text" v-model="formData.name" class="ipt" placeholder="姓名"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="flex_block"> |
|
|
|
<div class="flex_input_main"> |
|
|
|
<div class="icon_wrap password"></div> |
|
|
|
<div class="input_wrap"> |
|
|
|
<input type="text" v-model="formData.idcard" class="ipt" placeholder="身份证号码"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<van-checkbox v-model="formData.rememberMe">记住我的信息</van-checkbox> |
|
|
|
</div> |
|
|
|
<div class="login_btn"> |
|
|
|
<van-button |
|
|
|
class="btn" |
|
|
|
round |
|
|
|
block |
|
|
|
type="info" |
|
|
|
native-type="submit" |
|
|
|
color="linear-gradient(to right, #2ec8c4, #30c271)" |
|
|
|
:loading="loading" |
|
|
|
>验证</van-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
</van-form> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { getCodeImg, getSmsCode } from "@/api/login"; |
|
|
|
import { checkFarmer, allowFaceVerify } from "@/api/sunVillage_info/fixedAssets"; |
|
|
|
import { getFamilyMemberList } from "@/api/sunVillage_info/homestead/familyMember"; |
|
|
|
import Cookies from "js-cookie"; |
|
|
|
import { encrypt, decrypt } from "../../utils/jsencrypt"; |
|
|
|
//引用wx sdk |
|
|
|
import wx from "weixin-js-sdk"; |
|
|
|
import {farmerLogin} from "@/api/register"; |
|
|
|
export default { |
|
|
|
name: "loginFarmer", |
|
|
|
data() { |
|
|
|
return { |
|
|
|
formData: { |
|
|
|
name: '', |
|
|
|
idcard: '', |
|
|
|
rememberMe: false, |
|
|
|
}, |
|
|
|
loading: false, |
|
|
|
codeUrl: "", //验证码 |
|
|
|
isSmsLogin: false, //是否手机验证码 |
|
|
|
computeTime: 0, |
|
|
|
height:0, |
|
|
|
show:true |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.height = document.body.clientHeight |
|
|
|
this.getCookie(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getCookie() { |
|
|
|
const memberName = Cookies.get("memberName"); |
|
|
|
const idcard = Cookies.get("idcard"); |
|
|
|
const rememberMe = Cookies.get("rememberInformation"); |
|
|
|
if(memberName !== undefined) |
|
|
|
this.formData.name = memberName; |
|
|
|
if(idcard !== undefined) |
|
|
|
this.formData.idcard = idcard; |
|
|
|
if(rememberMe !== undefined) |
|
|
|
this.formData.rememberMe = Boolean(rememberMe); |
|
|
|
}, |
|
|
|
remember() { |
|
|
|
if (this.formData.rememberMe) { |
|
|
|
Cookies.set("memberName", this.formData.name, { expires: 30 }); |
|
|
|
Cookies.set("idcard", this.formData.idcard, { expires: 30 }); |
|
|
|
Cookies.set("rememberInformation", this.formData.rememberMe, { expires: 30 }); |
|
|
|
} else { |
|
|
|
Cookies.remove("username"); |
|
|
|
Cookies.remove("password"); |
|
|
|
Cookies.remove("rememberInformation"); |
|
|
|
} |
|
|
|
}, |
|
|
|
validate() { |
|
|
|
if (this.formData.name == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '姓名不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} else if (this.formData.idcard == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '身份证不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
handleLogin(values) { |
|
|
|
this.remember(); |
|
|
|
if(!this.validate()) |
|
|
|
return; |
|
|
|
|
|
|
|
farmerLogin(this.formData).then(response => { |
|
|
|
const farmer = response.data; |
|
|
|
|
|
|
|
let seconds = 3600; |
|
|
|
let expires = new Date(new Date() * 1 + seconds * 1000); |
|
|
|
|
|
|
|
Cookies.set("bookName", farmer.bookName, { |
|
|
|
expires: 30, |
|
|
|
}); |
|
|
|
Cookies.set("deptName", farmer.deptName, { |
|
|
|
expires: 30, |
|
|
|
}); |
|
|
|
Cookies.set("bookId", farmer.bookId, { |
|
|
|
expires: 30, |
|
|
|
}); |
|
|
|
Cookies.set("deptId", farmer.deptId, { |
|
|
|
expires: 30, |
|
|
|
}); |
|
|
|
|
|
|
|
const farmerCode = farmer.hzFarmerCode; |
|
|
|
Cookies.set("farmerCode",farmerCode, { expires: 30 }); |
|
|
|
Cookies.set("user", farmer, { expires: expires }); |
|
|
|
allowFaceVerify().then(resp => { |
|
|
|
if(resp.data === 'true' || 1) |
|
|
|
{ |
|
|
|
this.$router.push({ |
|
|
|
path: '/sunVillage_info/identity_check', |
|
|
|
query: { |
|
|
|
responseData: response.data, |
|
|
|
redirectPath: '/sunVillage_info/index_code', |
|
|
|
}}); |
|
|
|
} |
|
|
|
else |
|
|
|
this.$router.push({path:'/sunVillage_info/index_code_rights'}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
/deep/ .van-checkbox__label{ |
|
|
|
color: #ffffff; |
|
|
|
} |
|
|
|
/deep/ .van-checkbox{ |
|
|
|
justify-content: right; |
|
|
|
} |
|
|
|
.home_wrapper{ |
|
|
|
background: #f1f2f2; |
|
|
|
width: 100vw; |
|
|
|
min-height: 100vh; |
|
|
|
.return_btn { |
|
|
|
width: 24px; |
|
|
|
height: 43.2px; |
|
|
|
background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat; |
|
|
|
background-size: 20px 36px; |
|
|
|
position: absolute; |
|
|
|
left: 38px; |
|
|
|
top: 36px; |
|
|
|
} |
|
|
|
.focus_head{ |
|
|
|
height: 450px; |
|
|
|
background: url('../../assets/images/sunVillage_info/login_head_code_green.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
|
|
|
|
} |
|
|
|
.focus_info{ |
|
|
|
margin-top: -74px; |
|
|
|
.icon{ |
|
|
|
background: url('../../assets/images/sunVillage_info/login_head_t.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
width: 145px; |
|
|
|
height: 148px; |
|
|
|
margin:0 auto; |
|
|
|
} |
|
|
|
.title{ |
|
|
|
width: 180PX; |
|
|
|
height: 52px; |
|
|
|
background: url('../../assets/images/sunVillage_info/login_head_nr_code.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
margin:30px auto 0; |
|
|
|
} |
|
|
|
} |
|
|
|
.login_from{ |
|
|
|
width: 676px; |
|
|
|
height: 350px; |
|
|
|
background: url('../../assets/images/sunVillage_info/login_main_green.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
margin: 50px auto 0; |
|
|
|
padding:60px 50px 0; |
|
|
|
.flex_block{ |
|
|
|
margin-bottom: 40px; |
|
|
|
display: flex; |
|
|
|
justify-content:space-between; |
|
|
|
.flex_input_main{ |
|
|
|
position: relative; |
|
|
|
display: flex; |
|
|
|
flex: 1; |
|
|
|
align-items:center; |
|
|
|
background: rgba(255,255,255,0.7); |
|
|
|
border-radius: 62px; |
|
|
|
height: 62px; |
|
|
|
.icon_wrap{ |
|
|
|
width: 35px; |
|
|
|
height: 35px; |
|
|
|
&.user{ |
|
|
|
background: url('../../assets/images/sunVillage_info/login_icon_1.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
margin-left: 30px; |
|
|
|
} |
|
|
|
&.password{ |
|
|
|
background: url('../../assets/images/sunVillage_info/login_icon_2_code.png') no-repeat; |
|
|
|
height: 25px; |
|
|
|
background-size: 100% 100%; |
|
|
|
margin-left: 30px; |
|
|
|
} |
|
|
|
&.valid{ |
|
|
|
background: url('../../assets/images/sunVillage_info/login_icon_3.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
margin-left: 30px; |
|
|
|
} |
|
|
|
} |
|
|
|
.input_wrap{ |
|
|
|
flex: 1; |
|
|
|
margin-left: 16px; |
|
|
|
padding-right: 30px; |
|
|
|
.ipt{ |
|
|
|
width: 100%; |
|
|
|
height: 48px; |
|
|
|
background:transparent; |
|
|
|
font-size: 30px; |
|
|
|
color: #3f3d56; |
|
|
|
} |
|
|
|
} |
|
|
|
.showHidden{ |
|
|
|
width: 32px; |
|
|
|
height: 32px; |
|
|
|
background: url('../../assets/images/sunVillage_info/login_icon_4.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
position: absolute; |
|
|
|
right: 38px; |
|
|
|
cursor: pointer; |
|
|
|
&.ico_hide{ |
|
|
|
background: url('../../assets/images/sunVillage_info/login_icon_5.png') no-repeat; |
|
|
|
background-size: 100% 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
&.valid{ |
|
|
|
flex:0 0 380px; |
|
|
|
} |
|
|
|
} |
|
|
|
.valid_main{ |
|
|
|
width: 165px; |
|
|
|
height: 62px; |
|
|
|
border-radius: 30px; |
|
|
|
img{ |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
border-radius: 30px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.login_btn{ |
|
|
|
padding-top: 80px; |
|
|
|
.btn{ |
|
|
|
width: 315px; |
|
|
|
height: 80px; |
|
|
|
margin:0 auto; |
|
|
|
font-size: 32px; |
|
|
|
color: #fff; |
|
|
|
text-align: center; |
|
|
|
border: none; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</style> |