|
@@ -8,23 +8,43 @@ import { fetch } from '@/utils/request'
|
8
|
8
|
import { API_CARDS_UV, API_ITEMS_DETAIL, API_CARDS_LIST } from '@/constants/api'
|
9
|
9
|
import { getImgURL } from '@/utils/image'
|
10
|
10
|
import useLike from "@/utils/hooks/useLike";
|
|
11
|
+import useShare from '@/utils/hooks/useShare'
|
|
12
|
+import useParams from '@/utils/hooks/useParams'
|
11
|
13
|
import { savePoint } from '@/services/common'
|
12
|
14
|
import '@/assets/css/iconfont.css'
|
13
|
15
|
import './index.scss'
|
14
|
16
|
|
15
|
17
|
export default withLayout((props) => {
|
16
|
18
|
|
17
|
|
- const { router, trackData } = props
|
|
19
|
+ const { router, shareContent, page, trackData } = props
|
18
|
20
|
const { id } = router.params
|
19
|
21
|
|
20
|
22
|
const [ShowPopup, setShowPopup] = useState(false)
|
21
|
23
|
const [UserInfo, setUserInfo] = useState({})
|
22
|
24
|
const [BuildingInfo, setBuildingInfo] = useState({})
|
23
|
|
- const [LikeNum, setLikeNum] = useState(0)
|
|
25
|
+ // const [LikeNum, setLikeNum] = useState(0)
|
24
|
26
|
|
25
|
27
|
const user = useSelector(state => state.user)
|
26
|
28
|
const [PersonId, setPersonId] = useState(null)
|
27
|
29
|
|
|
30
|
+ // 本页面分享或者海报参数
|
|
31
|
+ const paramsRef = useParams({
|
|
32
|
+ id: user.userInfo.person.personId,
|
|
33
|
+ buildingId: BuildingInfo?.buildingId,
|
|
34
|
+ person: user.userInfo.person,
|
|
35
|
+ from: `${page.type}_share`
|
|
36
|
+ })
|
|
37
|
+ const fullTrackData = { ...trackData, buildingId: BuildingInfo?.buildingId }
|
|
38
|
+
|
|
39
|
+ // 分享
|
|
40
|
+ useShare({
|
|
41
|
+ // title: shareContent.shareContentTitle || DetailInfo?.buildingName,
|
|
42
|
+ path: `${router.path}?${paramsRef.current}`,
|
|
43
|
+ // image: shareContent.shareContentImg,
|
|
44
|
+ },
|
|
45
|
+ fullTrackData,
|
|
46
|
+ )
|
|
47
|
+
|
28
|
48
|
const [isSave, handleFavor] = useLike(UserInfo?.liked, {
|
29
|
49
|
id: id || user.userInfo.person.personId,
|
30
|
50
|
...trackData,
|
|
@@ -33,15 +53,15 @@ export default withLayout((props) => {
|
33
|
53
|
if(!isSave) {
|
34
|
54
|
AddHotNum()
|
35
|
55
|
}
|
36
|
|
- const likeNum = isSave ? UserInfo.likeNum - 1 : UserInfo.likeNum + 1
|
37
|
|
- setLikeNum(likeNum)
|
|
56
|
+ // const likeNum = isSave ? UserInfo.likeNum - 1 : UserInfo.likeNum + 1
|
|
57
|
+ // setLikeNum(likeNum)
|
38
|
58
|
})
|
39
|
59
|
|
40
|
|
- useEffect(() => {
|
41
|
|
- if(UserInfo.id) {
|
42
|
|
- setLikeNum(UserInfo.likeNum)
|
43
|
|
- }
|
44
|
|
- }, [UserInfo])
|
|
60
|
+ // useEffect(() => {
|
|
61
|
+ // if(UserInfo.id) {
|
|
62
|
+ // setLikeNum(UserInfo.likeNum)
|
|
63
|
+ // }
|
|
64
|
+ // }, [UserInfo])
|
45
|
65
|
|
46
|
66
|
useEffect(() => {
|
47
|
67
|
if (PersonId !== user.userInfo.person.personId) {
|