✨ 专题模块功能
This commit is contained in:
parent
e15e3be1cc
commit
1b8ace45dc
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file Comment box component / ES module
|
* @file Comment box component / ES module
|
||||||
* @module components/common/comment
|
* @module components/common/comment
|
||||||
* @author Surmon <https://github.com/surmon-china>
|
* @author Ronger <https://github.com/ronger-x>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Comment from './main'
|
import Comment from './main'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file Environment / ES module
|
* @file Environment / ES module
|
||||||
* @module environment
|
* @module environment
|
||||||
* @author Surmon <https://github.com/surmon-china>
|
* @author Ronger <https://github.com/ronger-x>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const environment = process.env
|
export const environment = process.env
|
||||||
|
1507
package-lock.json
generated
1507
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,8 @@
|
|||||||
"element-ui": "^2.13.2",
|
"element-ui": "^2.13.2",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"nuxt": "^2.13.3",
|
"nuxt": "^2.14.0",
|
||||||
"vditor": "^3.3.8"
|
"vditor": "^3.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxtjs/proxy": "^2.0.1",
|
"@nuxtjs/proxy": "^2.0.1",
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
// const Cookie = require('js-cookie')
|
||||||
export default function ({app, $axios, store, redirect}) {
|
export default function ({app, $axios, store, redirect}) {
|
||||||
$axios.onRequest(config => {
|
$axios.onRequest(config => {
|
||||||
if (!(config.url.indexOf('console') > -1)) {
|
let token = store.state.oauth?.accessToken;
|
||||||
config.headers['Authorization'] = store.state.oauth?.accessToken
|
if (token) {
|
||||||
|
if (!(config.url.indexOf('console') > -1)) {
|
||||||
|
config.headers['Authorization'] = store.state.oauth?.accessToken
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$axios.onResponse(response => {
|
$axios.onResponse(response => {
|
||||||
@ -16,24 +20,17 @@ export default function ({app, $axios, store, redirect}) {
|
|||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
resolve(response.data);
|
resolve(response.data);
|
||||||
} else {
|
} else {
|
||||||
if (response.data.code === 0) {
|
if (response.data.code === '0') {
|
||||||
app.$message(message);
|
app.$message(message);
|
||||||
} else if (response.data.code === 401) {
|
} else if (response.data.code === '401') {
|
||||||
store.commit('logout');
|
// Cookie.remove('auth')
|
||||||
app.$router.push({
|
store.commit('setAuth', null);
|
||||||
name: 'login'
|
} else if (response.data.code === '402') {
|
||||||
})
|
// Cookie.remove('auth')
|
||||||
} else if (response.data.code === 402) {
|
store.commit('setAuth', null);
|
||||||
store.commit('logout');
|
} else if (response.data.code === '404') {
|
||||||
app.$router.push({
|
|
||||||
name: 'login',
|
|
||||||
query: {
|
|
||||||
historyUrl: window.location.href
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (response.data.code === 404) {
|
|
||||||
app.$message('操作失败,请稍后再试......')
|
app.$message('操作失败,请稍后再试......')
|
||||||
} else if (response.data.code === 500) {
|
} else if (response.data.code === '500') {
|
||||||
app.$message('服务器正在开小差,请稍后再试......')
|
app.$message('服务器正在开小差,请稍后再试......')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,9 +40,9 @@ export default function ({app, $axios, store, redirect}) {
|
|||||||
$axios.onError(error => {
|
$axios.onError(error => {
|
||||||
const code = parseInt(error.response && error.response.status)
|
const code = parseInt(error.response && error.response.status)
|
||||||
if (code === 400) {
|
if (code === 400) {
|
||||||
redirect('/400')
|
redirect('/400');
|
||||||
} else {
|
} else {
|
||||||
console.log('网络异常')
|
console.log(error.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,15 @@ export const actions = {
|
|||||||
// 清空已有数据
|
// 清空已有数据
|
||||||
commit('updateListData', getDefaultListData())
|
commit('updateListData', getDefaultListData())
|
||||||
commit('updateListFetching', true)
|
commit('updateListFetching', true)
|
||||||
|
let data = {
|
||||||
|
page: params.page,
|
||||||
|
topicUri: params.topic_uri
|
||||||
|
}
|
||||||
|
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${ARTICLE_API_PATH}/articles`, {params})
|
.$get(`${ARTICLE_API_PATH}/articles`, {
|
||||||
|
params: data
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('updateListFetching', false)
|
commit('updateListFetching', false)
|
||||||
commit('updateListData', response)
|
commit('updateListData', response)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file 评论数据状态 / ES module
|
* @file 评论数据状态 / ES module
|
||||||
* @module store/comment
|
* @module store/comment
|
||||||
* @author Surmon <https://github.com/surmon-china>
|
* @author Ronger <https://github.com/ronger-x>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const COMMENT_API_PATH = '/api/article/'
|
export const COMMENT_API_PATH = '/api/article/'
|
||||||
|
Loading…
Reference in New Issue
Block a user