fix issue

pull/330/head
vapao 2021-03-28 16:22:55 +08:00
parent 6253dcceb5
commit f8a757bc4a
8 changed files with 9 additions and 21 deletions

View File

@ -3,7 +3,7 @@
# Released under the AGPL-3.0 License. # Released under the AGPL-3.0 License.
from django.views.generic import View from django.views.generic import View
from libs import json_response, JsonParser, Argument from libs import json_response, JsonParser, Argument
from apps.notice.models import Notice from apps.home.models import Notice
import json import json

View File

@ -4,10 +4,12 @@
from django.urls import path from django.urls import path
from .views import * from .views import *
from apps.home.notice import NoticeView
urlpatterns = [ urlpatterns = [
path('statistic/', get_statistic), path('statistic/', get_statistic),
path('alarm/', get_alarm), path('alarm/', get_alarm),
path('deploy/', get_deploy), path('deploy/', get_deploy),
path('request/', get_request), path('request/', get_request),
path('notice/', NoticeView.as_view()),
] ]

View File

@ -1,3 +0,0 @@
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
# Copyright: (c) <spug.dev@gmail.com>
# Released under the AGPL-3.0 License.

View File

@ -1,10 +0,0 @@
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
# Copyright: (c) <spug.dev@gmail.com>
# Released under the AGPL-3.0 License.
from django.urls import path
from .views import *
urlpatterns = [
path('', NoticeView.as_view()),
]

View File

@ -47,7 +47,7 @@ INSTALLED_APPS = [
'apps.deploy', 'apps.deploy',
'apps.notify', 'apps.notify',
'apps.repository', 'apps.repository',
'apps.notice', 'apps.home',
] ]
MIDDLEWARE = [ MIDDLEWARE = [

View File

@ -33,6 +33,5 @@ urlpatterns = [
path('home/', include('apps.home.urls')), path('home/', include('apps.home.urls')),
path('notify/', include('apps.notify.urls')), path('notify/', include('apps.notify.urls')),
path('file/', include('apps.file.urls')), path('file/', include('apps.file.urls')),
path('notice/', include('apps.notice.urls')),
path('apis/', include('apps.apis.urls')), path('apis/', include('apps.apis.urls')),
] ]

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Button, Card, List, Modal, Form, Input, Switch, Divider } from 'antd'; import { Button, Card, List, Modal, Form, Input, Switch, Divider } from 'antd';
import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons'; import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons';
import { http } from 'libs'; import { http } from 'libs';
import styles from "./index.module.less"; import styles from './index.module.less';
function NoticeIndex(props) { function NoticeIndex(props) {
const id = localStorage.getItem('id'); const id = localStorage.getItem('id');
@ -20,7 +20,7 @@ function NoticeIndex(props) {
function fetch() { function fetch() {
setFetching(true); setFetching(true);
http.get('/api/notice/') http.get('/api/home/notice/')
.then(res => { .then(res => {
setRecords(res); setRecords(res);
for (let item of res) { for (let item of res) {
@ -36,7 +36,7 @@ function NoticeIndex(props) {
setLoading(true); setLoading(true);
const formData = form.getFieldsValue(); const formData = form.getFieldsValue();
formData['id'] = record.id; formData['id'] = record.id;
http.post('/api/notice/', formData) http.post('/api/home/notice/', formData)
.then(() => { .then(() => {
fetch() fetch()
setRecord(null) setRecord(null)
@ -51,14 +51,14 @@ function NoticeIndex(props) {
function handleSort(e, info, sort) { function handleSort(e, info, sort) {
e.stopPropagation(); e.stopPropagation();
http.patch('/api/notice/', {id: info.id, sort}) http.patch('/api/home/notice/', {id: info.id, sort})
.then(() => fetch()) .then(() => fetch())
} }
function handleRead() { function handleRead() {
if (!notice.read_ids.includes(id)) { if (!notice.read_ids.includes(id)) {
const formData = {id: notice.id, read: 1}; const formData = {id: notice.id, read: 1};
http.patch('/api/notice/', formData) http.patch('/api/home/notice/', formData)
.then(() => fetch()) .then(() => fetch())
} }
setNotice(null); setNotice(null);