index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="my">
  3. <view class="my_content">
  4. <view class="news">
  5. <view class="private">
  6. <view class="avatar"><image src="@/static/image/ic_me.png"></image></view>
  7. <view class="info">
  8. <text>{{info.username}}</text>
  9. <!-- <text>156*****7654</text> -->
  10. </view>
  11. </view>
  12. <view class="right" @click="logOut"><pv-image imgSrc="/playVideo/video/ic_more_white.png" width="32" height="32"></pv-image></view>
  13. </view>
  14. <view class="menu">
  15. <view class="menu_item" @click="toHistory">
  16. <view class="name">
  17. <pv-image imgSrc="/playVideo/video/ic-jilu.png" width="48" height="48"></pv-image>
  18. <text>观看历史</text>
  19. </view>
  20. <pv-image imgSrc="/playVideo/video/ic_more_black.png" width="24" height="24"></pv-image>
  21. </view>
  22. <!-- <view class="menu_item">
  23. <view class="name">
  24. <pv-image imgSrc="/playVideo/video/ic-kefu.png" width="48" height="48"></pv-image>
  25. <text>联系客服</text>
  26. </view>
  27. <pv-image imgSrc="/playVideo/video/ic_more_black.png" width="24" height="24"></pv-image>
  28. </view> -->
  29. </view>
  30. </view>
  31. <u-popup :show="show" @close="close" safeAreaInsetBottom :round="8">
  32. <view class="safe-area-inset-bottom">
  33. <view class="login-out" @click="outLogin">退出登录</view>
  34. </view>
  35. </u-popup>
  36. </view>
  37. </template>
  38. <script>
  39. import { getUserInfo } from '@/apis/my'
  40. import { logout } from '@/apis/login'
  41. export default {
  42. data(){
  43. return{
  44. show:false,
  45. info:{},
  46. }
  47. },
  48. mounted() {
  49. this.getInfo()
  50. },
  51. methods:{
  52. toHistory(){
  53. uni.navigateTo({
  54. url:'/pages/history/index'
  55. })
  56. },
  57. async getInfo(){
  58. const res = await getUserInfo()
  59. this.info = res
  60. console.log(res,'res');
  61. },
  62. async outLogin(){
  63. const res = await logout()
  64. uni.removeStorageSync('Authorization')
  65. uni.removeStorageSync('username')
  66. uni.redirectTo({
  67. url: '/pages/login/index'
  68. })
  69. },
  70. logOut(){
  71. this.show = true
  72. },
  73. close() {
  74. this.show = false
  75. // console.log('close');
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .my{
  82. height: 100%;
  83. background: linear-gradient( 172deg, #216CFF 0%, #C7F0FF 36%, #E1FAFF 100%);
  84. .my_content{
  85. height: 100%;
  86. display: flex;
  87. flex-direction: column;
  88. }
  89. .news{
  90. padding: 32rpx 32rpx 48rpx;
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. .private{
  95. display: flex;
  96. .avatar{
  97. width: 104rpx;
  98. height: 104rpx;
  99. background: #21FFFA;
  100. margin-right: 24rpx;
  101. border-radius:50% ;
  102. image{
  103. width: 100%;
  104. height: 100%;
  105. border-radius: 50%;
  106. }
  107. }
  108. .info{
  109. color: #fff;
  110. display: flex;
  111. flex-direction: column;
  112. justify-content: space-around;
  113. }
  114. }
  115. .right{
  116. flex: 1;
  117. display: flex;
  118. justify-content: flex-end;
  119. .more{
  120. margin-top: 26rpx;
  121. }
  122. }
  123. }
  124. .menu{
  125. padding: 24rpx 32rpx;
  126. flex: 1;
  127. background: #fff;
  128. border-radius: 24rpx 24rpx 0 0;
  129. .menu_item{
  130. padding: 32rpx 28rpx 32rpx 24rpx;
  131. display: flex;
  132. justify-content: space-between;
  133. align-items: center;
  134. border-bottom: 2rpx solid #F0F2F4;
  135. .name{
  136. display: flex;
  137. align-items: center;
  138. text{
  139. margin-left: 20rpx;
  140. font-size: 28rpx;
  141. }
  142. }
  143. }
  144. .menu_item:nth-last-child(1){
  145. border: none;
  146. }
  147. }
  148. .login-out{
  149. text-align: center;
  150. margin: 40rpx 0;
  151. }
  152. }
  153. </style>