index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="myIndex">
  3. <!-- 个人信息 -->
  4. <view class="myIndex_header">
  5. <view class="myIndex_header_icon">
  6. <image src="../../static/header.png" class="header_icon"></image>
  7. </view>
  8. <view class="myIndex_header_info">
  9. <view class="myIndex_header_name">
  10. <view class="myIndex_header_name_text">{{pageData.userName}}</view>
  11. <!-- <image :src="eyeIcon.nowIcon" class="myIndex_header_eyeIcon"></image> -->
  12. </view>
  13. <view class="myIndex_header_address">{{pageData.address}}</view>
  14. </view>
  15. </view>
  16. <!-- 菜单列表 -->
  17. <view>
  18. <uni-list>
  19. <uni-list-item thumb="/static/user_info.png" showArrow title="个人信息"/>
  20. <uni-list-item thumb="/static/about.png" showArrow title="关于我们"/>
  21. </uni-list>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import http from '@/utils/request';
  27. import { ref,reactive } from "vue";
  28. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  29. const pageData=reactive({
  30. userName:'',
  31. address:''
  32. })
  33. const eyeIcon=reactive({
  34. nowIcon:'',
  35. showIcon:'/static/whiteDisplay.png',
  36. hideIcon:'/static/whiteHide.png',
  37. })
  38. // 获取用户信息
  39. const getUserInfo=()=>{
  40. try{
  41. const value=uni.getStorageSync("userInfo")
  42. console.log(value);
  43. pageData.userName = value.nickname
  44. pageData.address=value.deptName
  45. }catch(e){
  46. //TODO handle the exception
  47. }
  48. }
  49. onShow(()=>{
  50. getUserInfo()
  51. eyeIcon.nowIcon=eyeIcon.hideIcon
  52. })
  53. </script>
  54. <style lang="scss" scoped>
  55. @import './index.scss'
  56. </style>