🎉 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 autoHideHeader: false, // auto hide header
fixSiderbar: true, // sticky siderbar fixSiderbar: true, // sticky siderbar
collapse: true, collapse: true,
title: 'Sword企业级开发平台',
menu: {
disableLocal: false,
},
}; };

View File

@ -13,4 +13,6 @@ export default {
'component.noticeIcon.clear': 'Clear', 'component.noticeIcon.clear': 'Clear',
'component.noticeIcon.cleared': 'Cleared', 'component.noticeIcon.cleared': 'Cleared',
'component.noticeIcon.empty': 'No notifications', '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.clear': '清空',
'component.noticeIcon.cleared': '清空了', 'component.noticeIcon.cleared': '清空了',
'component.noticeIcon.empty': '暂无数据', 'component.noticeIcon.empty': '暂无数据',
'component.noticeIcon.loaded': '加载完毕',
'component.noticeIcon.loading-more': '加载更多',
}; };

View File

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

View File

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

View File

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

View File

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