feat: Add Dockerfile and Docker-compose
This commit is contained in:
parent
7148fe0846
commit
acdfecc5f6
@ -1,9 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<a-avatar src="/logo.png" :size="40" />
|
<a-avatar src="/logo.png" :size="50" />
|
||||||
<span>竞赛管理系统</span>
|
<span>竞赛管理系统</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<a-form-model
|
<a-form-model
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
@ -12,7 +11,6 @@
|
|||||||
:rules="rules"
|
:rules="rules"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a-form-model-item ref="sTId" prop="sTId">
|
<a-form-model-item ref="sTId" prop="sTId">
|
||||||
<a-input v-model="formData.sTId" placeholder="学号/工号">
|
<a-input v-model="formData.sTId" placeholder="学号/工号">
|
||||||
<a-icon
|
<a-icon
|
||||||
@ -41,50 +39,51 @@
|
|||||||
登录
|
登录
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {login} from '@/api/index'
|
import { login } from "@/api/index";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: "Login",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
svg: '',
|
svg: "",
|
||||||
formData: {
|
formData: {
|
||||||
sTId: '213010127',
|
sTId: "213010127",
|
||||||
password: '0127',
|
password: "0127",
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
sTId: { required: true, message: '请输入学号/工号!' },
|
sTId: { required: true, message: "请输入学号/工号!" },
|
||||||
password: { required: true, message: '请输入密码!' },
|
password: { required: true, message: "请输入密码!" },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
async onSubmit(e) {
|
async onSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
await this.$refs.form.validate();
|
await this.$refs.form.validate();
|
||||||
// 用户登录
|
// 用户登录
|
||||||
let formData = { sTId: this.formData.sTId, password: this.formData.password }
|
let formData = {
|
||||||
const res= await login(formData)
|
sTId: this.formData.sTId,
|
||||||
if(res.code==200){
|
password: this.formData.password,
|
||||||
window.localStorage.setItem("token",res.data)// 使用 dispatch 方法触发 action
|
};
|
||||||
this.$store.dispatch('initUser');
|
const res = await login(formData);
|
||||||
await this.$router.replace({ path: '/' }).catch(e => e);
|
if (res.code == 200) {
|
||||||
this.$message.success(`${timeFix()},欢迎回来`);
|
window.localStorage.setItem("token", res.data); // 使用 dispatch 方法触发 action
|
||||||
}else{
|
this.$store.dispatch("initUser");
|
||||||
this.$message.error(error);
|
await this.$router.replace({ path: "/" }).catch((e) => e);
|
||||||
}
|
this.$message.success(`${timeFix()},欢迎回来`);
|
||||||
|
} else {
|
||||||
|
this.$message.error(error);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$message.error("登录失败请检查账号或密码"||e);
|
this.$message.error("登录失败请检查账号或密码" || e);
|
||||||
if (!e) return; // 表单校验
|
if (!e) return; // 表单校验
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@ -95,7 +94,15 @@ export default {
|
|||||||
function timeFix() {
|
function timeFix() {
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
const hour = time.getHours();
|
const hour = time.getHours();
|
||||||
return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好';
|
return hour < 9
|
||||||
|
? "早上好"
|
||||||
|
: hour <= 11
|
||||||
|
? "上午好"
|
||||||
|
: hour <= 13
|
||||||
|
? "中午好"
|
||||||
|
: hour < 20
|
||||||
|
? "下午好"
|
||||||
|
: "晚上好";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import store from '@/store';
|
|||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
baseURL: 'http://js.shuguangwl.com:8887',
|
baseURL: 'http://localhost:8887',
|
||||||
// 设置基础URL
|
// 设置基础URL
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user