You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.9 KiB

3 years ago
<template>
<div class="page-container">
<div class="page-outer">
3 years ago
<div class="big-title">
星途内容数字化管理后台
</div>
3 years ago
<div class="login-box" v-if="status == 1">
3 years ago
<div class="login-title">
<span class="login-title-item">账户登录</span>
</div>
3 years ago
<el-form>
3 years ago
<el-form-item size="default" label="账号"><el-input v-model="form.name" placeholder="账号" /></el-form-item>
<el-form-item size="default" label="密码"><el-input type="password" v-model="form.password" placeholder="密码" /></el-form-item>
<el-form-item><el-button size="default" type="primary" style="width: 100%;margin-top: 24px" @click="submit"> </el-button></el-form-item>
3 years ago
</el-form>
</div>
3 years ago
<div class="footer">
3 years ago
<el-link href="https://beian.miit.gov.cn" target="_blank">京ICP备13018361号-1</el-link>
3 years ago
</div>
3 years ago
</div>
</div>
</template>
<script>
import { useStore } from "vuex";
3 years ago
import { defineComponent, reactive, ref, getCurrentInstance } from "vue";
3 years ago
export default defineComponent({
name: 'v-login',
setup() {
const { proxy } = getCurrentInstance();
const store = useStore();
const form = reactive({
3 years ago
name: "",
password: "",
3 years ago
});
3 years ago
const regForm = reactive({
name: "",
password: "",
tel: "",
realName: ''
});
const status = ref(1); //1登录 2注册
3 years ago
return {
3 years ago
form,regForm,
status,
3 years ago
proxy,
store
};
},
methods: {
submit() {
3 years ago
this.proxy.$post("/admin/login", this.form).then((res) => {
const data = res.data;
3 years ago
if(res.code == 200) {
this.store.commit("setToken", data.token);
this.store.commit("setUserInfo", data);
this.$message.success("登录成功");
this.$router.push('/');
} else {
this.$message.error(res.msg);
}
}).catch(() => {});
3 years ago
},
},
});
</script>
<style lang="less" scoped>
.page-container {
3 years ago
background: rgb(242, 242, 242);
3 years ago
position: relative;
width: 100%;
height: 100%;
3 years ago
display: flex;
align-items: center;
justify-content: center;
3 years ago
.page-outer {
width: 400px;
3 years ago
padding-top: 72px;
.big-title {
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 32px;
line-height: 22px;
padding-bottom: 72px;
}
3 years ago
.login-box {
background: #FFF;
3 years ago
padding: 36px;
.login-title {
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 36px;
.login-title-item {
font-weight: 500;
font-size: 16px;
line-height: 22px;
}
}
};
.footer {
display: flex;
align-items: center;
justify-content: center;
margin-top: 180px
3 years ago
}
3 years ago
}
}
</style>