mine-info.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view>
  3. <button class="item bg-white btn" style="padding: 10rpx 20rpx;">
  4. <view class="flex align-center justify-center">
  5. <text style="font-size: 28rpx;font-weight: 500;">头像:</text>
  6. </view>
  7. <view class="flex padding-top-20 ">
  8. <u-avatar size="88" :src="wxUserInfo.avatarUrl"></u-avatar>
  9. <text class="cuIcon-right padding-left-20 "></text>
  10. </view>
  11. </button>
  12. <button class="item btn" style="padding: 6rpx 20rpx;">
  13. <view class="flex align-center justify-center">
  14. <text style="font-size: 28rpx;font-weight: 500;">昵称:</text>
  15. </view>
  16. <view class="flex align-center justify-center">
  17. <text>{{wxUserInfo.nickName}}</text>
  18. <text class="cuIcon-right padding-left-20"></text>
  19. </view>
  20. </button>
  21. <view class="item" @click="sexShow=true">
  22. <view class="">
  23. <text>性别:</text>
  24. </view>
  25. <view class="" >
  26. <text v-text="wxUserInfo.gender==2?'女':'男'"></text>
  27. <text class="cuIcon-right padding-left-10"></text>
  28. </view>
  29. </view>
  30. <view class="item">
  31. <view class="">
  32. <text>手机号:</text>
  33. </view>
  34. <view class="">
  35. <text >{{phone}}</text>
  36. <text class="cuIcon-right padding-left-10"></text>
  37. </view>
  38. </view>
  39. <view v-if="!$isEmpty(phone)" @click="loginOut" class="flex bg-blue cu-btn round" style="margin: 80rpx 20rpx;padding: 40rpx 0;">
  40. 退出登陆
  41. </view>
  42. <u-action-sheet :list="sexList" v-model="sexShow"></u-action-sheet>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. wxUserInfo:'',
  50. phone:'',
  51. sexList:[
  52. {
  53. text:'男',
  54. value:1
  55. },
  56. {
  57. text:'女',
  58. value:2
  59. },
  60. ],
  61. sexShow:false
  62. }
  63. },
  64. onLoad() {
  65. this.wxUserInfo=this.$cache.get('userInfo')
  66. console.log(this.wxUserInfo);
  67. this.phone=this.$cache.get('phone')
  68. },
  69. methods: {
  70. loginOut(){
  71. try {
  72. uni.clearStorageSync();
  73. uni.showModal({
  74. showCancel:false,
  75. confirmText:"确认",
  76. content:"退出成功",
  77. success() {
  78. uni.reLaunch({
  79. url:"../../login/login"
  80. })
  81. }
  82. })
  83. } catch (e) {
  84. uni.showToast({
  85. title:"退出失败",
  86. icon:"none"
  87. })
  88. }
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss">
  94. .item{
  95. display: flex;
  96. justify-content: space-between;
  97. background-color: #FFFFFF;
  98. padding:26rpx 20rpx;
  99. border-bottom: 1rpx solid #f4f4f4;
  100. }
  101. .btn::after {
  102. border: none;
  103. }
  104. </style>