diff --git a/frontend/src/pages/index.vue b/frontend/src/pages/index.vue index a96598c..ab1ef0f 100644 --- a/frontend/src/pages/index.vue +++ b/frontend/src/pages/index.vue @@ -99,6 +99,7 @@ export default { this.$store.commit('initMetadata', 'popup_announcement') this.$store.commit('initMetadata', 'post_rules') this.$store.commit('initMetadata', 'beianhao') + this.$store.commit('fetchPublicObject') console.log(this.$store.state.metadata) console.log(this.$store.state.account) }, diff --git a/frontend/src/pages/post.vue b/frontend/src/pages/post.vue index 1208a84..6ab1041 100644 --- a/frontend/src/pages/post.vue +++ b/frontend/src/pages/post.vue @@ -4,6 +4,15 @@

Campux

{{ $store.state.metadata.brand }} + +

{{ $store.state.publicObject.announcement.admin[0].title }}

+
{{ $store.state.publicObject.announcement.admin[0].content }}
+ {{ $store.state.publicObject.announcement.admin[0].link.text }} +
@@ -242,7 +251,7 @@ export default { // 将images中的baseurl去掉 this.post.images = this.post.images.map(image => { return image.replace(this.$store.state.base_url + "/v1/post/download-image/", '') - .replace("?preview=1", "") + .replace("?preview=1", "") }) diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index ee7547e..41248d7 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -34,6 +34,11 @@ export default createStore({ } }, authMode: "login", + publicObject: { + "announcement": { + "admin": [] + } + } }, mutations: { initMetadata(state, key) { @@ -60,6 +65,17 @@ export default createStore({ }) } }, + fetchPublicObject(state) { + axios.get( + "https://campux.idoknow.top/object.json", + {withCredentials: false} + ).then(res => { + if (res.status == 200) { + state.publicObject = res.data + console.log(state.publicObject) + } + }) + }, getVersion(state) { axios.get(this.state.base_url + '/v1/misc/get-version') .then(res => {