|
|
@@ -0,0 +1,90 @@
|
|
|
+<template>
|
|
|
+ <div style="text-align: center;font-size: 30px;margin-top: 40px;">登 录</div>
|
|
|
+ <div style="margin: 80px;">
|
|
|
+ <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item label="账号" prop="username">
|
|
|
+ <el-input type="text" v-model="ruleForm.username" autocomplete="off" placeholder="请输入账号"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input type="password" v-model="ruleForm.password" autocomplete="off" placeholder="请输入密码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <div style="width: 100%;text-align: center;margin-top: 50px;">
|
|
|
+ <el-button type="primary" style="width: 100%;" @click="submitForm('ruleForm')">登 录</el-button>
|
|
|
+ </div>
|
|
|
+ <!-- <el-form-item style="padding-top: 20px;">
|
|
|
+ <el-button type="primary" style="width: 100%;" @click="submitForm('ruleForm')">登录</el-button>
|
|
|
+ <el-button @click="resetForm('ruleForm')">重置</el-button>
|
|
|
+ </el-form-item> -->
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import encrypt from "@/utils/encrypt";
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ ruleForm: {
|
|
|
+ username: '',
|
|
|
+ password: '',
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ username: [
|
|
|
+ { required: true, message: '请输入账号', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ password: [
|
|
|
+ { required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ close: Function,
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ submitForm(formName) {
|
|
|
+ let that = this;
|
|
|
+ that.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // console.log('submit!');
|
|
|
+ encrypt(that.ruleForm).then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ that.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "登录成功",
|
|
|
+ });
|
|
|
+ that.close();
|
|
|
+ }).catch((err) => {
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: err,
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetForm(formName) {
|
|
|
+ let that = this;
|
|
|
+ that.$refs[formName].resetFields();
|
|
|
+ },
|
|
|
+ handleCommand(command) {
|
|
|
+ let that = this;
|
|
|
+ that.$message({
|
|
|
+ type: "info",
|
|
|
+ message: `Click on item ${command}`,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+ :deep(.el-form-item--label-right .el-form-item__label) {
|
|
|
+ justify-content: flex-end;
|
|
|
+ text-align: right;
|
|
|
+ width: auto !important;
|
|
|
+ }
|
|
|
+</style>
|