Skip to content

Commit

Permalink
修复节点加载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbbbbbbbbbba committed Sep 27, 2022
1 parent 5800051 commit 6e6e16c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions server/controllers/api/topic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ type TopicController struct {
Ctx iris.Context
}

// 节点
func (c *TopicController) GetNodes() *web.JsonResult {
func (c *TopicController) GetNode_navs() *web.JsonResult {
nodes := []model.NodeResponse{
{
NodeId: 0,
Expand All @@ -46,6 +45,12 @@ func (c *TopicController) GetNodes() *web.JsonResult {
return web.JsonData(nodes)
}

// 节点
func (c *TopicController) GetNodes() *web.JsonResult {
nodes := render.BuildNodes(services.TopicNodeService.GetNodes())
return web.JsonData(nodes)
}

// 节点信息
func (c *TopicController) GetNode() *web.JsonResult {
nodeId := params.FormValueInt64Default(c.Ctx, "nodeId", 0)
Expand Down
5 changes: 2 additions & 3 deletions site/pages/articles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
export default {
async asyncData({ $axios, store }) {
try {
const [nodes, scoreRank, links] = await Promise.all([
$axios.get('/api/topic/nodes'),
const [scoreRank, links] = await Promise.all([
$axios.get('/api/user/score/rank'),
$axios.get('/api/link/toplinks'),
])
return { nodes, scoreRank, links }
return { scoreRank, links }
} catch (e) {
console.error(e)
}
Expand Down
2 changes: 1 addition & 1 deletion site/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
store.commit('env/setCurrentNodeId', 0) // 设置当前所在node
try {
const [nodes, topicsPage, scoreRank, links] = await Promise.all([
$axios.get('/api/topic/nodes'),
$axios.get('/api/topic/node_navs'),
$axios.get('/api/topic/topics'),
$axios.get('/api/user/score/rank'),
$axios.get('/api/link/toplinks'),
Expand Down
2 changes: 1 addition & 1 deletion site/pages/topics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {
try {
store.commit('env/setCurrentNodeId', 0) // 设置当前所在node
const [nodes, scoreRank, links] = await Promise.all([
$axios.get('/api/topic/nodes'),
$axios.get('/api/topic/node_navs'),
$axios.get('/api/user/score/rank'),
$axios.get('/api/link/toplinks'),
])
Expand Down

0 comments on commit 6e6e16c

Please sign in to comment.