index.vue 3.4 KB

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