index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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="gift" index="0" @click="toPage" title="我的优惠卷"></u-cell-item> -->
  16. <u-cell-item icon="order" index="1" @click="toPage" title="我的订单"></u-cell-item>
  17. <u-cell-item icon="file-text" index="2" @click="toPage" title="服务协议"></u-cell-item>
  18. <!-- <u-cell-item icon="info-circle" index="3" @click="toPage" title="关于我们"></u-cell-item> -->
  19. </u-cell-group>
  20. </view>
  21. <!-- 退出 -->
  22. <view class="user-btn">
  23. <u-button type="error" @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. };
  33. },
  34. onShow() {
  35. },
  36. onLoad() {
  37. },
  38. methods:{
  39. // 打开对应的页面
  40. toPage(index){
  41. let pageUrl=['/pages/coupon/index/index','/pages/order/order','/pages/agreement/agreement?fromPage=usercenter']
  42. uni.navigateTo({
  43. url: pageUrl[index]
  44. })
  45. },
  46. // 退出登录
  47. quitSys(){
  48. let _this = this
  49. uni.showModal({
  50. title: '提示',
  51. content: '您确定要退出登录吗?',
  52. success(res) {
  53. if (res.confirm) {
  54. logout({}).then(res => {
  55. getApp().globalData.token = ''
  56. _this.$u.vuex('vuex_token','')
  57. uni.reLaunch({
  58. url: '/pages/index/index'
  59. });
  60. });
  61. }
  62. }
  63. });
  64. },
  65. bindGetUserInfo(res){
  66. console.log(res)
  67. },
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .user-content{
  73. width: 100%;
  74. .user-head{
  75. display: flex;
  76. align-items: center;
  77. padding: 35rpx;
  78. .user-info{
  79. flex-grow: 1;
  80. padding: 0 20rpx;
  81. }
  82. .user-photo{
  83. width: 100rpx;
  84. height: 100rpx;
  85. border-radius: 50%;
  86. overflow: hidden;
  87. margin-right: 30rpx;
  88. }
  89. }
  90. .user-list{
  91. padding:0 20rpx;
  92. }
  93. .user-btn{
  94. padding: 85rpx 100rpx;
  95. }
  96. }
  97. </style>