temp:首页布局

This commit is contained in:
fanxb 2022-03-21 22:08:26 +08:00
parent 40290e6ac8
commit b83612681f
10 changed files with 82 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -0,0 +1,19 @@
<template>
<div class="bottom">这是首页的底部</div>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "homeTop",
data() {
return {};
},
};
</script>
<style lang="less" scoped>
.bottom {
height: 0.2rem;
}
</style>

View File

@ -1,5 +1,8 @@
<template> <template>
<div></div> <div class="top">
<div>应用</div>
<div>头像</div>
</div>
</template> </template>
<script> <script>
@ -15,4 +18,14 @@ export default {
}; };
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped>
.top {
height: 0.8rem;
overflow: hidden;
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 0.4rem;
padding-right: 0.4rem;
}
</style>

View File

@ -28,10 +28,12 @@ export default {
methods: { methods: {
async menuClick({ key }) { async menuClick({ key }) {
if (key === "logout") { if (key === "logout") {
//
await this.$store.dispatch("treeData/clear");
await this.$store.dispatch("globalConfig/clear"); await this.$store.dispatch("globalConfig/clear");
this.$router.replace("/public/login"); this.$router.replace("/public/login");
} else if (key === "personSpace") { } else if (key === "personSpace") {
this.$router.push("/personSpace/userInfo"); this.$router.push("/manage/personSpace/userInfo");
} }
}, },
}, },

View File

@ -12,6 +12,7 @@ const routes = [
path: "/manage", path: "/manage",
component: () => import("@/views/manage/index"), component: () => import("@/views/manage/index"),
children: [ children: [
{ path: "", redirect: "/manage/bookmarkTree" },
{ path: "bookmarkTree", component: () => import("@/views/manage/bookmarkTree/index") }, { path: "bookmarkTree", component: () => import("@/views/manage/bookmarkTree/index") },
{ path: "personSpace/userInfo", component: () => import("@/views/manage/personSpace/index") }, { path: "personSpace/userInfo", component: () => import("@/views/manage/personSpace/index") },
] ]
@ -46,7 +47,9 @@ router.beforeEach(async (to, from, next) => {
let supportNoLogin = to.path === '/' || to.path.startsWith("/public"); let supportNoLogin = to.path === '/' || to.path.startsWith("/public");
vuex.default.commit(GLOBAL_CONFIG + "/" + SUPPORT_NO_LOGIN, supportNoLogin); vuex.default.commit(GLOBAL_CONFIG + "/" + SUPPORT_NO_LOGIN, supportNoLogin);
if (!supportNoLogin && !checkJwtValid(vuex.default.state[GLOBAL_CONFIG][TOKEN])) { if (!supportNoLogin && !checkJwtValid(vuex.default.state[GLOBAL_CONFIG][TOKEN])) {
//如不支持未登录进入切jwt已过期直接跳转到登录页面 //如不支持未登录进入切jwt已过期直接跳转到登录页面,并清理缓存
await vuex.default.dispatch("treeData/clear");
await vuex.default.dispatch("globalConfig/clear");
next({ next({
path: "/public/login?to=" + btoa(location.href), path: "/public/login?to=" + btoa(location.href),
replace: true replace: true

View File

@ -43,6 +43,9 @@ async function request (url, method, params, body, isForm, redirect) {
} else if (code === -1 && redirect) { } else if (code === -1 && redirect) {
//未登陆根据redirect参数判断是否需要跳转到登陆页 //未登陆根据redirect参数判断是否需要跳转到登陆页
window.vueInstance.$message.error("您尚未登陆,请先登陆"); window.vueInstance.$message.error("您尚未登陆,请先登陆");
//跳转到登录页面需要清理缓存
await this.$store.dispatch("treeData/clear");
await this.$store.dispatch("globalConfig/clear");
router.replace(`/public/login?redirect=${encodeURIComponent(router.currentRoute.fullPath)}`); router.replace(`/public/login?redirect=${encodeURIComponent(router.currentRoute.fullPath)}`);
throw new Error(message); throw new Error(message);
} else if (code === 0) { } else if (code === 0) {

View File

@ -1,12 +0,0 @@
<template>
<div class="main">表头</div>
</template>
<script>
export default {};
</script>
<style lang="less" scoped>
.main {
}
</style>

View File

@ -1,13 +1,24 @@
<template> <template>
<div class="main">这是主页面</div> <div class="main">
<top />
<div class="content">
<search style="width: 60%" />
<div>书签收藏区</div>
</div>
<bottom />
</div>
</template> </template>
<script> <script>
import header from "./header.vue"; import Top from "@/layout/home/Top.vue";
import Bottom from "@/layout/home/Bottom.vue";
import Search from "@/components/main/Search.vue";
export default { export default {
name: "HOME", name: "HOME",
components: { components: {
header, Top,
Bottom,
Search,
}, },
data() { data() {
return {}; return {};
@ -20,5 +31,16 @@ export default {
.main { .main {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
background: url("/static/img/homeBg.jpg") no-repeat center center;
background-size: cover;
background-attachment: fixed;
.content {
height: calc(~"100vh" - 1.01rem);
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
} }
</style> </style>

View File

@ -5,12 +5,12 @@
<a-form-model ref="loginForm" :model="form" :rules="rules"> <a-form-model ref="loginForm" :model="form" :rules="rules">
<a-form-model-item prop="str" ref="str"> <a-form-model-item prop="str" ref="str">
<a-input v-model="form.str" placeholder="邮箱/用户名"> <a-input v-model="form.str" placeholder="邮箱/用户名">
<a-icon slot="prefix" type="user" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="user" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="password"> <a-form-model-item prop="password">
<a-input v-model="form.password" placeholder="密码" type="password"> <a-input v-model="form.password" placeholder="密码" type="password">
<a-icon slot="prefix" type="password" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="password" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<div class="reset"> <div class="reset">
@ -45,7 +45,7 @@ export default {
Header, Header,
}, },
computed: { computed: {
...mapState("globalConfig", ["serverConfig"]) ...mapState("globalConfig", ["serverConfig"]),
}, },
data() { data() {
return { return {
@ -72,10 +72,6 @@ export default {
async created() { async created() {
let _this = this; let _this = this;
window.addEventListener("storage", this.storageDeal.bind(this)); window.addEventListener("storage", this.storageDeal.bind(this));
//
await this.$store.dispatch("treeData/clear");
await this.$store.dispatch("globalConfig/clear");
}, },
destroyed() { destroyed() {
window.removeEventListener("storage", this.storageDeal); window.removeEventListener("storage", this.storageDeal);

View File

@ -5,22 +5,22 @@
<a-form-model ref="registerForm" :model="form" :rules="rules"> <a-form-model ref="registerForm" :model="form" :rules="rules">
<a-form-model-item prop="username"> <a-form-model-item prop="username">
<a-input v-model="form.username" placeholder="用户名"> <a-input v-model="form.username" placeholder="用户名">
<a-icon slot="prefix" type="user" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="user" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="email"> <a-form-model-item prop="email">
<a-input v-model="form.email" placeholder="邮箱"> <a-input v-model="form.email" placeholder="邮箱">
<a-icon slot="prefix" type="password" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="password" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="password"> <a-form-model-item prop="password">
<a-input v-model="form.password" placeholder="密码" type="password"> <a-input v-model="form.password" placeholder="密码" type="password">
<a-icon slot="prefix" type="password" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="password" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="repeatPass"> <a-form-model-item prop="repeatPass">
<a-input v-model="form.repeatPass" placeholder="重复密码" type="password"> <a-input v-model="form.repeatPass" placeholder="重复密码" type="password">
<a-icon slot="prefix" type="password" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="password" style="color: rgba(0, 0, 0, 0.25)" />
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
@ -66,7 +66,8 @@ export default {
], ],
email: [ email: [
{ {
pattern: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, pattern:
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
message: "请输入正确的邮箱", message: "请输入正确的邮箱",
trigger: "change", trigger: "change",
}, },
@ -79,11 +80,6 @@ export default {
}, },
}; };
}, },
async created() {
//
await this.$store.dispatch("treeData/clear");
await this.$store.dispatch("globalConfig/clear");
},
methods: { methods: {
submit() { submit() {
let _this = this; let _this = this;