index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="user-content">
  3. <!-- 头部 -->
  4. <view class="user-head">
  5. <view class="user-photo">
  6. <u-avatar :src="userAvatarUrl" size="large" class="avatar"></u-avatar>
  7. </view>
  8. <view class="user-info">
  9. <text class="user-name">用户名</text>
  10. <text class="user-phone">15785829632</text>
  11. </view>
  12. </view>
  13. <!-- 列表 -->
  14. <view class="user-list">
  15. <u-cell-group>
  16. <u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="0" @click="toPage" title="服务协议及隐私政策"></u-cell-item>
  17. <!-- <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage" title="关于我们"></u-cell-item> -->
  18. <u-cell-item icon="lock" icon-size="38" :icon-style="{color:'#00aaff'}" index="2" @click="toPage" title="修改密码"></u-cell-item>
  19. </u-cell-group>
  20. </view>
  21. <!-- 退出 -->
  22. <view class="user-btn">
  23. <u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import { getUserInfo, logout } from '@/api/user.js'
  29. export default {
  30. data() {
  31. return {
  32. quitButton: {
  33. borderRadius:'100rpx',
  34. fontSize:'30rpx',
  35. background: '#ed1c24'
  36. },
  37. userInfoData: null, // 用户信息
  38. userAvatarUrl: '' // 用户头像
  39. };
  40. },
  41. onShow() {
  42. this.getUserInfo()
  43. },
  44. onLoad() {
  45. },
  46. methods:{
  47. // 获取用户信息
  48. getUserInfo(){
  49. // getUserInfo().then(res => {
  50. // if(res.status == 200){
  51. // this.userInfoData = res.data
  52. // }else{
  53. // this.userInfoData = null
  54. // }
  55. // })
  56. },
  57. // 打开对应的页面
  58. toPage(index){
  59. let pageUrl=[
  60. '/pages/agreement/agreement?fromPage=usercenter',
  61. '/pages/userCenter/changePwd'
  62. ]
  63. uni.navigateTo({
  64. url: pageUrl[index]
  65. })
  66. },
  67. // 跳转
  68. toUserPage(){
  69. // 未登录跳转登录,已登录跳转用户信息页
  70. uni.navigateTo({
  71. url: '/pages/userCenter/userInfo/userInfo'
  72. })
  73. },
  74. // 乐豆明细
  75. toLdPage(){
  76. uni.navigateTo({
  77. url: '/pages/userCenter/ldDetailed'
  78. })
  79. },
  80. // 退出登录
  81. quitSys(){
  82. let _this = this
  83. uni.showModal({
  84. title: '提示',
  85. content: '您确定要退出登录吗?',
  86. success(res) {
  87. if (res.confirm) {
  88. // logout({}).then(res => {
  89. // getApp().globalData.token = ''
  90. // _this.$u.vuex('vuex_token','')
  91. // // 关闭socket
  92. // // _this.$store.commit("$closeWebsocket")
  93. // uni.reLaunch({
  94. // url: '/pages/login/pwLogin'
  95. // })
  96. // })
  97. }
  98. }
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .user-content{
  106. width: 100%;
  107. .user-head{
  108. background: #ed1c24;
  109. display: flex;
  110. align-items: center;
  111. padding: 35rpx 55rpx;
  112. .user-photo{
  113. flex-shrink: 0;
  114. margin-right: 5rpx;
  115. // width: 130rpx;
  116. // height: 130rpx;
  117. // border-radius: 50%;
  118. // overflow: hidden;
  119. }
  120. .user-info{
  121. flex-grow: 1;
  122. padding: 0 20rpx;
  123. color: #FFFFFF;
  124. .user-name{
  125. display: block;
  126. font-size: 30rpx;
  127. margin-bottom: 20rpx;
  128. }
  129. .user-phone{
  130. display: block;
  131. font-size: 26rpx;
  132. }
  133. }
  134. }
  135. .user-list{
  136. border-radius: 15upx;
  137. margin: 20upx;
  138. overflow: hidden;
  139. box-shadow: 0upx 3upx 6upx #eee;
  140. }
  141. .user-btn{
  142. padding: 85rpx 200rpx;
  143. }
  144. }
  145. </style>