index.vue 4.2 KB

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