Merge branch 'master' into lucene-dev

This commit is contained in:
ronger 2021-05-30 12:18:46 +08:00 committed by GitHub
commit d65f167c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 85 deletions

View File

@ -0,0 +1,49 @@
<template>
<el-row class="wrapper">
<el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
<el-carousel :interval="5000" type="card" height="256px">
<el-carousel-item v-for="article in announcements.articles" :key="article.idArticle" style="padding-bottom: 1rem;">
<el-card style="height: 250px;">
<div class="card-body d-flex flex-column">
<el-link rel="nofollow" @click="onRouter('article',article.articleLink)" :underline="false"
style="margin-bottom: .7rem;">
<h4>
{{ article.articleTitle }}
<el-tag
style="margin-left: 0.5rem;"
size="mini"
effect="plain">
# 公告
</el-tag>
</h4>
</el-link>
<div class="text-muted article-summary-md">{{ article.articlePreviewContent }}</div>
</div>
</el-card>
</el-carousel-item>
</el-carousel>
</el-col>
</el-row>
</template>
<script>
export default {
name: "announcementList",
props: {
announcements: {
type: Object
}
},
methods: {
onRouter(name, data) {
this.$router.push({
path: data
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -105,7 +105,7 @@
<script> <script>
import {mapState} from 'vuex'; import {mapState} from 'vuex';
import {isBrowser} from '~/environment'; import {isBrowser} from '~/environment';
import sockClient from '~/plugins/sockjs'; // import sockClient from '~/plugins/sockjs';
const Cookie = process.client ? require('js-cookie') : undefined const Cookie = process.client ? require('js-cookie') : undefined
export default { export default {

88
package-lock.json generated
View File

@ -1635,11 +1635,6 @@
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz", "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=" "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s="
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1611394023277&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1611394023277&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
@ -1726,11 +1721,6 @@
"resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=" "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0="
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"semver": { "semver": {
"version": "7.3.5", "version": "7.3.5",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz", "resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz",
@ -1859,13 +1849,6 @@
"rc9": "^1.2.0", "rc9": "^1.2.0",
"std-env": "^2.3.0", "std-env": "^2.3.0",
"ufo": "^0.6.10" "ufo": "^0.6.10"
},
"dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
}
} }
}, },
"@nuxt/core": { "@nuxt/core": {
@ -1881,13 +1864,6 @@
"hable": "^3.0.0", "hable": "^3.0.0",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lodash": "^4.17.21" "lodash": "^4.17.21"
},
"dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
}
} }
}, },
"@nuxt/devalue": { "@nuxt/devalue": {
@ -2185,11 +2161,6 @@
"ufo": "^0.6.10" "ufo": "^0.6.10"
}, },
"dependencies": { "dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"semver": { "semver": {
"version": "7.3.5", "version": "7.3.5",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz", "resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz",
@ -2235,11 +2206,6 @@
"vue-server-renderer": "^2.6.12" "vue-server-renderer": "^2.6.12"
}, },
"dependencies": { "dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"lru-cache": { "lru-cache": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-5.1.1.tgz?cache=0&sync_timestamp=1599054167787&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flru-cache%2Fdownload%2Flru-cache-5.1.1.tgz", "resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-5.1.1.tgz?cache=0&sync_timestamp=1599054167787&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flru-cache%2Fdownload%2Flru-cache-5.1.1.tgz",
@ -2307,11 +2273,6 @@
"webpackbar": "^4.0.0" "webpackbar": "^4.0.0"
}, },
"dependencies": { "dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"semver": { "semver": {
"version": "7.3.5", "version": "7.3.5",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz", "resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1616463603361&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz",
@ -6294,9 +6255,9 @@
} }
}, },
"hosted-git-info": { "hosted-git-info": {
"version": "2.8.8", "version": "2.8.9",
"resolved": "https://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.8.8.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha1-dTm9S8Hg4KiVgVouAmJCCxKFhIg=", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true "dev": true
}, },
"hsl-regex": { "hsl-regex": {
@ -6405,11 +6366,6 @@
"util.promisify": "1.0.0" "util.promisify": "1.0.0"
}, },
"dependencies": { "dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"util.promisify": { "util.promisify": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.0.tgz?cache=0&sync_timestamp=1610159975962&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Futil.promisify%2Fdownload%2Futil.promisify-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.0.tgz?cache=0&sync_timestamp=1610159975962&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Futil.promisify%2Fdownload%2Futil.promisify-1.0.0.tgz",
@ -6485,13 +6441,6 @@
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"micromatch": "^4.0.2" "micromatch": "^4.0.2"
},
"dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
}
} }
}, },
"http-signature": { "http-signature": {
@ -7223,9 +7172,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.19", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
}, },
"lodash-webpack-plugin": { "lodash-webpack-plugin": {
"version": "0.11.6", "version": "0.11.6",
@ -7234,14 +7183,6 @@
"dev": true, "dev": true,
"requires": { "requires": {
"lodash": "^4.17.20" "lodash": "^4.17.20"
},
"dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
}
} }
}, },
"lodash._reinterpolate": { "lodash._reinterpolate": {
@ -9427,13 +9368,6 @@
"requires": { "requires": {
"lodash": "^4.17.20", "lodash": "^4.17.20",
"renderkid": "^2.0.4" "renderkid": "^2.0.4"
},
"dependencies": {
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
}
} }
}, },
"pretty-time": { "pretty-time": {
@ -9933,11 +9867,6 @@
"resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-2.1.1.tgz", "resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-3.0.1.tgz?cache=0&sync_timestamp=1589682795383&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-3.0.1.tgz", "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-3.0.1.tgz?cache=0&sync_timestamp=1589682795383&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-3.0.1.tgz",
@ -12529,11 +12458,6 @@
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz", "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=" "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s="
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1611394023277&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1611394023277&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",

View File

@ -1,17 +1,20 @@
<template> <template>
<div> <div>
<announcement-list :announcements="announcements"></announcement-list>
<article-list :articles="articles" @currentChange="currentChangeArticle"></article-list> <article-list :articles="articles" @currentChange="currentChangeArticle"></article-list>
</div> </div>
</template> </template>
<script> <script>
import ArticleList from '~/components/archive/list' import ArticleList from '~/components/archive/list'
import AnnouncementList from '~/components/announcement/list'
import {mapState} from 'vuex'; import {mapState} from 'vuex';
export default { export default {
name: 'Index', name: 'Index',
fetch({store, query}) { fetch({store, query}) {
return Promise.all([ return Promise.all([
store.dispatch('article/fetchList', {page: query.page || 1}) store.dispatch('article/fetchList', {page: query.page || 1}),
store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})
]) ])
}, },
watch: { watch: {
@ -20,11 +23,13 @@ export default {
} }
}, },
components: { components: {
AnnouncementList,
ArticleList ArticleList
}, },
computed: { computed: {
...mapState({ ...mapState({
articles: state => state.article.list.data articles: state => state.article.list.data,
announcements: state => state.article.announcements.data
}) })
}, },
methods: { methods: {

View File

@ -16,6 +16,10 @@ export const state = () => {
fetching: false, fetching: false,
data: getDefaultListData() data: getDefaultListData()
}, },
announcements: {
fetching: false,
data: getDefaultListData()
},
detail: { detail: {
fetching: false, fetching: false,
data: {} data: {}
@ -32,6 +36,12 @@ export const mutations = {
updateListData(state, action) { updateListData(state, action) {
state.list.data = action state.list.data = action
}, },
updateAnnouncementListFetching(state, action) {
state.announcements.fetching = action
},
updateAnnouncementListData(state, action) {
state.announcements.data = action
},
updateExistingListData(state, action) { updateExistingListData(state, action) {
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
@ -66,6 +76,27 @@ export const mutations = {
} }
export const actions = { export const actions = {
// 获取公告列表
fetchAnnouncementList({commit, state}, params = {}) {
commit('updateAnnouncementListFetching', true)
// 清空已有数据
commit('updateListData', getDefaultListData())
let data = {
page: params.page || 1
}
return this.$axios
.$get(`${BASE_API_PATH}/announcements`, {
params: data
})
.then(response => {
commit('updateAnnouncementListFetching', false);
commit('updateAnnouncementListData', response);
})
.catch(error => {
console.log(error);
commit('updateAnnouncementListFetching', false);
});
},
// 获取文章列表 // 获取文章列表
fetchList({commit, state}, params = {}) { fetchList({commit, state}, params = {}) {
commit('updateListFetching', true) commit('updateListFetching', true)