index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="user-content">
  3. <!-- 头部 -->
  4. <view class="user-head">
  5. <view class="user-photo">
  6. <open-data type="userAvatarUrl"></open-data>
  7. </view>
  8. <view class="user-info">
  9. <open-data type="userNickName"></open-data>
  10. </view>
  11. <view class="user-jifen">
  12. <view>乐豆:<text>345</text></view>
  13. <u-image mode="scaleToFill" width="35rpx" height="35rpx" src="/static/ledou.png"></u-image>
  14. </view>
  15. </view>
  16. <!-- 列表 -->
  17. <view class="user-list">
  18. <u-cell-group>
  19. <u-cell-item icon="order" icon-size="38" :icon-style="{color:'#ff5500'}" index="1" @click="toPage" title="我的订单"></u-cell-item>
  20. <u-cell-item icon="gift" icon-size="40" :icon-style="{color:'#00aaff'}" index="0" @click="toPage" title="投递记录"></u-cell-item>
  21. <u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="2" @click="toPage" title="服务协议"></u-cell-item>
  22. <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="3" @click="toPage" title="关于我们"></u-cell-item>
  23. </u-cell-group>
  24. </view>
  25. <!-- 退出 -->
  26. <view class="user-btn">
  27. <u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {logout} from '@/api/login.js'
  33. export default {
  34. data() {
  35. return {
  36. quitButton: {
  37. borderRadius:'100rpx',
  38. fontSize:'30rpx',
  39. background: '#01c9b2'
  40. }
  41. };
  42. },
  43. onShow() {
  44. },
  45. onLoad() {
  46. },
  47. methods:{
  48. // 打开对应的页面
  49. toPage(index){
  50. let pageUrl=[
  51. '/pages/coupon/index/index',
  52. '/pages/order/order',
  53. '/pages/agreement/agreement?fromPage=usercenter',
  54. '/pages/userCenter/aboutUs'
  55. ]
  56. uni.navigateTo({
  57. url: pageUrl[index]
  58. })
  59. },
  60. // 退出登录
  61. quitSys(){
  62. let _this = this
  63. uni.showModal({
  64. title: '提示',
  65. content: '您确定要退出登录吗?',
  66. success(res) {
  67. if (res.confirm) {
  68. logout({}).then(res => {
  69. getApp().globalData.token = ''
  70. _this.$u.vuex('vuex_token','')
  71. // 关闭socket
  72. _this.$store.commit("$closeWebsocket")
  73. uni.reLaunch({
  74. url: '/pages/index/index'
  75. });
  76. });
  77. }
  78. }
  79. });
  80. },
  81. bindGetUserInfo(res){
  82. console.log(res)
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. .user-content{
  89. width: 100%;
  90. .user-head{
  91. background: #01c9b2;
  92. display: flex;
  93. align-items: center;
  94. padding: 35rpx;
  95. .user-info{
  96. flex-grow: 1;
  97. padding: 0 20rpx;
  98. color: #FFFFFF;
  99. }
  100. .user-photo{
  101. width: 100rpx;
  102. height: 100rpx;
  103. border-radius: 50%;
  104. overflow: hidden;
  105. margin-right: 5rpx;
  106. }
  107. .user-jifen{
  108. color: #FFFFFF;
  109. display: flex;
  110. align-items: center;
  111. text{
  112. font-size: 40upx;
  113. font-weight: bold;
  114. }
  115. >view{
  116. &:first-child{
  117. display: flex;
  118. align-items: center;
  119. }
  120. }
  121. }
  122. }
  123. .user-list{
  124. padding:20rpx 0;
  125. }
  126. .user-btn{
  127. padding: 85rpx 200rpx;
  128. }
  129. }
  130. </style>