From 355d7d39a67bc1fc27ed1e391799ff7fcc3b2aa7 Mon Sep 17 00:00:00 2001 From: zhangyanpeng <bob.zhang@highdatas.com> Date: 星期二, 11 二月 2020 14:23:42 +0800 Subject: [PATCH] Merge branch 'master' of http://highdatas.com:9000/r/~kimi/srs --- src/views/login.vue | 92 ++++++++++++++++++++++++++++++---------------- 1 files changed, 60 insertions(+), 32 deletions(-) diff --git a/src/views/login.vue b/src/views/login.vue index 68e1970..816158a 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,37 +1,39 @@ <template> - <div class="login"> + <div class="login" ref="hello_div"> <!-- <div class="img-container"> <img :src="loginImg" alt=""> </div> --> - <el-form ref="loginForm" :model="loginForm" class="login-form" label-position="left"> - <el-form-item prop="loginName"> - <el-input - v-model="loginForm.loginName" - placeholder="杈撳叆鐢ㄦ埛鍚�" - name="loginName" - type="text" - - > - - </el-input> - </el-form-item> - <el-form-item prop="password"> - <el-input - :type="passwordType" - v-model="loginForm.password" - placeholder="杈撳叆瀵嗙爜" - name="password" - - @keyup.enter.native="handleLogin" - > - <span slot="suffix" class="suffix-icon" :class="{eyeOpen: isOpen}" @click="showPwd"> - <svg-icon :icon-class="eyeIconClass" /> - </span> - </el-input> - </el-form-item> - - <el-button :loading="loading" class="loginButton" type="primary" @click.native.prevent="handleLogin">鐧诲綍</el-button> - </el-form> + <div class="login_" ref="logon_div"> + <el-form ref="loginForm" :model="loginForm" class="login-form" label-position="left"> + <el-form-item prop="loginName"> + <el-input + v-model="loginForm.loginName" + placeholder="杈撳叆鐢ㄦ埛鍚�" + name="loginName" + type="text" + + > + + </el-input> + </el-form-item> + <el-form-item prop="password"> + <el-input + :type="passwordType" + v-model="loginForm.password" + placeholder="杈撳叆瀵嗙爜" + name="password" + + @keyup.enter.native="handleLogin" + > + <span slot="suffix" class="suffix-icon" :class="{eyeOpen: isOpen}" @click="showPwd"> + <svg-icon :icon-class="eyeIconClass" /> + </span> + </el-input> + </el-form-item> + + <el-button :loading="loading" class="loginButton" type="primary" @click.native.prevent="handleLogin">鐧诲綍</el-button> + </el-form> + </div> </div> </template> @@ -56,8 +58,31 @@ isOpen: false // 鏍规嵁鐘舵�佹樉绀轰笉鍚屾牱寮忕被鍚� } }, + + mounted() { + this.setWH(); + }, methods: { + setWH() { + //鑾峰彇灞忓箷瀹藉害 + let hello_Width = this.$refs.hello_div.offsetWidth; + // let hello_Height = this.$refs.hello_div.offsetHeight; + let hello_Height = document.documentElement.clientHeight; + //鑾峰彇鐧诲綍鍏冪礌瀹藉害 + let logon_Width = this.$refs.logon_div.offsetWidth; + let logon_Height = this.$refs.logon_div.offsetHeight; + //璁剧疆鐧诲綍鍏冪礌鐨刴agin-left + if (hello_Width>logon_Width) { + let margin_left = (hello_Width - logon_Width)/2; + this.$refs.logon_div.style['margin-left'] = margin_left + "px"; + } + + if (hello_Height>logon_Height) { + let margin_top = (hello_Height - logon_Height)/2; + this.$refs.logon_div.style['margin-top'] = margin_top + "px"; + } + }, // 蹇樿瀵嗙爜鍥炶皟 // 娓呴櫎鐢ㄦ埛鍚� @@ -82,7 +107,6 @@ this.$axios.get(url,{ params }).then(data_ => { - console.log(data_); if(data_.data.success) { localStorage.setItem('userId',data_.data.data.id); localStorage.setItem('userName',data_.data.data.name); @@ -96,7 +120,6 @@ } }).catch(error =>{ - console.log(error); }) @@ -106,5 +129,10 @@ </script> <style > + .login_ { + max-width: 350px; + background-color: #f9f9fb; + padding: 20px; + } </style> -- Gitblit v1.8.0