index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. uni.removeStorage({
  95. key:"session_key"
  96. })
  97. } else if (res.cancel) {
  98. console.log('用户点击取消');
  99. }
  100. }
  101. });
  102. }
  103. },
  104. onLoad() {
  105. this.getUserlogin()
  106. setTimeout(() => {
  107. this.getUsermsg(this.usernames)
  108. }, 200)
  109. },
  110. onShow() {
  111. this.$forceUpdate()
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. .subject {
  117. width: 100%;
  118. height: 100vh;
  119. background-color: #F9F9F9;
  120. }
  121. .personal {
  122. width: 90%;
  123. margin: 0 auto;
  124. display: flex;
  125. padding: 20rpx 0 40rpx;
  126. box-sizing: border-box;
  127. .personal_left {
  128. width: 18%;
  129. margin-right: 30rpx;
  130. image {
  131. width: 124rpx;
  132. height: 120rpx;
  133. border-radius: 60rpx;
  134. }
  135. }
  136. .personal_center {
  137. padding-top: 20rpx;
  138. p:nth-child(1) {
  139. font-size: 34rpx;
  140. font-weight: 700;
  141. margin-bottom: 10rpx;
  142. }
  143. p:nth-child(2) {
  144. font-size: 24rpx;
  145. }
  146. }
  147. .personal_right {
  148. width: 150rpx;
  149. background-color: #55C87B;
  150. height: 60rpx;
  151. text-align: center;
  152. border-radius: 30rpx;
  153. line-height: 60rpx;
  154. color: #FFFFFF;
  155. position: absolute;
  156. top: 50rpx;
  157. right: 30rpx;
  158. }
  159. }
  160. .AboutUs,
  161. .quit,
  162. .opinion {
  163. width: 90%;
  164. height: 100rpx;
  165. line-height: 100rpx;
  166. margin: 20rpx auto 0;
  167. position: relative;
  168. padding-left: 20rpx;
  169. font-size: 28rpx;
  170. .icon_left {
  171. margin-right: 20rpx;
  172. color: #55C87B !important;
  173. font-size: 32rpx;
  174. }
  175. .icon_right {
  176. position: absolute;
  177. top: 0;
  178. right: 10rpx;
  179. font-size: 32rpx !important;
  180. }
  181. }
  182. .opinion {
  183. margin: 0 auto;
  184. border-top: 2rpx solid #EAEAEA;
  185. }
  186. </style>