From 846451d2016b4a10a4997626bbacc8ed97748be2 Mon Sep 17 00:00:00 2001
From: czy0729 <402731062@qq.com>
Date: Thu, 24 Oct 2024 21:28:19 +0800
Subject: [PATCH] =?UTF-8?q?-=20[=E7=9B=AE=E5=BD=95=E8=AF=A6=E6=83=85]=20?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=AD=A3=E5=BA=8F=E5=80=92=E5=BA=8F=E6=8C=89?=
=?UTF-8?q?=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../catalog-detail/component/list/index.tsx | 4 +--
.../component/tool-bar/index.tsx | 4 ++-
.../component/tool-bar/reverse.tsx | 28 +++++++++++++++++++
.../component/tool-bar/styles.ts | 4 +--
.../discovery/catalog-detail/store/action.ts | 11 +++++++-
.../discovery/catalog-detail/store/ds.ts | 5 +++-
6 files changed, 49 insertions(+), 7 deletions(-)
create mode 100644 src/screens/discovery/catalog-detail/component/tool-bar/reverse.tsx
diff --git a/src/screens/discovery/catalog-detail/component/list/index.tsx b/src/screens/discovery/catalog-detail/component/list/index.tsx
index 97094cf78..3669ceb6c 100644
--- a/src/screens/discovery/catalog-detail/component/list/index.tsx
+++ b/src/screens/discovery/catalog-detail/component/list/index.tsx
@@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-09-06 15:35:53
* @Last Modified by: czy0729
- * @Last Modified time: 2024-08-10 23:09:02
+ * @Last Modified time: 2024-10-24 21:24:44
*/
import React from 'react'
import { PaginationList2 } from '@_'
@@ -23,7 +23,7 @@ function List({ onScroll }, { $ }: Ctx) {
contentContainerStyle={_.container.bottom}
keyExtractor={keyExtractor}
numColumns={numColumns}
- data={$.list}
+ data={$.state.reverse ? $.list.slice().reverse() : $.list}
limit={12}
ListHeaderComponent={}
renderItem={renderItem}
diff --git a/src/screens/discovery/catalog-detail/component/tool-bar/index.tsx b/src/screens/discovery/catalog-detail/component/tool-bar/index.tsx
index 66c24f237..f9c291802 100644
--- a/src/screens/discovery/catalog-detail/component/tool-bar/index.tsx
+++ b/src/screens/discovery/catalog-detail/component/tool-bar/index.tsx
@@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2024-03-20 00:13:03
* @Last Modified by: czy0729
- * @Last Modified time: 2024-08-10 01:05:09
+ * @Last Modified time: 2024-10-24 21:12:45
*/
import React from 'react'
import { Button, ToolBar as ToolBarComp } from '@components'
@@ -11,6 +11,7 @@ import { obc } from '@utils/decorators'
import { Ctx } from '../../types'
import Collect from './collect'
import Layout from './layout'
+import Reverse from './reverse'
import Sort from './sort'
import { COMPONENT } from './ds'
import { styles } from './styles'
@@ -30,6 +31,7 @@ function ToolBar(_props, { $ }: Ctx) {
>
更新评分
+
)
}
diff --git a/src/screens/discovery/catalog-detail/component/tool-bar/reverse.tsx b/src/screens/discovery/catalog-detail/component/tool-bar/reverse.tsx
new file mode 100644
index 000000000..f75a1578b
--- /dev/null
+++ b/src/screens/discovery/catalog-detail/component/tool-bar/reverse.tsx
@@ -0,0 +1,28 @@
+/*
+ * @Author: czy0729
+ * @Date: 2024-10-24 21:04:34
+ * @Last Modified by: czy0729
+ * @Last Modified time: 2024-10-24 21:11:40
+ */
+import React from 'react'
+import { ToolBar } from '@components'
+import { obc } from '@utils/decorators'
+import { Ctx } from '../../types'
+
+function Reverse(_props, { $ }: Ctx) {
+ return (
+
+ )
+}
+
+export default obc(Reverse)
diff --git a/src/screens/discovery/catalog-detail/component/tool-bar/styles.ts b/src/screens/discovery/catalog-detail/component/tool-bar/styles.ts
index 165308a2f..d7d47441f 100644
--- a/src/screens/discovery/catalog-detail/component/tool-bar/styles.ts
+++ b/src/screens/discovery/catalog-detail/component/tool-bar/styles.ts
@@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-08-26 15:36:24
* @Last Modified by: czy0729
- * @Last Modified time: 2022-08-26 15:52:03
+ * @Last Modified time: 2024-10-24 21:13:00
*/
import { _ } from '@stores'
@@ -10,7 +10,7 @@ export const styles = _.create({
btn: {
width: 76,
height: 30,
- marginLeft: 4,
+ marginHorizontal: 4,
borderRadius: 30
}
})
diff --git a/src/screens/discovery/catalog-detail/store/action.ts b/src/screens/discovery/catalog-detail/store/action.ts
index 2f65368e1..f58c5258f 100644
--- a/src/screens/discovery/catalog-detail/store/action.ts
+++ b/src/screens/discovery/catalog-detail/store/action.ts
@@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2024-07-29 19:39:24
* @Last Modified by: czy0729
- * @Last Modified time: 2024-08-10 16:37:35
+ * @Last Modified time: 2024-10-24 21:05:54
*/
import { discoveryStore, userStore } from '@stores'
import { confirm, feedback, info, removeHTMLTag, updateVisibleBottom } from '@utils'
@@ -106,6 +106,15 @@ export default class Action extends Fetch {
})
}
+ /** 倒序 */
+ onReverse = () => {
+ const value = !this.state.reverse
+ this.setState({
+ reverse: value
+ })
+ this.save()
+ }
+
/** 更新可视范围底部 y */
onScroll = updateVisibleBottom.bind(this)
diff --git a/src/screens/discovery/catalog-detail/store/ds.ts b/src/screens/discovery/catalog-detail/store/ds.ts
index b08c43129..cccb25ba4 100644
--- a/src/screens/discovery/catalog-detail/store/ds.ts
+++ b/src/screens/discovery/catalog-detail/store/ds.ts
@@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-08-26 15:21:40
* @Last Modified by: czy0729
- * @Last Modified time: 2024-08-10 03:59:41
+ * @Last Modified time: 2024-10-24 21:03:11
*/
import { _ } from '@stores'
import { Loaded } from '@types'
@@ -40,6 +40,9 @@ export const STATE = {
/** 收藏范围 */
collect: COLLECT_DS[0].key as Collect,
+ /** 倒序 */
+ reverse: false,
+
...EXCLUDE_STATE,
_loaded: false as Loaded
}