文章评论模块加载问题修复

This commit is contained in:
x ronger 2020-08-02 19:24:48 +08:00
parent 47984f5638
commit ffe8c1879e
3 changed files with 5 additions and 10 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row class="pt-5"> <el-row class="pt-5">
<el-col> <el-col>
<el-col v-show="user" style="margin-top: 1rem;"> <el-col v-if="user" style="margin-top: 1rem;">
<el-col :xs="2" :sm="1" :xl="1"> <el-col :xs="2" :sm="1" :xl="1">
<el-avatar :src="avatar"></el-avatar> <el-avatar :src="avatar"></el-avatar>
</el-col> </el-col>
@ -28,7 +28,7 @@
</el-drawer> </el-drawer>
</el-col> </el-col>
</el-col> </el-col>
<el-col v-show="!user" class="text-center" style="margin-top: 1rem;"> <el-col v-else class="text-center" style="margin-top: 1rem;">
<el-button type="primary" size="medium" @click="gotoLogin">登录</el-button> <el-button type="primary" size="medium" @click="gotoLogin">登录</el-button>
后发布评论 后发布评论
</el-col> </el-col>
@ -62,7 +62,7 @@
<el-col :span="22" style="padding-left: 1rem;"> <el-col :span="22" style="padding-left: 1rem;">
<el-link :underline="false" class="text-default">{{ comment.timeAgo }}</el-link> <el-link :underline="false" class="text-default">{{ comment.timeAgo }}</el-link>
</el-col> </el-col>
<el-col :span="2" class="text-right" style="margin-bottom: 0.5rem;"> <el-col :span="2" v-if="user" class="text-right" style="margin-bottom: 0.5rem;">
<el-link :underline="false" title="回复" @click.native="replyComment(comment)"><i <el-link :underline="false" title="回复" @click.native="replyComment(comment)"><i
class="el-icon-s-comment"></i></el-link> class="el-icon-s-comment"></i></el-link>
</el-col> </el-col>

View File

@ -3,7 +3,7 @@ export default function ({app, $axios, store, redirect}) {
$axios.onRequest(config => { $axios.onRequest(config => {
let token = store.state.oauth?.accessToken; let token = store.state.oauth?.accessToken;
if (token) { if (token) {
if (!(config.url.indexOf('console') > -1)) { if (!(config.url.indexOf('console') > -1 || config.url.indexOf('comments') > -1)) {
config.headers['Authorization'] = store.state.oauth?.accessToken config.headers['Authorization'] = store.state.oauth?.accessToken
} }
} }
@ -42,7 +42,7 @@ export default function ({app, $axios, store, redirect}) {
if (code === 400) { if (code === 400) {
redirect('/400'); redirect('/400');
} else { } else {
console.log(error, error.data); console.log(error.data);
} }
}) })
} }

View File

@ -36,7 +36,6 @@ export const mutations = {
state.list.data.data.push(...action.data) state.list.data.data.push(...action.data)
state.list.data.pagination = action.pagination state.list.data.pagination = action.pagination
}, },
// 文章详情 // 文章详情
updateDetailFetching(state, action) { updateDetailFetching(state, action) {
state.detail.fetching = action state.detail.fetching = action
@ -69,14 +68,11 @@ export const actions = {
topicUri: params.topic_uri || '' topicUri: params.topic_uri || ''
} }
console.log('data:', data)
return this.$axios return this.$axios
.$get(`${BASE_API_PATH}/articles`, { .$get(`${BASE_API_PATH}/articles`, {
params: data params: data
}) })
.then(response => { .then(response => {
console.log('response', response);
commit('updateListFetching', false); commit('updateListFetching', false);
commit('updateListData', response); commit('updateListData', response);
}) })
@ -85,7 +81,6 @@ export const actions = {
commit('updateListFetching', false); commit('updateListFetching', false);
}); });
}, },
// 获取文章详情 // 获取文章详情
fetchDetail({ commit }, params = {}) { fetchDetail({ commit }, params = {}) {
// const delay = fetchDelay( // const delay = fetchDelay(