diff --git a/web/src/components/ChannelsTable.js b/web/src/components/ChannelsTable.js
index 4a6b09b..0bd8b82 100644
--- a/web/src/components/ChannelsTable.js
+++ b/web/src/components/ChannelsTable.js
@@ -49,27 +49,6 @@ function renderType(type) {
return {type2label[type]?.text};
}
-function renderBalance(type, balance) {
- switch (type) {
- case 1: // OpenAI
- return ${balance.toFixed(2)};
- case 4: // CloseAI
- return ¥{balance.toFixed(2)};
- case 8: // 自定义
- return ${balance.toFixed(2)};
- case 5: // OpenAI-SB
- return ¥{(balance / 10000).toFixed(2)};
- case 10: // AI Proxy
- return {renderNumber(balance)};
- case 12: // API2GPT
- return ¥{balance.toFixed(2)};
- case 13: // AIGC2D
- return {renderNumber(balance)};
- default:
- return 不支持;
- }
-}
-
const ChannelsTable = () => {
const columns = [
// {
@@ -332,8 +311,10 @@ const ChannelsTable = () => {
useEffect(() => {
// console.log('default effect')
const localIdSort = localStorage.getItem('id-sort') === 'true';
+ const localPageSize = parseInt(localStorage.getItem('page-size')) || ITEMS_PER_PAGE;
setIdSort(localIdSort)
- loadChannels(0, pageSize, localIdSort)
+ setPageSize(localPageSize)
+ loadChannels(0, localPageSize, localIdSort)
.then()
.catch((reason) => {
showError(reason);
@@ -341,16 +322,6 @@ const ChannelsTable = () => {
fetchGroups().then();
}, []);
- // useEffect(() => {
- // console.log('search effect')
- // searchChannels()
- // }, [searchGroup]);
-
- // useEffect(() => {
- // localStorage.setItem('id-sort', idSort + '');
- // refresh()
- // }, [idSort]);
-
const manageChannel = async (id, action, record, value) => {
let data = {id};
let res;
@@ -549,28 +520,6 @@ const ChannelsTable = () => {
}
}
- const sortChannel = (key) => {
- if (channels.length === 0) return;
- setLoading(true);
- let sortedChannels = [...channels];
- if (typeof sortedChannels[0][key] === 'string') {
- sortedChannels.sort((a, b) => {
- return ('' + a[key]).localeCompare(b[key]);
- });
- } else {
- sortedChannels.sort((a, b) => {
- if (a[key] === b[key]) return 0;
- if (a[key] > b[key]) return -1;
- if (a[key] < b[key]) return 1;
- });
- }
- if (sortedChannels[0].id === channels[0].id) {
- sortedChannels.reverse();
- }
- setChannels(sortedChannels);
- setLoading(false);
- };
-
let pageData = channels.slice((activePage - 1) * pageSize, activePage * pageSize);
const handlePageChange = page => {
@@ -583,6 +532,7 @@ const ChannelsTable = () => {
};
const handlePageSizeChange = async(size) => {
+ localStorage.setItem('page-size', size + '')
setPageSize(size)
setActivePage(1)
loadChannels(0, size, idSort)