Setting.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import Buttons from "@/components/basic/Buttons";
  2. import Footer from "@/components/layout/Footer";
  3. import TableCell from "@/components/layout/TableCell";
  4. import { ColorType } from "@/context/themes/color";
  5. import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
  6. import { clear, logout } from "@/services/user";
  7. import { View, Text, Button } from "@tarojs/components";
  8. import Taro from "@tarojs/taro";
  9. import { useEffect } from "react";
  10. import { useTranslation } from "react-i18next";
  11. import { useDispatch, useSelector } from "react-redux";
  12. export default function Page() {
  13. const dispatch = useDispatch();
  14. const { t } = useTranslation()
  15. const user = useSelector((state: any) => state.user);
  16. useEffect(() => {
  17. Taro.setNavigationBarTitle({
  18. title: t('page.setting.title')
  19. })
  20. }, [])
  21. function logoutF() {
  22. Taro.showModal({
  23. title: t('feature.common.modal.logout_title'),
  24. content: t('feature.common.modal.logout_content'),
  25. success: res => {
  26. if (res.confirm) {
  27. dispatch(logout() as any);
  28. }
  29. }
  30. })
  31. }
  32. return <View style={{ color: '#fff',display:'flex',flexDirection:'column' }}>
  33. <View style={{height:20}}/>
  34. <TableCell title={t('page.setting.version')} ><Text style={{ opacity: 0.8 }}>1.2.4</Text></TableCell>
  35. {/* <Text style={{color:'#9E9E9E',textAlign:'center',fontSize:14}}>v1.2.2</Text> */}
  36. <Footer>
  37. <ChooseScenarioBtn title={t('page.setting.logout')} onClick={logoutF} background={ColorType.fast} />
  38. </Footer>
  39. {/* <Buttons title='退出登录' onClick={logoutF} btnStyle={{ width: 289, marginBottom: 30 }} /> */}
  40. {/* {
  41. user.test_user && <Buttons title='注销账号' onClick={clearF} btnStyle={{ width: 289, marginBottom: 30 }} />
  42. } */}
  43. </View>
  44. }