🎉 1.0.0-RC2

This commit is contained in:
smallchill 2019-01-18 22:40:46 +08:00
parent 96c65c8b94
commit d5d7509baf
7 changed files with 64 additions and 7 deletions

View File

@ -7,4 +7,8 @@ module.exports = {
autoHideHeader: false, // auto hide header
fixSiderbar: true, // sticky siderbar
collapse: true,
title: 'Sword企业级开发平台',
menu: {
disableLocal: false,
},
};

View File

@ -13,4 +13,6 @@ export default {
'component.noticeIcon.clear': 'Clear',
'component.noticeIcon.cleared': 'Cleared',
'component.noticeIcon.empty': 'No notifications',
'component.noticeIcon.loaded': 'Loaded',
'component.noticeIcon.loading-more': 'Loading more',
};

View File

@ -13,4 +13,6 @@ export default {
'component.noticeIcon.clear': '清空',
'component.noticeIcon.cleared': '清空了',
'component.noticeIcon.empty': '暂无数据',
'component.noticeIcon.loaded': '加载完毕',
'component.noticeIcon.loading-more': '加载更多',
};

View File

@ -13,4 +13,6 @@ export default {
'component.noticeIcon.clear': '清空',
'component.noticeIcon.cleared': '清空了',
'component.noticeIcon.empty': '暫無數據',
'component.noticeIcon.loaded': '加載完畢',
'component.noticeIcon.loading-more': '加載更多',
};

View File

@ -6,14 +6,21 @@ export default {
state: {
collapsed: false,
notices: [],
loadedAllNotices: false,
},
effects: {
*fetchNotices(_, { call, put, select }) {
const response = yield call(queryNotices);
const { data } = response;
const loadedAllNotices = data && data.length && data[data.length - 1] === null;
yield put({
type: 'setLoadedStatus',
payload: loadedAllNotices,
});
yield put({
type: 'saveNotices',
payload: response.data,
payload: data.filter(item => item),
});
const unreadCount = yield select(
state => state.global.notices.filter(item => !item.read).length
@ -21,7 +28,30 @@ export default {
yield put({
type: 'user/changeNotifyCount',
payload: {
totalCount: response.data.length,
totalCount: data.length,
unreadCount,
},
});
},
*fetchMoreNotices({ payload }, { call, put, select }) {
const response = yield call(queryNotices, payload);
const { data } = response;
const loadedAllNotices = data && data.length && data[data.length - 1] === null;
yield put({
type: 'setLoadedStatus',
payload: loadedAllNotices,
});
yield put({
type: 'pushNotices',
payload: data.filter(item => item),
});
const unreadCount = yield select(
state => state.global.notices.filter(item => !item.read).length
);
yield put({
type: 'user/changeNotifyCount',
payload: {
totalCount: data.length,
unreadCount,
},
});
@ -86,6 +116,18 @@ export default {
notices: state.notices.filter(item => item.type !== payload),
};
},
pushNotices(state, { payload }) {
return {
...state,
notices: [...state.notices, ...payload],
};
},
setLoadedStatus(state, { payload }) {
return {
...state,
loadedAllNotices: payload,
};
},
},
subscriptions: {

View File

@ -4,6 +4,7 @@ import { message } from 'antd';
import router from 'umi/router';
import { formatMessage } from 'umi/locale';
import Authorized from '../utils/Authorized';
import { menu } from '../defaultSettings';
import {
dynamicRoutes,
dynamicButtons,
@ -171,7 +172,7 @@ const { check } = Authorized;
function formatter(data, parentAuthority, parentName) {
return data
.map(item => {
if (!item.name) {
if (!item.name || !item.path) {
return null;
}
@ -181,10 +182,14 @@ function formatter(data, parentAuthority, parentName) {
} else {
locale = `menu.${item.name}`;
}
// if enableMenuLocale use item.name,
// close menu international
const name = menu.disableLocal
? item.name
: formatMessage({ id: locale, defaultMessage: item.name });
const result = {
...item,
name: formatMessage({ id: locale, defaultMessage: item.name }),
name,
locale,
authority: item.authority || parentAuthority,
};

View File

@ -4,8 +4,8 @@ import request from '../utils/request';
// =====================通知公告===========================
export async function queryProjectNotice() {
return request('/api/blade-desk/notice/notices');
export async function queryProjectNotice(params = {}) {
return request(`/api/blade-desk/notice/notices?${stringify(params)}`);
}
export async function list(params) {