index.jsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { Component } from 'react'
  2. import Taro from '@tarojs/taro'
  3. import { View, Text, Image } from '@tarojs/components'
  4. import { AtList, AtListItem } from "taro-ui"
  5. import {getUserInfo} from '../../service'
  6. import './index.less'
  7. import loginOut from '../../images/mine/loginOut.png'
  8. import edit from '../../images/mine/edit.png'
  9. import norm from '../../images/mine/norm.png'
  10. import avatar from '../../images/mine/avatar.png'
  11. export default class Index extends Component {
  12. handleLogout = () => {
  13. Taro.showModal({
  14. title: '',
  15. content: '退出后,请重新登录!',
  16. cancelText: '暂不退出',
  17. confirmText: '退出登录',
  18. cancelColor: '#000000',
  19. confirmColor: '#F6C71A',
  20. success: function (res) {
  21. if (res.confirm) {
  22. console.log('用户点击退出登录')
  23. }
  24. }
  25. })
  26. }
  27. getUserInfo = async () => {
  28. const res = await getUserInfo();
  29. console.log(res);
  30. };
  31. componentDidMount(){
  32. this.getUserInfo()
  33. }
  34. render () {
  35. return (
  36. <View className='index'>
  37. {/* 个人信息 */}
  38. <View className="info">
  39. <Image src={avatar} className="avatar" />
  40. <View className="info-right">
  41. <View className='user-info'>
  42. <View className="name">张三</View>
  43. <View className="account">138001</View>
  44. </View>
  45. <Image onClick={() => Taro.navigateTo({ url: `/pages/mineSub/infoEdit/index` })} className='edit-icon' src={edit}></Image>
  46. </View>
  47. </View>
  48. {/* 功能 */}
  49. <View className='function'>
  50. <AtList hasBorder={false}>
  51. <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/mineSub/userSpecification/index` })} title='用户规范' arrow='right' thumb={norm}/>
  52. <View className='line'></View>
  53. <AtListItem
  54. hasBorder={false}
  55. title='退出登录'
  56. arrow='right'
  57. thumb={loginOut}
  58. onClick={this.handleLogout}
  59. />
  60. </AtList>
  61. </View>
  62. </View>
  63. )
  64. }
  65. }