import React from 'react'; import Taro from '@tarojs/taro'; import { View, Button, Image } from '@tarojs/components'; import { logout } from '@/actions/auth'; import { getLogoutUrl } from '@/services/api'; import cfg from '../../config'; import './index.scss'; import headImg from '../../static/img/my/head.png'; import moreImg from '../../static/img/my/more.svg'; import pswdImg from '../../static/img/my/pswd.svg'; import reportImg from '../../static/img/my/report.svg'; import Common from '../../components/echartForWx/common'; // 如果这行删掉微信小程序编译就一直死循环,待解决 const { webUrl } = cfg; const Index = ({ ...props }) => { const userInfo = Taro.getStorageSync('userInfo') || {}; const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false const changePassword = () => { Taro.navigateTo({ url: '/packages/changePassword/index' }) } const toMyReport = () => { Taro.navigateTo({ url: '/packages/patrolView/index?filter=my' }) } const toPatrolReport = () => { Taro.navigateTo({ url: '/packages/patrol/index?type=edit' }) } const onLogout = () => { Taro.showModal({ title: '提示', content: '确定退出登录吗', success: function (res) { if (res.confirm) { logout(getLogoutUrl()).then(() => { Taro.reLaunch({ url: '/pages/auth/login/login' }); }); } } }) } return ( {userInfo.name} {userInfo.phone} {isSuperAdmin ? '巡查上报' : '我的上报'} 修改密码 退出登录 ); } export default Index;