user.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="user">
  3. <view class="user-info">
  4. <view class="user-img">
  5. <image src="../../static/images/people@2x.png" mode=""></image>
  6. </view>
  7. <view class="user-text">
  8. <view class="name">
  9. {{userData.real_name}}
  10. </view>
  11. <view class="address">
  12. <!-- 福建宏星电子科技有限公司 -->
  13. </view>
  14. </view>
  15. <view class="">
  16. <uni-icons color="#fff" type="right" size="30"></uni-icons>
  17. </view>
  18. </view>
  19. <ul class="user-list">
  20. <li>
  21. <view class="list-left">
  22. <image src="../../static/images/icon_sbxx@2x.png" mode=""></image>
  23. <view class="text">
  24. {{$t('login.deviceInformation')}}
  25. </view>
  26. <uni-icons style="color:#fff" type="right" size="30"></uni-icons>
  27. </view>
  28. <view class="">
  29. <uni-icons color="#999" type="right" size="30"></uni-icons>
  30. </view>
  31. </li>
  32. <li @click="changeLang">
  33. <view class="list-left">
  34. <image src="../../static/images/icon_qhyy@2x.png" mode=""></image>
  35. <view class="text">
  36. {{$t('login.switchLanguage')}}
  37. </view>
  38. <uni-icons style="color:#fff" type="right" size="30"></uni-icons>
  39. </view>
  40. <view class="">
  41. <uni-icons color="#999" type="right" size="30"></uni-icons>
  42. </view>
  43. </li>
  44. </ul>
  45. <view class="login-out" @click="logout">
  46. {{$t('login.logOut')}}
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import Vue from 'vue'
  52. export default{
  53. data(){
  54. return {
  55. userData:Vue.prototype.$token,
  56. }
  57. },
  58. methods:{
  59. changeLang() {
  60. let system_info = uni.getStorageSync('locale');
  61. console.log(system_info)
  62. !system_info || system_info == 'zh-CN' ? system_info = this._i18n.locale = 'en' :
  63. system_info = this._i18n.locale = 'zh-CN'
  64. uni.setStorageSync('locale', system_info);
  65. },
  66. logout(){
  67. uni.navigateTo({
  68. url: '/pages/user/login'
  69. })
  70. },
  71. },
  72. created(){
  73. console.log(this.userData)
  74. },
  75. }
  76. </script>
  77. <style lang="less">
  78. .user{
  79. .user-list{
  80. background-color: #fff;
  81. border-radius: 20rpx;
  82. position: relative;
  83. top: -100rpx;
  84. li{
  85. height: 120rpx;
  86. line-height: 120rpx;
  87. display: flex;
  88. justify-content: space-between;
  89. padding: 0 24rpx;
  90. .list-left{
  91. display: flex;
  92. image{
  93. width: 48rpx;
  94. height: 48rpx;
  95. margin: 36rpx 16rpx 36rpx 0;
  96. }
  97. }
  98. }
  99. }
  100. .user-info{
  101. background: linear-gradient(180deg,#3370ff, #f1f1f1);
  102. height: 500rpx;
  103. display: flex;
  104. align-items: center;
  105. justify-content: space-between;
  106. padding: 0 24rpx;
  107. color: #fff;
  108. .user-text{
  109. position: relative;
  110. left: -10%;
  111. }
  112. .name{
  113. font-size: 40rpx;
  114. }
  115. .address{
  116. font-size: 28rpx;
  117. margin-top: 10rpx;
  118. }
  119. .user-img{
  120. width: 120rpx;
  121. height: 120rpx;
  122. border-radius: 50%;
  123. background-color: #fff;
  124. image{
  125. width: 100rpx;
  126. height: 100rpx;
  127. margin: 10rpx;
  128. }
  129. }
  130. }
  131. .user-info>view{
  132. position: relative;
  133. top: -50rpx;
  134. }
  135. text{
  136. color: #fff;
  137. }
  138. .login-out{
  139. height: 90rpx;
  140. line-height: 90rpx;
  141. text-align: center;
  142. margin: 0 auto;
  143. position: fixed;
  144. left: 45rpx;
  145. right: 45rpx;
  146. bottom: 180rpx;
  147. background-color: #EAF0FF;
  148. color: #3370FF;
  149. border-radius: 45rpx;
  150. }
  151. }
  152. </style>