Merge pull request #45 from rymcu/master

同步 master 分支更改
This commit is contained in:
ronger 2022-10-11 08:22:56 +08:00 committed by GitHub
commit 14aa7e3112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 7166 additions and 6841 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
npm-debug.log

58
.onedev-buildspec.yml Normal file
View File

@ -0,0 +1,58 @@
version: 18
jobs:
- name: vue ci
steps:
- !CheckoutStep
name: checkout
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@script:builtin:node:determine-project-version@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node:16.17.0-alpine
interpreter: !DefaultInterpreter
commands:
- yarn --registry=https://registry.npm.taobao.org
- npx nuxt build
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !BranchUpdateTrigger {}
retryCondition: never
maxRetries: 3
retryDelay: 30
cpuRequirement: 250
memoryRequirement: 256
caches:
- key: npm-cache
path: /root/.npm
timeout: 3600
- name: Build Docker Image
jobExecutor: internal
steps:
- !CheckoutStep
name: Checkout Code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: Build Docker Image
tags: rymcu/nebula:latest
publish: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
projects: nebula
retryCondition: never
maxRetries: 3
retryDelay: 30
cpuRequirement: 250
memoryRequirement: 256
timeout: 3600

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM node:16.17.0-alpine
#创建/opt/app 目录作为部署目录,创建容器实例时,挂载此目录
RUN mkdir -p /opt/app
# 设置工作目录
WORKDIR /opt/app
# 将代码复制到容器中
COPY . /opt/app
RUN cd /opt/app
# 添加权限,防止依赖无法安装
RUN chmod -R 777 *
# 添加执行shell文件权限
RUN chmod u+x pm2.sh
RUN yarn --registry=https://registry.npm.taobao.org
RUN npm i pm2 -g --registry=https://registry.npm.taobao.org
RUN npm run build
RUN ls -l -a
# 容器对外暴露的端口号要和node项目配置的端口号一致
EXPOSE 3000
# 修复容器外无法访问问题
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000
# 通过shell文件来执行多条命令
CMD ["./pm2.sh"]

View File

@ -94,6 +94,7 @@ nebula[ˈnebyələ]n.星云)是一款现代化的知识社区项目,
![JetBrains](assets/jb_beam.svg) ![JetBrains](assets/jb_beam.svg)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fnebula.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fnebula?ref=badge_shield)
## Build Setup ## Build Setup
@ -126,3 +127,7 @@ $ npm generate
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fnebula.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fnebula?ref=badge_large)

View File

@ -4,7 +4,7 @@
<header-view/> <header-view/>
</el-header> </el-header>
<el-main> <el-main>
<nuxt :nuxt-child-key="$route.name"/> <nuxt :nuxt-child-key="$route.name" keep-alive :keep-alive-props="{max: 16}"/>
</el-main> </el-main>
<el-footer height="5rem"> <el-footer height="5rem">
<footer-view/> <footer-view/>

View File

@ -11,6 +11,16 @@ const apisMap = {
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/', VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme' VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
}, },
test: {
FE: 'https://test.rymcu.com',
BASE: 'https://test.rymcu.com',
CDN: 'https://static.rymcu.com',
PROXY: 'https://static.rymcu.com/proxy',
SOCKET: 'https://test.rymcu.com/wss',
GRAVATAR: 'https://static.rymcu.com/avatar',
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
},
production: { production: {
FE: 'https://rymcu.com', FE: 'https://rymcu.com',
BASE: 'https://rymcu.com', BASE: 'https://rymcu.com',

View File

@ -110,7 +110,8 @@ export default {
components: { components: {
EditTags EditTags
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchArticles', params) .dispatch('admin/fetchArticles', params)

View File

@ -76,7 +76,8 @@ import Records from "../../components/common/bank/account/records";
export default { export default {
name: "bank-accounts", name: "bank-accounts",
components: {Records}, components: {Records},
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('bank-account/fetchList', params) .dispatch('bank-account/fetchList', params)

View File

@ -87,7 +87,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "banks", name: "banks",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('bank/fetchList', params) .dispatch('bank/fetchList', params)

View File

@ -97,7 +97,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "comments", name: "comments",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchComments', params) .dispatch('admin/fetchComments', params)

View File

@ -81,7 +81,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "currency-rules", name: "currency-rules",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('currency-rule/fetchList', params) .dispatch('currency-rule/fetchList', params)

View File

@ -251,7 +251,8 @@ export default {
components: { components: {
EditTags EditTags
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('dashboard/fetchDashboard', params) .dispatch('dashboard/fetchDashboard', params)

View File

@ -80,7 +80,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "products", name: "products",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchProducts', params) .dispatch('admin/fetchProducts', params)

View File

@ -91,7 +91,8 @@
export default { export default {
name: "roles", name: "roles",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchRoles', params) .dispatch('admin/fetchRoles', params)

View File

@ -48,7 +48,8 @@
export default { export default {
name: "tags", name: "tags",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('tag/fetchList', params) .dispatch('tag/fetchList', params)

View File

@ -77,7 +77,8 @@ export default {
} }
return params.topic_uri return params.topic_uri
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store.dispatch('topic/fetchDetail', params) store.dispatch('topic/fetchDetail', params)
.catch(err => error({statusCode: 404})), .catch(err => error({statusCode: 404})),

View File

@ -39,7 +39,8 @@
export default { export default {
name: "topics", name: "topics",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('topic/fetchList', params) .dispatch('topic/fetchList', params)

View File

@ -119,7 +119,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "users", name: "users",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchUsers', params) .dispatch('admin/fetchUsers', params)

View File

@ -16,7 +16,8 @@
components: { components: {
DraftList DraftList
}, },
fetch({store, error}) { fetch() {
let {store, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('draft/fetchList') .dispatch('draft/fetchList')

View File

@ -11,7 +11,8 @@ import {mapState} from 'vuex';
export default { export default {
name: 'Index', name: 'Index',
fetch({store, query}) { fetch() {
let {store, query, error} = this.$nuxt.context
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}) store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})

View File

@ -17,7 +17,8 @@
components: { components: {
NotificationList NotificationList
}, },
fetch({store, query, error}) { fetch() {
let {store, query, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('notification/fetchList', {page: query.page || 1}) .dispatch('notification/fetchList', {page: query.page || 1})

View File

@ -54,7 +54,8 @@ import gzh from "assets/rymcugzh.jpg";
Vue.prototype.$echarts = echarts; Vue.prototype.$echarts = echarts;
export default { export default {
name: "openData", name: "openData",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('open-data/fetchLastThirtyDays', params) .dispatch('open-data/fetchLastThirtyDays', params)

View File

@ -16,7 +16,8 @@ import PortfolioList from "~/components/common/portfolio/list";
export default { export default {
name: "Portfolios", name: "Portfolios",
components: {PortfolioList}, components: {PortfolioList},
fetch({store, query, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('portfolio/fetchList', {page: query.page || 1}) .dispatch('portfolio/fetchList', {page: query.page || 1})

View File

@ -13,7 +13,8 @@ import ProductList from "~/components/common/product/list";
export default { export default {
name: "products", name: "products",
components: {ProductList}, components: {ProductList},
fetch({store, query, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('product/fetchList', {page: query.page || 1}) .dispatch('product/fetchList', {page: query.page || 1})

19
pm2.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "nebula",
"exec_mode": "cluster",
"instances": "max",
"script": "./node_modules/nuxt/bin/nuxt.js",
"args": "start",
"env": {
"NODE_ENV": "production"
},
"env_test": {
"NODE_ENV": "test"
},
"env_dev": {
"NODE_ENV": "development"
},
"env_prod": {
"NODE_ENV": "production"
}
}

3
pm2.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
pm2 start pm2.json --env $APP_ENV
pm2 logs

13825
yarn.lock

File diff suppressed because it is too large Load Diff