index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. console.log(res)
  53. this.usernames = res.username
  54. this.getUsermsg(this.usernames)
  55. },
  56. async getUsermsg(user) {
  57. const res = await this.$myRequest({
  58. url: '/api/api_gateway?method=home.homes.personal_center',
  59. data: {
  60. username: user
  61. }
  62. })
  63. console.log(res)
  64. this.userinfos = res
  65. }, //user.login.logout_user
  66. async getlogout() {
  67. const res = await this.$myRequest({
  68. url: '/api/api_gateway?method=user.login.logout_user',
  69. })
  70. },
  71. about() {
  72. uni.navigateTo({
  73. url: "../about/about"
  74. })
  75. },
  76. // feedback(){
  77. // uni.navigateTo({
  78. // url:"../feedback/feedback"
  79. // })
  80. // },
  81. userinfo() {
  82. uni.navigateTo({
  83. url: "../user-info/user-info?data=" + JSON.stringify(this.userinfos)
  84. })
  85. },
  86. outto() {
  87. uni.showModal({
  88. title: '提示',
  89. content: '是否退出登录',
  90. success: (res) => {
  91. if (res.confirm) {
  92. this.getlogout()
  93. uni.removeStorage({
  94. key:"session_key"
  95. })
  96. uni.navigateTo({
  97. url: "../../login/login"
  98. })
  99. } else if (res.cancel) {
  100. console.log('用户点击取消');
  101. }
  102. }
  103. });
  104. }
  105. },
  106. onLoad() {
  107. this.getUserlogin()
  108. },
  109. onShow() {
  110. this.$forceUpdate()
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. .subject {
  116. width: 100%;
  117. height: 100vh;
  118. background-color: #F9F9F9;
  119. }
  120. .personal {
  121. width: 90%;
  122. margin: 0 auto;
  123. display: flex;
  124. padding: 20rpx 0 40rpx;
  125. box-sizing: border-box;
  126. .personal_left {
  127. width: 18%;
  128. margin-right: 30rpx;
  129. image {
  130. width: 124rpx;
  131. height: 120rpx;
  132. border-radius: 60rpx;
  133. }
  134. }
  135. .personal_center {
  136. padding-top: 20rpx;
  137. p:nth-child(1) {
  138. font-size: 34rpx;
  139. font-weight: 700;
  140. margin-bottom: 10rpx;
  141. }
  142. p:nth-child(2) {
  143. font-size: 24rpx;
  144. }
  145. }
  146. .personal_right {
  147. width: 150rpx;
  148. background-color: #55C87B;
  149. height: 60rpx;
  150. text-align: center;
  151. border-radius: 30rpx;
  152. line-height: 60rpx;
  153. color: #FFFFFF;
  154. position: absolute;
  155. top: 50rpx;
  156. right: 30rpx;
  157. }
  158. }
  159. .AboutUs,
  160. .quit,
  161. .opinion {
  162. width: 90%;
  163. height: 100rpx;
  164. line-height: 100rpx;
  165. margin: 20rpx auto 0;
  166. position: relative;
  167. padding-left: 20rpx;
  168. font-size: 28rpx;
  169. .icon_left {
  170. margin-right: 20rpx;
  171. color: #55C87B !important;
  172. font-size: 32rpx;
  173. }
  174. .icon_right {
  175. position: absolute;
  176. top: 0;
  177. right: 10rpx;
  178. font-size: 32rpx !important;
  179. }
  180. }
  181. .opinion {
  182. margin: 0 auto;
  183. border-top: 2rpx solid #EAEAEA;
  184. }
  185. </style>