diff --git a/nuxt.config.js b/nuxt.config.js index f23eb4f..44f13f8 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -76,7 +76,7 @@ export default { redirect: { login: '/login', logout: false, - home: false + home: '/' }, strategies: { local: { diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue index a3d7ee1..66ef8f4 100644 --- a/pages/article/_article_id.vue +++ b/pages/article/_article_id.vue @@ -194,7 +194,7 @@ export default { isMobile: state => state.global.isMobile, loggedIn: state => state.auth.loggedIn, user: state => state.auth.user, - avatar: state => state.auth.user.avatarUrl + avatar: state => state.auth.user?.avatarUrl }), hasPermissions() { let account = this.$store.state.auth.user?.nickname; diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index 823a57d..feb3626 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -91,7 +91,7 @@ return true; } } - return this.$auth.hasScope('blog_admin'); + return this.$auth.hasScope('blog_admin') || this.$auth.hasScope('admin'); } }, data() { diff --git a/pages/login.vue b/pages/login.vue index 8347005..5f65c03 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -57,6 +57,7 @@ import {mapState} from 'vuex'; export default { name: "login", middleware: 'auth', + auth: 'guest', data() { return { user: { @@ -93,10 +94,6 @@ export default { _ts.$auth.setUserToken(response.data.token, response.data.refreshToken); if (_ts.historyUrl) { window.location.href = _ts.historyUrl - } else { - _ts.$router.push({ - name: 'index' - }) } } _ts.$set(_ts, 'loginLoading', false); @@ -144,8 +141,14 @@ export default { } }, mounted() { - this.$store.commit('setActiveMenu', 'login'); - this.$set(this, 'historyUrl', this.$route.query.historyUrl || ''); + let _ts = this + _ts.$store.commit('setActiveMenu', 'login'); + _ts.$set(_ts, 'historyUrl', _ts.$route.query.historyUrl || ''); + // if (_ts.$auth.loggedIn) { + // _ts.$router.push({ + // name: 'index' + // }) + // } } } diff --git a/pages/topic/_topic_uri.vue b/pages/topic/_topic_uri.vue index 95e224f..05e62ec 100644 --- a/pages/topic/_topic_uri.vue +++ b/pages/topic/_topic_uri.vue @@ -22,7 +22,8 @@ export default { topic => topic.topicUri === params.topic_uri ) }, - fetch({store, params, query}) { + fetch() { + let {store, params, query} = this.$nuxt.context params.page = query.page || 1 return Promise.all([ store.dispatch('article/fetchList', params) diff --git a/store/open-data.js b/store/open-data.js index 2d168f2..db0c8fb 100644 --- a/store/open-data.js +++ b/store/open-data.js @@ -8,7 +8,8 @@ export const OPEN_DATA_API_PATH = '/api/open-data' const getDefaultDashboardData = () => { return { - dashboard: {} + countUserNum: 0, + countArticleNum: 0 } }