diff --git a/spug_api/apps/notice/models.py b/spug_api/apps/home/models.py similarity index 100% rename from spug_api/apps/notice/models.py rename to spug_api/apps/home/models.py diff --git a/spug_api/apps/notice/views.py b/spug_api/apps/home/notice.py similarity index 98% rename from spug_api/apps/notice/views.py rename to spug_api/apps/home/notice.py index 923aca5..f8d11be 100644 --- a/spug_api/apps/notice/views.py +++ b/spug_api/apps/home/notice.py @@ -3,7 +3,7 @@ # Released under the AGPL-3.0 License. from django.views.generic import View from libs import json_response, JsonParser, Argument -from apps.notice.models import Notice +from apps.home.models import Notice import json diff --git a/spug_api/apps/home/urls.py b/spug_api/apps/home/urls.py index a9a8f4c..bfb22df 100644 --- a/spug_api/apps/home/urls.py +++ b/spug_api/apps/home/urls.py @@ -4,10 +4,12 @@ from django.urls import path from .views import * +from apps.home.notice import NoticeView urlpatterns = [ path('statistic/', get_statistic), path('alarm/', get_alarm), path('deploy/', get_deploy), path('request/', get_request), + path('notice/', NoticeView.as_view()), ] diff --git a/spug_api/apps/notice/__init__.py b/spug_api/apps/notice/__init__.py deleted file mode 100644 index 89f622a..0000000 --- a/spug_api/apps/notice/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug -# Copyright: (c) -# Released under the AGPL-3.0 License. diff --git a/spug_api/apps/notice/urls.py b/spug_api/apps/notice/urls.py deleted file mode 100644 index 018889b..0000000 --- a/spug_api/apps/notice/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug -# Copyright: (c) -# Released under the AGPL-3.0 License. -from django.urls import path - -from .views import * - -urlpatterns = [ - path('', NoticeView.as_view()), -] diff --git a/spug_api/spug/settings.py b/spug_api/spug/settings.py index 33735b9..e5d77fb 100644 --- a/spug_api/spug/settings.py +++ b/spug_api/spug/settings.py @@ -47,7 +47,7 @@ INSTALLED_APPS = [ 'apps.deploy', 'apps.notify', 'apps.repository', - 'apps.notice', + 'apps.home', ] MIDDLEWARE = [ diff --git a/spug_api/spug/urls.py b/spug_api/spug/urls.py index cad3b36..0635e8f 100644 --- a/spug_api/spug/urls.py +++ b/spug_api/spug/urls.py @@ -33,6 +33,5 @@ urlpatterns = [ path('home/', include('apps.home.urls')), path('notify/', include('apps.notify.urls')), path('file/', include('apps.file.urls')), - path('notice/', include('apps.notice.urls')), path('apis/', include('apps.apis.urls')), ] diff --git a/spug_web/src/pages/home/Notice.js b/spug_web/src/pages/home/Notice.js index 3ed4f61..7e25a97 100644 --- a/spug_web/src/pages/home/Notice.js +++ b/spug_web/src/pages/home/Notice.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Button, Card, List, Modal, Form, Input, Switch, Divider } from 'antd'; import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons'; import { http } from 'libs'; -import styles from "./index.module.less"; +import styles from './index.module.less'; function NoticeIndex(props) { const id = localStorage.getItem('id'); @@ -20,7 +20,7 @@ function NoticeIndex(props) { function fetch() { setFetching(true); - http.get('/api/notice/') + http.get('/api/home/notice/') .then(res => { setRecords(res); for (let item of res) { @@ -36,7 +36,7 @@ function NoticeIndex(props) { setLoading(true); const formData = form.getFieldsValue(); formData['id'] = record.id; - http.post('/api/notice/', formData) + http.post('/api/home/notice/', formData) .then(() => { fetch() setRecord(null) @@ -51,14 +51,14 @@ function NoticeIndex(props) { function handleSort(e, info, sort) { e.stopPropagation(); - http.patch('/api/notice/', {id: info.id, sort}) + http.patch('/api/home/notice/', {id: info.id, sort}) .then(() => fetch()) } function handleRead() { if (!notice.read_ids.includes(id)) { const formData = {id: notice.id, read: 1}; - http.patch('/api/notice/', formData) + http.patch('/api/home/notice/', formData) .then(() => fetch()) } setNotice(null);