移动端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

298 行
9.9 KiB

  1. <template>
  2. <div class="home_wrapper">
  3. <div class="return_btn" @click="onClickLeft"></div>
  4. <div class="focus_head">
  5. </div>
  6. <div class="focus_info">
  7. <div class="icon"></div>
  8. <div class="title"></div>
  9. </div>
  10. <van-form @submit="handleLogin">
  11. <div class="login_from">
  12. <div class="flex_block">
  13. <div class="flex_input_main">
  14. <div class="icon_wrap user"></div>
  15. <div class="input_wrap">
  16. <input type="text" v-model="formData.memberName" class="ipt" placeholder="姓名"/>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="flex_block">
  21. <div class="flex_input_main">
  22. <div class="icon_wrap password"></div>
  23. <div class="input_wrap">
  24. <input type="text" v-model="formData.idcard" class="ipt" placeholder="身份证号码"/>
  25. </div>
  26. </div>
  27. </div>
  28. <!-- <div class="flex_block">-->
  29. <!-- <div class="flex_input_main valid">-->
  30. <!-- <div class="icon_wrap valid"></div>-->
  31. <!-- <div class="input_wrap">-->
  32. <!-- <input type="text" v-model="formData.code" class="ipt" maxlength="4" placeholder="请输入验证码"/>-->
  33. <!-- </div>-->
  34. <!-- </div>-->
  35. <!-- <div class="valid_main">-->
  36. <!-- <img :src="codeUrl" @click="getCode" />-->
  37. <!-- </div>-->
  38. <!-- </div>-->
  39. <div style="display: flex;align-items: center;justify-content: space-between;">
  40. <van-checkbox v-model="formData.identityCheck">核身校验</van-checkbox>
  41. <van-checkbox v-model="formData.rememberMe">记住我的信息</van-checkbox>
  42. </div>
  43. </div>
  44. <div class="login_btn">
  45. <!-- <div class="btn" :loading="loading">登录</div>-->
  46. <van-button
  47. class="btn"
  48. round
  49. block
  50. type="info"
  51. native-type="submit"
  52. color="linear-gradient(to right, #2ec8c4, #30c271)"
  53. :loading="loading"
  54. >验证</van-button>
  55. </div>
  56. </van-form>
  57. </div>
  58. </template>
  59. <script>
  60. import { getCodeImg, getSmsCode } from "@/api/login";
  61. import { checkFarmer } from "@/api/sunVillage_info/fixedAssets";
  62. import { getFamilyMemberList } from "@/api/sunVillage_info/homestead/familyMember";
  63. import Cookies from "js-cookie";
  64. import { encrypt, decrypt } from "../../utils/jsencrypt";
  65. //引用wx sdk
  66. import wx from "weixin-js-sdk";
  67. export default {
  68. name: "loginCode",
  69. data() {
  70. return {
  71. formData: {
  72. memberName:'',
  73. idcard:'',
  74. bookId:'',
  75. deptId:null,
  76. facialAt:null,
  77. isFacial:null,
  78. headSculpture:null,
  79. rememberMe:false,
  80. identityCheck:false,
  81. },
  82. loading: false,
  83. codeUrl: "", //验证码
  84. isSmsLogin: false, //是否手机验证码
  85. computeTime: 0,
  86. height:0,
  87. show:true
  88. };
  89. },
  90. created() {
  91. this.height = document.body.clientHeight
  92. this.getCookie();
  93. this.formData.deptId = Cookies.get('deptId');
  94. },
  95. methods: {
  96. getCookie() {
  97. const memberName = Cookies.get("memberName");
  98. const idcard = Cookies.get("idcard");
  99. const rememberMe = Cookies.get("rememberInformation");
  100. this.formData = {
  101. memberName: memberName === undefined ? this.formData.memberName : memberName,
  102. idcard: idcard === undefined ? this.formData.idcard : idcard,
  103. rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
  104. };
  105. },
  106. handleLogin(values) {
  107. if (this.formData.rememberMe) {
  108. Cookies.set("memberName", this.formData.memberName, { expires: 30 });
  109. Cookies.set("idcard", this.formData.idcard, { expires: 30 });
  110. Cookies.set("rememberInformation", this.formData.rememberMe, { expires: 30 });
  111. } else {
  112. Cookies.remove("username");
  113. Cookies.remove("password");
  114. Cookies.remove("rememberInformation");
  115. }
  116. //账号密码登录
  117. if (this.formData.memberName == "") {
  118. this.$dialog.alert({
  119. message: '姓名不能为空',
  120. });
  121. return false;
  122. } else if (this.formData.idcard == "") {
  123. this.$dialog.alert({
  124. message: '身份证不能为空',
  125. });
  126. return false;
  127. }
  128. checkFarmer(this.formData).then(response => {
  129. // console.log(response.data)
  130. if (response.code == 200){
  131. let seconds = 3600;
  132. let expires = new Date(new Date() * 1 + seconds * 1000);
  133. getFamilyMemberList({idcard:this.formData.idcard,familyStatus:"02"}).then(res => {
  134. const farmerCode = res.rows[0].farmerCode;
  135. Cookies.set("farmerCode",farmerCode, { expires: 30 });
  136. Cookies.set("user", response.data, { expires: expires });
  137. if (this.formData.identityCheck){
  138. this.$router.push({
  139. path: '/sunVillage_info/identity_check',
  140. query: { responseData: response.data }});
  141. return;
  142. }
  143. this.$router.push({path:'/sunVillage_info/index_code_rights'})
  144. })
  145. }
  146. });
  147. },
  148. },
  149. };
  150. </script>
  151. <style scoped lang="scss">
  152. /deep/ .van-checkbox__label{
  153. color: #ffffff;
  154. }
  155. /deep/ .van-checkbox{
  156. justify-content: right;
  157. }
  158. .home_wrapper{
  159. background: #f1f2f2;
  160. width: 100vw;
  161. min-height: 100vh;
  162. .return_btn {
  163. width: 24px;
  164. height: 43.2px;
  165. background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  166. background-size: 20px 36px;
  167. position: absolute;
  168. left: 38px;
  169. top: 36px;
  170. }
  171. .focus_head{
  172. height: 450px;
  173. background: url('../../assets/images/sunVillage_info/login_head_code_green.png') no-repeat;
  174. background-size: 100% 100%;
  175. }
  176. .focus_info{
  177. margin-top: -74px;
  178. .icon{
  179. background: url('../../assets/images/sunVillage_info/login_head_t.png') no-repeat;
  180. background-size: 100% 100%;
  181. width: 145px;
  182. height: 148px;
  183. margin:0 auto;
  184. }
  185. .title{
  186. width: 180PX;
  187. height: 52px;
  188. background: url('../../assets/images/sunVillage_info/login_head_nr_code.png') no-repeat;
  189. background-size: 100% 100%;
  190. margin:30px auto 0;
  191. }
  192. }
  193. .login_from{
  194. width: 676px;
  195. height: 350px;
  196. background: url('../../assets/images/sunVillage_info/login_main_green.png') no-repeat;
  197. background-size: 100% 100%;
  198. margin: 50px auto 0;
  199. padding:60px 50px 0;
  200. .flex_block{
  201. margin-bottom: 40px;
  202. display: flex;
  203. justify-content:space-between;
  204. .flex_input_main{
  205. position: relative;
  206. display: flex;
  207. flex: 1;
  208. align-items:center;
  209. background: rgba(255,255,255,0.7);
  210. border-radius: 62px;
  211. height: 62px;
  212. .icon_wrap{
  213. width: 35px;
  214. height: 35px;
  215. &.user{
  216. background: url('../../assets/images/sunVillage_info/login_icon_1.png') no-repeat;
  217. background-size: 100% 100%;
  218. margin-left: 30px;
  219. }
  220. &.password{
  221. background: url('../../assets/images/sunVillage_info/login_icon_2_code.png') no-repeat;
  222. height: 25px;
  223. background-size: 100% 100%;
  224. margin-left: 30px;
  225. }
  226. &.valid{
  227. background: url('../../assets/images/sunVillage_info/login_icon_3.png') no-repeat;
  228. background-size: 100% 100%;
  229. margin-left: 30px;
  230. }
  231. }
  232. .input_wrap{
  233. flex: 1;
  234. margin-left: 16px;
  235. padding-right: 30px;
  236. .ipt{
  237. width: 100%;
  238. height: 48px;
  239. background:transparent;
  240. font-size: 30px;
  241. color: #3f3d56;
  242. }
  243. }
  244. .showHidden{
  245. width: 32px;
  246. height: 32px;
  247. background: url('../../assets/images/sunVillage_info/login_icon_4.png') no-repeat;
  248. background-size: 100% 100%;
  249. position: absolute;
  250. right: 38px;
  251. cursor: pointer;
  252. &.ico_hide{
  253. background: url('../../assets/images/sunVillage_info/login_icon_5.png') no-repeat;
  254. background-size: 100% 100%;
  255. }
  256. }
  257. &.valid{
  258. flex:0 0 380px;
  259. }
  260. }
  261. .valid_main{
  262. width: 165px;
  263. height: 62px;
  264. border-radius: 30px;
  265. img{
  266. width: 100%;
  267. height: 100%;
  268. border-radius: 30px;
  269. }
  270. }
  271. }
  272. }
  273. .login_btn{
  274. padding-top: 80px;
  275. .btn{
  276. width: 315px;
  277. height: 80px;
  278. margin:0 auto;
  279. font-size: 32px;
  280. color: #fff;
  281. text-align: center;
  282. border: none;
  283. }
  284. }
  285. }
  286. </style>