index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. methods:{
  37. // 打开对应的页面
  38. toPage(index){
  39. let pageUrl=['/pages/coupon/index/index','/pages/order/order','/pages/agreement/agreement?fromPage=usercenter']
  40. uni.navigateTo({
  41. url: pageUrl[index]
  42. })
  43. },
  44. // 退出登录
  45. quitSys(){
  46. let _this = this
  47. uni.showModal({
  48. title: '提示',
  49. content: '您确定要退出登录吗?',
  50. success(res) {
  51. if (res.confirm) {
  52. logout({}).then(res => {
  53. getApp().globalData.token = ''
  54. _this.$u.vuex('vuex_token','')
  55. uni.reLaunch({
  56. url: '/pages/index/index'
  57. });
  58. });
  59. }
  60. }
  61. });
  62. },
  63. bindGetUserInfo(res){
  64. console.log(res)
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .user-content{
  71. width: 100%;
  72. .user-head{
  73. display: flex;
  74. align-items: center;
  75. padding: 35rpx;
  76. .user-info{
  77. flex-grow: 1;
  78. padding: 0 20rpx;
  79. }
  80. .user-photo{
  81. width: 100rpx;
  82. height: 100rpx;
  83. border-radius: 50%;
  84. overflow: hidden;
  85. margin-right: 30rpx;
  86. }
  87. }
  88. .user-list{
  89. padding:0 20rpx;
  90. }
  91. .user-btn{
  92. padding: 85rpx 100rpx;
  93. }
  94. }
  95. </style>