index.vue 4.5 KB

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