index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view>
  3. <view class="subject">
  4. <view style="width: 100%;background-color: #FFFFFF;position: relative;">
  5. <view class="personal">
  6. <view class="personal_left">
  7. <image :src="userinfos.image" mode=""></image>
  8. </view>
  9. <view class="personal_center">
  10. <p>{{usernames}}</p>
  11. <p>{{userinfos.email}}</p>
  12. </view>
  13. <view class="personal_right" @click="userinfo">
  14. <uni-icons type="compose" style="color: #FFFFFF;margin-right: 10rpx;"></uni-icons>
  15. 编辑
  16. </view>
  17. </view>
  18. </view>
  19. <view style="background-color: #FFFFFF;margin: 20rpx auto 0;">
  20. <view class="AboutUs" @click="about">
  21. <u-icon name="moban" custom-prefix="custom-icon" class="icon_left"></u-icon>
  22. 关于我们
  23. <uni-icons type="arrowright" class="icon_right"></uni-icons>
  24. </view>
  25. </view>
  26. <view style="background-color: #FFFFFF;">
  27. <view class="quit" @click="outto">
  28. <u-icon name="tuichu" custom-prefix="custom-icon" class="icon_left"></u-icon>
  29. 退出登录
  30. <uni-icons type="arrowright" class="icon_right"></uni-icons>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. usernames: '',
  41. userinfos: {
  42. }
  43. }
  44. },
  45. methods: {
  46. //user.login.user_login_info
  47. //home.homes.personal_center
  48. async getUserlogin() {
  49. const res = await this.$myRequest({
  50. url: '/api/api_gateway?method=user.login.user_login_info',
  51. })
  52. this.usernames = res.username
  53. },
  54. async getUsermsg(user) {
  55. const res = await this.$myRequest({
  56. url: '/api/api_gateway?method=home.homes.personal_center',
  57. data: {
  58. username: user
  59. }
  60. })
  61. console.log(res)
  62. this.userinfos = res
  63. }, //user.login.logout_user
  64. async getlogout() {
  65. const res = await this.$myRequest({
  66. url: '/api/api_gateway?method=user.login.logout_user',
  67. })
  68. },
  69. about() {
  70. uni.navigateTo({
  71. url: "../about/about"
  72. })
  73. },
  74. // feedback(){
  75. // uni.navigateTo({
  76. // url:"../feedback/feedback"
  77. // })
  78. // },
  79. userinfo() {
  80. uni.navigateTo({
  81. url: "../user-info/user-info?data=" + JSON.stringify(this.userinfos)
  82. })
  83. },
  84. outto() {
  85. uni.showModal({
  86. title: '提示',
  87. content: '是否退出登录',
  88. success: (res) => {
  89. if (res.confirm) {
  90. this.getlogout()
  91. uni.navigateTo({
  92. url: "../../login/login"
  93. })
  94. } else if (res.cancel) {
  95. console.log('用户点击取消');
  96. }
  97. }
  98. });
  99. }
  100. },
  101. onLoad() {
  102. this.getUserlogin()
  103. setTimeout(() => {
  104. this.getUsermsg(this.usernames)
  105. }, 200)
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .subject {
  111. width: 100%;
  112. height: 100vh;
  113. background-color: #F9F9F9;
  114. }
  115. .personal {
  116. width: 90%;
  117. margin: 0 auto;
  118. display: flex;
  119. padding: 20rpx 0 40rpx;
  120. box-sizing: border-box;
  121. .personal_left {
  122. width: 18%;
  123. margin-right: 30rpx;
  124. image {
  125. width: 124rpx;
  126. height: 120rpx;
  127. border-radius: 60rpx;
  128. }
  129. }
  130. .personal_center {
  131. padding-top: 20rpx;
  132. p:nth-child(1) {
  133. font-size: 34rpx;
  134. font-weight: 700;
  135. margin-bottom: 10rpx;
  136. }
  137. p:nth-child(2) {
  138. font-size: 24rpx;
  139. }
  140. }
  141. .personal_right {
  142. width: 150rpx;
  143. background-color: #55C87B;
  144. height: 60rpx;
  145. text-align: center;
  146. border-radius: 30rpx;
  147. line-height: 60rpx;
  148. color: #FFFFFF;
  149. position: absolute;
  150. top: 50rpx;
  151. right: 30rpx;
  152. }
  153. }
  154. .AboutUs,
  155. .quit,
  156. .opinion {
  157. width: 90%;
  158. height: 100rpx;
  159. line-height: 100rpx;
  160. margin: 20rpx auto 0;
  161. position: relative;
  162. padding-left: 20rpx;
  163. font-size: 28rpx;
  164. .icon_left {
  165. margin-right: 20rpx;
  166. color: #55C87B !important;
  167. font-size: 32rpx;
  168. }
  169. .icon_right {
  170. position: absolute;
  171. top: 0;
  172. right: 10rpx;
  173. font-size: 32rpx !important;
  174. }
  175. }
  176. .opinion {
  177. margin: 0 auto;
  178. border-top: 2rpx solid #EAEAEA;
  179. }
  180. </style>