|
|
@@ -11,16 +11,25 @@
|
|
|
<div class="title-right">智慧运力运维平台</div>
|
|
|
</div>
|
|
|
<div class="form-container">
|
|
|
- <el-form :model="ruleForm" :rules="rules">
|
|
|
+ <el-form :model="ruleForm" :rules="rules" ref="form">
|
|
|
<el-form-item prop="phone">
|
|
|
- <el-input placeholder="请输入手机号" v-model="ruleForm.phone">
|
|
|
+ <el-input
|
|
|
+ @blur="check"
|
|
|
+ placeholder="请输入手机号"
|
|
|
+ v-model="ruleForm.phone"
|
|
|
+ >
|
|
|
<template v-slot:prepend>
|
|
|
<el-button icon="el-icon-mobile-phone"></el-button>
|
|
|
</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="password">
|
|
|
- <el-input placeholder="请输入密码" v-model="ruleForm.password">
|
|
|
+ <el-input
|
|
|
+ @blur="check"
|
|
|
+ type="password"
|
|
|
+ placeholder="请输入密码"
|
|
|
+ v-model="ruleForm.password"
|
|
|
+ >
|
|
|
<template v-slot:prepend>
|
|
|
<el-button icon="el-icon-lock"></el-button>
|
|
|
</template>
|
|
|
@@ -28,7 +37,12 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button
|
|
|
- style="width: 384px; height: 48px; border-radius: 2px"
|
|
|
+ style="
|
|
|
+ width: 384px;
|
|
|
+ height: 48px;
|
|
|
+ border-radius: 2px;
|
|
|
+ margin-top: 40px;
|
|
|
+ "
|
|
|
type="primary"
|
|
|
@click="login('ruleForm')"
|
|
|
>
|
|
|
@@ -46,34 +60,90 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { ref, reactive, toRefs } from "vue";
|
|
|
+import { Notification } from "element3";
|
|
|
+import store from "../../store";
|
|
|
+import router from "../../router";
|
|
|
+
|
|
|
+import md5 from "md5";
|
|
|
+import api from "../../apis/fetch";
|
|
|
+
|
|
|
export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
+ setup() {
|
|
|
+ function print() {
|
|
|
+ this.$check();
|
|
|
+ }
|
|
|
+ const form = ref(null);
|
|
|
+ const ruleForm = reactive({
|
|
|
ruleForm: {
|
|
|
phone: "",
|
|
|
password: "",
|
|
|
},
|
|
|
+ });
|
|
|
+
|
|
|
+ const rules = reactive({
|
|
|
rules: {
|
|
|
phone: [
|
|
|
{ required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
{ min: 11, max: 11, message: "请正确输入手机号", trigger: "blur" },
|
|
|
],
|
|
|
+ password: [
|
|
|
+ { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
+ { min: 6, max: 20, message: "请正确输入手机号", trigger: "blur" },
|
|
|
+ ],
|
|
|
},
|
|
|
- password: [
|
|
|
- { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
- { min: 6, max: 20, message: "请正确输入手机号", trigger: "blur" },
|
|
|
- ],
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- login() {
|
|
|
- this.$store.commit("changeLogin", true);
|
|
|
- localStorage.setItem("userid", 3);
|
|
|
- this.$router.push({ path: "/" });
|
|
|
- },
|
|
|
- goBeian() {
|
|
|
+ });
|
|
|
+ function check() {
|
|
|
+ form.value.validate((valid) => {});
|
|
|
+ }
|
|
|
+ function login() {
|
|
|
+ form.value.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let { phone, password } = ruleForm.ruleForm;
|
|
|
+ let res = await api.staffLogin({
|
|
|
+ phone,
|
|
|
+ password: md5(password).toUpperCase(),
|
|
|
+ });
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ Notification.success({
|
|
|
+ title: "成功",
|
|
|
+ duration: 2000,
|
|
|
+ message: res.data.msg,
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ let { id, staffName, staffPhone, status } = res.data.result;
|
|
|
+ localStorage.setItem("id", id);
|
|
|
+ localStorage.setItem("staffName", staffName);
|
|
|
+ localStorage.setItem("staffPhone", staffPhone);
|
|
|
+ localStorage.setItem("status", status);
|
|
|
+ store.commit("changeLogin", true);
|
|
|
+ router.replace({ path: "/" });
|
|
|
+ } else {
|
|
|
+ Notification.error({
|
|
|
+ title: "错误",
|
|
|
+ duration: 3000,
|
|
|
+ message: res.data.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function goBeian() {
|
|
|
window.open("https://beian.miit.gov.cn/");
|
|
|
- },
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ form,
|
|
|
+ ...toRefs(ruleForm),
|
|
|
+ ...toRefs(rules),
|
|
|
+ login,
|
|
|
+ check,
|
|
|
+ goBeian,
|
|
|
+ };
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -151,10 +221,6 @@ export default {
|
|
|
width: 384px;
|
|
|
}
|
|
|
|
|
|
-.el-input-group {
|
|
|
- border: 1px solid #0094fe !important;
|
|
|
- border-radius: 5px;
|
|
|
-}
|
|
|
.copyright {
|
|
|
position: absolute;
|
|
|
width: 520px;
|