index.vue 4.4 KB

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