index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view>
  3. <view class="personal">
  4. <view class="personal-main">
  5. <u-avatar :src="avatar" mode="square" size="60" class="u-avatar"></u-avatar>
  6. <view class="personal-info">
  7. <view class="">用户名</view>
  8. <view class="">{{userInfo.username}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <!-- <view class="n-p" v-for="(item,index) in list" :key="index" hover-class="hover-class" @click="onClick(item)">
  13. <view style="position: relative">
  14. <view class="p-left">
  15. <u-icon :name="item.icon" size="30" color="#757575"></u-icon>
  16. </view>
  17. </view>
  18. <view class="p-right">
  19. <view class="p-right-main">
  20. <view class="p-right-main-name">{{item.name}}</view>
  21. </view>
  22. <view class="lfet-a">
  23. <view style="position: relative">
  24. </view>
  25. <u-icon name="arrow-right" size="20" class="p-right-icon"></u-icon>
  26. </view>
  27. </view>
  28. </view> -->
  29. <view class="button-login" @click="layout">退出登录</view>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. mapState
  35. } from 'vuex';
  36. export default {
  37. computed: {
  38. ...mapState(['hasLogin'])
  39. },
  40. onShow() {
  41. if (this.hasLogin || uni.getStorageSync("userInfo").username) {
  42. this.userInfo = uni.getStorageSync("userInfo")
  43. } else {
  44. uni.navigateTo({
  45. url: "/pages/login/login"
  46. })
  47. // uni.({
  48. // url: '/pages/index/index'
  49. // })
  50. }
  51. },
  52. data() {
  53. return {
  54. userInfo: {},
  55. avatar: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1730713693,2130926401&fm=26&gp=0.jpg',
  56. list: [
  57. // {
  58. // name: '收藏',
  59. // id: 'favorites',
  60. // icon: 'star-fill',
  61. // iconBackground: '#398c0c',
  62. // },
  63. // {
  64. // name: '相册',
  65. // id: 'photoAlbum',
  66. // icon: 'photo-fill',
  67. // iconBackground: '#5e2d88',
  68. // }, {
  69. // name: '卡包',
  70. // id: 'cardPackage',
  71. // icon: 'grid-fill',
  72. // iconBackground: '#33696c',
  73. // }, {
  74. // name: '表情',
  75. // id: 'expression',
  76. // icon: 'gift-fill',
  77. // iconBackground: '#833456',
  78. // },
  79. {
  80. name: '修改密码',
  81. id: 'setUp',
  82. icon: 'setting-fill',
  83. iconBackground: '#3b2021',
  84. },
  85. ],
  86. }
  87. },
  88. methods: {
  89. layout() {
  90. this.$store.commit('logout', {})
  91. uni.clearStorageSync();
  92. uni.navigateTo({
  93. url: "/pages/login/login"
  94. })
  95. },
  96. onClick(item) {
  97. uni.navigateTo({
  98. url: "/pages/login/forget"
  99. })
  100. },
  101. }
  102. }
  103. </script>
  104. <style>
  105. page {
  106. background-color: #f7f7f7;
  107. }
  108. .personal {
  109. display: flex;
  110. align-items: center;
  111. justify-content: space-between;
  112. padding: 30rpx 0 40rpx 30rpx;
  113. }
  114. .personal-main {
  115. display: flex;
  116. align-items: center;
  117. }
  118. .personal-info {
  119. display: flex;
  120. /* flex-direction: column; */
  121. }
  122. .u-avatar {
  123. margin-right: 30rpx;
  124. }
  125. .navbar-right {
  126. padding: 0 40rpx;
  127. }
  128. .navbar-right-icon {
  129. margin-left: 50rpx;
  130. }
  131. .hover-class {
  132. background-color: #efefef;
  133. }
  134. .n-p {
  135. display: flex;
  136. align-items: center;
  137. background-color: #ffffff;
  138. margin-bottom: 20rpx;
  139. }
  140. .p-right-icon {
  141. padding: 0 40rpx;
  142. }
  143. .p-left {
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. width: 60rpx;
  148. height: 60rpx;
  149. padding: 10rpx;
  150. margin: 20rpx;
  151. color: #FFFFFF;
  152. border-radius: 10rpx;
  153. }
  154. .p-right {
  155. height: 90rpx;
  156. flex: 1;
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-between;
  160. }
  161. .p-right-main {
  162. display: flex;
  163. align-items: center;
  164. justify-content: space-between;
  165. }
  166. .p-right-main-name {
  167. font-size: 36rpx;
  168. font-weight: 500;
  169. }
  170. .p-right-main-time {
  171. margin-right: 20rpx;
  172. font-size: 24rpx;
  173. color: #9d9d9d;
  174. }
  175. .button-login {
  176. color: #FFFFFF;
  177. font-size: 34rpx;
  178. width: 470rpx;
  179. height: 100rpx;
  180. background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
  181. box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
  182. border-radius: 50rpx;
  183. line-height: 100rpx;
  184. text-align: center;
  185. margin-left: auto;
  186. margin-right: auto;
  187. margin-top: 100rpx;
  188. }
  189. </style>