Skip to content

Commit 642690b

Browse files
committed
blog.vue 2.0 : Home Page Revision
1 parent 7f78a62 commit 642690b

20 files changed

+861
-138
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "blogvue",
2+
"name": "Blog.Vue",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

public/favicon.ico

3.06 KB
Binary file not shown.

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8-
<title>blogvue3</title>
8+
<title>Blog.Vue</title>
99
</head>
1010
<body>
1111
<noscript>

src/App.vue

+75-66
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,92 @@
11
<template>
2-
<div id="app">
3-
<div id="nav">
4-
<router-link to="/">Home</router-link> |
5-
<router-link to="/about">Form</router-link> |
6-
<router-link to="/Vuex">Vuex</router-link> |
7-
<router-link to="/Login">Login</router-link>
2+
<div id="app">
3+
<div id="nav">
4+
<router-link to="/">Home</router-link>
5+
|
6+
<router-link to="/home2">Home2</router-link>
7+
|
8+
<router-link to="/about">Form</router-link>
9+
|
10+
<router-link to="/Vuex">Vuex</router-link>
11+
|
12+
<router-link to="/Login">Login</router-link>
813

914

10-
<!--<span align-end style="cursor: pointer;">-->
11-
<!--<template v-if="!user.isAuthenticated">-->
12-
<!--<span icon="person"></span>-->
13-
<!--<span @click="login">Login</span>-->
14-
<!--</template>-->
15-
<!--<template v-else>-->
16-
<!--<span style="color: darkcyan;">{{ user.name }}</span>-->
17-
<!--<span icon="person"></span>-->
18-
<!--<span @click="logout"> 退出</span>-->
19-
<!--</template>-->
20-
<!--</span>-->
15+
<!--<span align-end style="cursor: pointer;">-->
16+
<!--<template v-if="!user.isAuthenticated">-->
17+
<!--<span icon="person"></span>-->
18+
<!--<span @click="login">Login</span>-->
19+
<!--</template>-->
20+
<!--<template v-else>-->
21+
<!--<span style="color: darkcyan;">{{ user.name }}</span>-->
22+
<!--<span icon="person"></span>-->
23+
<!--<span @click="logout"> 退出</span>-->
24+
<!--</template>-->
25+
<!--</span>-->
26+
</div>
27+
<router-view/>
2128
</div>
22-
<router-view/>
23-
</div>
2429
</template>
2530

2631
<script>
27-
import applicationUserManager from "./Auth/applicationusermanager";
28-
import userAuth from "./Auth/UserAuth";
29-
export default {
30-
name: "app",
31-
mixins: [userAuth],
32-
data: function() {
33-
return {};
34-
},
35-
watch: {
36-
async $route(to, from) {
37-
await this.refreshUserInfo();
38-
}
39-
},
40-
methods: {
41-
async login() {
42-
try {
43-
await applicationUserManager.login();
44-
} catch (error) {
45-
console.log(error);
46-
this.$root.$emit("show-snackbar", { message: error });
47-
}
48-
},
49-
async logout() {
50-
try {
51-
await applicationUserManager.logout();
52-
this.$store.commit("saveToken", "");
32+
import applicationUserManager from "./Auth/applicationusermanager";
33+
import userAuth from "./Auth/UserAuth";
5334
54-
} catch (error) {
55-
console.log(error);
56-
this.$root.$emit("show-snackbar", { message: error });
57-
}
58-
}
59-
}
60-
};
35+
export default {
36+
name: "app",
37+
mixins: [userAuth],
38+
data: function () {
39+
return {};
40+
},
41+
watch: {
42+
async $route(to, from) {
43+
// await this.refreshUserInfo();
44+
}
45+
},
46+
methods: {
47+
async login() {
48+
try {
49+
await applicationUserManager.login();
50+
} catch (error) {
51+
console.log(error);
52+
this.$root.$emit("show-snackbar", {message: error});
53+
}
54+
},
55+
async logout() {
56+
try {
57+
await applicationUserManager.logout();
58+
this.$store.commit("saveToken", "");
59+
60+
} catch (error) {
61+
console.log(error);
62+
this.$root.$emit("show-snackbar", {message: error});
63+
}
64+
}
65+
}
66+
};
6167
</script>
6268

6369
<style lang="css">
64-
@import "./style/stylehome.css";
70+
@import "./style/stylehome.css";
71+
@import "./style/base.css";
72+
@import "./style/m.css";
6573
</style>
6674

6775

6876
<style lang="stylus">
69-
#app
70-
font-family 'Avenir', Helvetica, Arial, sans-serif
71-
-webkit-font-smoothing antialiased
72-
-moz-osx-font-smoothing grayscale
73-
text-align center
74-
color #2c3e50
77+
#app
78+
font-family 'Avenir', Helvetica, Arial, sans-serif
79+
-webkit-font-smoothing antialiased
80+
-moz-osx-font-smoothing grayscale
81+
color #2c3e50
82+
83+
#nav
84+
padding 30px
85+
text-align center
7586
76-
#nav
77-
padding 30px
78-
a
79-
font-weight bold
80-
color #2c3e50
81-
&.router-link-exact-active
82-
color #42b983
87+
a
88+
font-weight bold
89+
color #2c3e50
90+
&.router-link-exact-active
91+
color #42b983
8392
</style>

src/api/http.js

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ axios.interceptors.response.use(
5454
if (error.response) {
5555
switch (error.response.status) {
5656
case 401:
57+
debugger
5758
// 返回 401 清除token信息并跳转到登录页面
5859
store.commit("saveToken", "");
5960
router.replace({

src/assets/QQGroup.png

20.2 KB
Loading

src/assets/c01.png

927 Bytes
Loading

src/assets/c02.png

765 Bytes
Loading

src/assets/c03.png

879 Bytes
Loading

src/assets/c04.png

825 Bytes
Loading

src/assets/cnblogs.png

2.1 KB
Loading

src/assets/github.png

23.5 KB
Loading

src/assets/longad.jpg

88.2 KB
Loading

src/router.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ const router = new Router({
4343
name: "LoginCallbackView",
4444
component: LoginCallbackView
4545
},
46-
{
47-
path: "/about",
48-
name: "about",
49-
// route level code-splitting
50-
// this generates a separate chunk (about.[hash].js) for this route
51-
// which is lazy-loaded when the route is visited.
52-
component: () =>
53-
import(/* webpackChunkName: "about" */ "./views/Form.vue")
54-
}
46+
{
47+
path: "/about",
48+
name: "about",
49+
component: () =>
50+
import(/* webpackChunkName: "about" */ "./views/Form.vue")
51+
},
52+
{
53+
path: "/home2",
54+
name: "home2",
55+
component: () =>
56+
import(/* webpackChunkName: "about" */ "./views/Home2.vue")
57+
}
5558
]
5659
});
5760

0 commit comments

Comments
 (0)