|
@@ -1,4 +1,4 @@
|
1
|
|
-import { useState } from 'react'
|
|
1
|
+import { useEffect, useState } from 'react'
|
2
|
2
|
import { View, ScrollView, Text } from '@tarojs/components'
|
3
|
3
|
import Taro from '@tarojs/taro'
|
4
|
4
|
import Banner from '@/components/Banner'
|
|
@@ -10,6 +10,7 @@ import withBasic from '@/layouts/withBasic'
|
10
|
10
|
import MenuItem from './components/MenuItem'
|
11
|
11
|
|
12
|
12
|
import './style.less'
|
|
13
|
+import { getNoticeList } from '../../services/dogAPI'
|
13
|
14
|
|
14
|
15
|
const pt16 = {
|
15
|
16
|
paddingTop: '16px'
|
|
@@ -22,26 +23,29 @@ const ml16 = {
|
22
|
23
|
const IndexPage = (props) => {
|
23
|
24
|
const { pets, cards } = useModel('userData')
|
24
|
25
|
const [totalApplyNum, setTotalApplyNum] = useState(0)
|
25
|
|
-
|
|
26
|
+ const [noticeList, setNoticeList] = useState([])
|
26
|
27
|
const banner = [
|
27
|
28
|
{ imgUrl: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.yd6uU_V7fqswON8cwWUfewHaE7?w=300&h=200&c=7&r=0&o=5&pid=1.7' },
|
28
|
29
|
{ imgUrl: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.A31N2pd7ApUojqrR6x41bwHaFj?pid=ImgDet&rs=1' },
|
29
|
30
|
{ imgUrl: 'https://tse1-mm.cn.bing.net/th/id/R-C.413cf61f5c976cdaddafb30e3aeeb547?rik=AJJ41q9z0C1Anw&riu=http%3a%2f%2ffunpicimg.loveinhere.com%2f1008%2f1%2f4770.jpg&ehk=bP4qnBFW9Ha6lXMKKtVhAnkL2hTHv15pjb5oQpAhF6o%3d&risl=&pid=ImgRaw&r=0' },
|
30
|
31
|
{ imgUrl: 'https://img.zcool.cn/community/01c62e565d10e76ac7253403cbde61.jpg@1280w_1l_2o_100sh.jpg' }
|
31
|
32
|
]
|
32
|
|
- const NoticeList = [
|
33
|
|
- { text: '我是官方系统通知Notice' },
|
34
|
|
- { text: '我是第二条通知奥奥奥奥奥奥' },
|
35
|
|
- { text: '我是第3165656565' },
|
36
|
|
- { text: '我是第四条通知啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊' }
|
37
|
|
- ]
|
38
|
33
|
|
39
|
|
- const goNoticeList=()=>{
|
40
|
|
- Taro.navigateTo({url:'/pages/noticeList/index'})
|
|
34
|
+ useEffect(() => {
|
|
35
|
+ getNoticeList({ pageSize: 5 }).then((res) => {
|
|
36
|
+ console.log('res', res);
|
|
37
|
+ setNoticeList(res.records)
|
|
38
|
+ })
|
|
39
|
+ }, [])
|
|
40
|
+
|
|
41
|
+ const goNoticeList = (e) => {
|
|
42
|
+
|
|
43
|
+ Taro.navigateTo({ url: '/pages/noticeList/index' })
|
41
|
44
|
}
|
|
45
|
+ const goDetail = (id) => {
|
|
46
|
+ console.log("🚀 ~ file: index.jsx ~ line 52 ~ goNoticeList ~ e", e)
|
42
|
47
|
|
43
|
|
- const goDetail = () => {
|
44
|
|
- Taro.navigateTo({ url: '/pages/noticeInfo/index' })
|
|
48
|
+ Taro.navigateTo({ url: `/pages/noticeInfo/index?id=${id}` })
|
45
|
49
|
}
|
46
|
50
|
|
47
|
51
|
return (
|
|
@@ -111,7 +115,8 @@ const IndexPage = (props) => {
|
111
|
115
|
</View>
|
112
|
116
|
|
113
|
117
|
<View className='message-box'>
|
114
|
|
- <Notice onMoreClick={goNoticeList} onClick={goDetail} />
|
|
118
|
+ <Notice NoticeList={noticeList} onMoreClick={goNoticeList} onClick={goDetail} />
|
|
119
|
+
|
115
|
120
|
</View>
|
116
|
121
|
</View>
|
117
|
122
|
</ScrollView>
|