|
@@ -1,8 +1,8 @@
|
|
|
import Buttons from "@/components/basic/Buttons";
|
|
import Buttons from "@/components/basic/Buttons";
|
|
|
import { delSession } from "@/services/common";
|
|
import { delSession } from "@/services/common";
|
|
|
-import { clear, logout } from "@/services/user";
|
|
|
|
|
|
|
+import { clear, getInfo, logout } from "@/services/user";
|
|
|
import { View, Text, Image, Switch } from "@tarojs/components";
|
|
import { View, Text, Image, Switch } from "@tarojs/components";
|
|
|
-import Taro, { useDidShow, useShareAppMessage } from "@tarojs/taro";
|
|
|
|
|
|
|
+import Taro, { useDidShow, usePullDownRefresh, useShareAppMessage } from "@tarojs/taro";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import './Profile.scss'
|
|
import './Profile.scss'
|
|
|
import Box from "@/components/layout/Box";
|
|
import Box from "@/components/layout/Box";
|
|
@@ -13,6 +13,7 @@ import TableCell from "@/components/layout/TableCell";
|
|
|
import { useEffect, useState } from "react";
|
|
import { useEffect, useState } from "react";
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import Tabbar from "@/components/navigation/TabBar";
|
|
import Tabbar from "@/components/navigation/TabBar";
|
|
|
|
|
+import { getInfoSuccess } from "@/store/user";
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
@@ -23,6 +24,7 @@ export default function Page() {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
const [switchOn, setSwitchOn] = useState(false)
|
|
const [switchOn, setSwitchOn] = useState(false)
|
|
|
|
|
+ const [triggered, setTriggered] = useState(true)
|
|
|
|
|
|
|
|
let navigation;
|
|
let navigation;
|
|
|
if (useNavigation) {
|
|
if (useNavigation) {
|
|
@@ -112,7 +114,22 @@ export default function Page() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- console.log(user.avatar)
|
|
|
|
|
|
|
+ usePullDownRefresh(() => {
|
|
|
|
|
+ refresh()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ function refresh() {
|
|
|
|
|
+ setTriggered(true)
|
|
|
|
|
+ getInfo().then(res => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ Taro.stopPullDownRefresh()
|
|
|
|
|
+ dispatch(getInfoSuccess(res))
|
|
|
|
|
+ setTriggered(false)
|
|
|
|
|
+ }).catch(e => {
|
|
|
|
|
+ Taro.stopPullDownRefresh()
|
|
|
|
|
+ setTriggered(false)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
function detail() {
|
|
function detail() {
|
|
|
return <View className="container">
|
|
return <View className="container">
|
|
@@ -221,7 +238,11 @@ export default function Page() {
|
|
|
|
|
|
|
|
return <View>
|
|
return <View>
|
|
|
<Layout title={t('page.more.title')}
|
|
<Layout title={t('page.more.title')}
|
|
|
- titleShowStyle={NaviBarTitleShowType.scrollToShow} type={TemplateType.flex}>
|
|
|
|
|
|
|
+ titleShowStyle={NaviBarTitleShowType.scrollToShow}
|
|
|
|
|
+ type={TemplateType.flex}
|
|
|
|
|
+ triggered={triggered}
|
|
|
|
|
+ refresh={refresh}
|
|
|
|
|
+ >
|
|
|
{
|
|
{
|
|
|
detail()
|
|
detail()
|
|
|
}
|
|
}
|