index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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>
  12. <!-- 列表 -->
  13. <view class="user-list">
  14. <u-cell-group>
  15. <u-cell-item icon="order" icon-size="38" :icon-style="{color:'#ff0000'}" index="1" @click="toPage" title="我的订单"></u-cell-item>
  16. <u-cell-item icon="gift" icon-size="40" :icon-style="{color:'#00aaff'}" index="0" @click="toPage" title="投递记录"></u-cell-item>
  17. <u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="2" @click="toPage" title="服务协议"></u-cell-item>
  18. <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#00aa00'}" index="3" @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 {logout} from '@/api/login.js'
  29. export default {
  30. data() {
  31. return {
  32. quitButton: {
  33. borderRadius:'100rpx',
  34. fontSize:'30rpx',
  35. background: '#01c9b2'
  36. }
  37. };
  38. },
  39. onShow() {
  40. },
  41. onLoad() {
  42. },
  43. methods:{
  44. // 打开对应的页面
  45. toPage(index){
  46. let pageUrl=[
  47. '/pages/coupon/index/index',
  48. '/pages/order/order',
  49. '/pages/agreement/agreement?fromPage=usercenter',
  50. '/pages/userCenter/aboutUs'
  51. ]
  52. uni.navigateTo({
  53. url: pageUrl[index]
  54. })
  55. },
  56. // 退出登录
  57. quitSys(){
  58. let _this = this
  59. uni.showModal({
  60. title: '提示',
  61. content: '您确定要退出登录吗?',
  62. success(res) {
  63. if (res.confirm) {
  64. logout({}).then(res => {
  65. getApp().globalData.token = ''
  66. _this.$u.vuex('vuex_token','')
  67. // 关闭socket
  68. _this.$store.commit("$closeWebsocket")
  69. uni.reLaunch({
  70. url: '/pages/index/index'
  71. });
  72. });
  73. }
  74. }
  75. });
  76. },
  77. bindGetUserInfo(res){
  78. console.log(res)
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .user-content{
  85. width: 100%;
  86. .user-head{
  87. background: #01c9b2;
  88. display: flex;
  89. align-items: center;
  90. padding: 35rpx;
  91. .user-info{
  92. flex-grow: 1;
  93. padding: 0 20rpx;
  94. }
  95. .user-photo{
  96. width: 100rpx;
  97. height: 100rpx;
  98. border-radius: 50%;
  99. overflow: hidden;
  100. margin-right: 30rpx;
  101. }
  102. }
  103. .user-list{
  104. padding:20rpx 0;
  105. }
  106. .user-btn{
  107. padding: 85rpx 200rpx;
  108. }
  109. }
  110. </style>