index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="user-content">
  3. <!-- 头部 -->
  4. <view class="user-head" @click="toUserPage">
  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. toUserPage(){
  67. // 未登录跳转登录,已登录跳转用户信息页
  68. uni.navigateTo({
  69. url: '/pages/userCenter/userInfo/userInfo'
  70. })
  71. },
  72. // 退出登录
  73. quitSys(){
  74. let _this = this
  75. uni.showModal({
  76. title: '提示',
  77. content: '您确定要退出登录吗?',
  78. success(res) {
  79. if (res.confirm) {
  80. logout({}).then(res => {
  81. getApp().globalData.token = ''
  82. _this.$u.vuex('vuex_token','')
  83. // 关闭socket
  84. _this.$store.commit("$closeWebsocket")
  85. uni.reLaunch({
  86. url: '/pages/index/index'
  87. });
  88. });
  89. }
  90. }
  91. });
  92. },
  93. bindGetUserInfo(res){
  94. console.log(res)
  95. },
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .user-content{
  101. width: 100%;
  102. .user-head{
  103. background: #01c9b2;
  104. display: flex;
  105. align-items: center;
  106. padding: 35rpx;
  107. .user-info{
  108. flex-grow: 1;
  109. padding: 0 20rpx;
  110. color: #FFFFFF;
  111. }
  112. .user-photo{
  113. width: 100rpx;
  114. height: 100rpx;
  115. border-radius: 50%;
  116. overflow: hidden;
  117. margin-right: 5rpx;
  118. }
  119. }
  120. .my-ledou{
  121. background: #FFFFFF;
  122. border-radius: 15upx;
  123. display: flex;
  124. align-items: center;
  125. justify-content: space-between;
  126. padding: 20upx;
  127. margin: 20upx;
  128. box-shadow: 0upx 3upx 6upx #eee;
  129. .user-jifen{
  130. display: flex;
  131. align-items: center;
  132. text{
  133. font-size: 40upx;
  134. font-weight: bold;
  135. }
  136. >view{
  137. &:first-child{
  138. display: flex;
  139. align-items: center;
  140. }
  141. }
  142. }
  143. }
  144. .user-list{
  145. border-radius: 15upx;
  146. margin: 20upx;
  147. overflow: hidden;
  148. box-shadow: 0upx 3upx 6upx #eee;
  149. }
  150. .user-btn{
  151. padding: 85rpx 200rpx;
  152. }
  153. }
  154. </style>