From 89863a416fa36747ac8b23e5474dba0e610f2f63 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 9 Mar 2018 00:05:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/haomo/pages/login/HmLogin.vue | 70 +++++++++++++++++++------ src/views/haomo/pages/login/index.vue | 14 ++++- 2 files changed, 65 insertions(+), 19 deletions(-) diff --git a/src/views/haomo/pages/login/HmLogin.vue b/src/views/haomo/pages/login/HmLogin.vue index ecbbf05..9696aa8 100644 --- a/src/views/haomo/pages/login/HmLogin.vue +++ b/src/views/haomo/pages/login/HmLogin.vue @@ -1,23 +1,23 @@ <template> <el-row type="flex"> - <el-col :span="10" class="detail-content" style="margin:0 auto" > - <el-form style="border: 0.5px solid #e6ebf5"> - <el-row type="flex"> - <el-col style="height: 45px;background-color: #00BF8B" ></el-col> - </el-row> - <el-row type="flex" style="margin-top:35px"> - <el-col style="margin: 0 auto;height: 70px;width:433px;text-align: center;line-height: 70px;font-size: 35px;color:#586C8C;font-weight: bold" > - <img />å¼ å®¶å£äººæ°‘检察院 - </el-col> - </el-row> - <el-form-item prop="pass"> - <el-input class="style" style="width:433px;margin: 0 auto;margin-top:25px;display: block;" prefix-icon="el-icon-search" auto-complete="off"></el-input> + <el-col :span="options.span" class="detail-content" style="margin:0 auto;border: 0.5px solid #e6ebf5" > + <el-row type="flex"> + <el-col style="height: 45px;background-color: #00BF8B" ></el-col> + </el-row> + <el-row type="flex" style="margin-top:30px"> + <el-col style="margin: 0 auto;height: 70px;width:433px;text-align: center;line-height: 70px;font-size: 35px;color:#586C8C;font-weight: bold" > + <img />å¼ å®¶å£äººæ°‘检察院 + </el-col> + </el-row> + <el-form :model="hm_form" status-icon :rules="rules2" ref="hm_form" style="width: 433px;margin: 0 auto;"> + <el-form-item prop="account"> + <el-input class="style" placeholder="请输入账å·" v-model="hm_form.account" style="margin-top:25px;display: block;" prefix-icon="el-icon-search" auto-complete="off"></el-input> </el-form-item> - <el-form-item prop="checkPass"> - <el-input type="password" style="width:433px;margin: 0 auto;display: block;border-width: 0px;border-bottom-width: 1px;border-radius: 0px;" prefix-icon="el-icon-search" suffix-icon="el-icon-view" auto-complete="off"></el-input> + <el-form-item prop="pass"> + <el-input type="password" placeholder="请输入密ç " v-model="hm_form.pass" style="display: block;border-width: 0px;border-bottom-width: 1px;border-radius: 0px;" prefix-icon="el-icon-search" suffix-icon="el-icon-view" auto-complete="off"></el-input> </el-form-item> <el-form-item> - <el-button type="success" style="width: 178px;height: 44px ;font-size:16px;background-color: #00BF8B;margin: 0 auto;display: block">æäº¤</el-button> + <el-button type="success" @click="submitForm('hm_form',options)" style="width: 178px;height: 44px ;font-size:16px;background-color: #00BF8B;margin: 0 auto;display: block">æäº¤</el-button> </el-form-item> </el-form> </el-col> @@ -38,7 +38,34 @@ } }, data() { - + var account = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入账å·')) + } else { + callback() + } + } + var pass = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入密ç ')) + } else { + callback() + } + } + return { + hm_form: { + account: '', + pass: '' + }, + rules2: { + account: [ + { validator: account, trigger: 'blur' } + ], + pass: [ + { validator: pass, trigger: 'blur' } + ] + } + } }, computed: { }, @@ -47,7 +74,16 @@ created() { }, methods: { - + submitForm(formName, callback) { + this.$refs[formName].validate((valid) => { + if (valid) { + alert('submit!' + JSON.stringify(callback)) + } else { + console.log('error submit!!') + return false + } + }) + } } } </script> diff --git a/src/views/haomo/pages/login/index.vue b/src/views/haomo/pages/login/index.vue index e77af16..42d05de 100644 --- a/src/views/haomo/pages/login/index.vue +++ b/src/views/haomo/pages/login/index.vue @@ -1,6 +1,6 @@ <template> <div> - <hm-login></hm-login> + <hm-login :options="options"></hm-login> </div> </template> @@ -21,8 +21,18 @@ filters: { }, created() { + this.options = { + spx: function(account, pass) { + alert(account + pass) + }, + span: 10 + } }, - methods: {} + methods: { + test: function() { + alert(4) + } + } } </script> <style scoped> -- 2.21.0