userInfo.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="userInfo-container">
  3. <u-cell-group>
  4. <u-cell-item title="头像" :arrow="false" center>
  5. <u-avatar src="" :size="70" slot="right-icon"></u-avatar>
  6. </u-cell-item>
  7. <u-cell-item title="手机号码" value="15709284545" :arrow="false"></u-cell-item>
  8. <u-cell-item title="收货地址" index="0" @click="toPage"></u-cell-item>
  9. <u-cell-item title="支付密码" index="1" @click="toPage"></u-cell-item>
  10. </u-cell-group>
  11. <!-- 退出 -->
  12. <view class="user-btn">
  13. <u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import {logout} from '@/api/login.js'
  19. export default {
  20. data() {
  21. return {
  22. quitButton: {
  23. borderRadius:'100rpx',
  24. fontSize:'30rpx',
  25. background: '#01c9b2'
  26. }
  27. }
  28. },
  29. onShow() {
  30. },
  31. onLoad() {
  32. },
  33. methods:{
  34. // 打开对应的页面
  35. toPage(index){
  36. let pageUrl=[
  37. '/pages/toOrder/editAddress',
  38. '/pages/userCenter/userInfo/changePayPwd'
  39. // '/pages/userCenter/userInfo/smsVerification'
  40. ]
  41. uni.navigateTo({ url: pageUrl[index] })
  42. },
  43. // 退出登录
  44. quitSys(){
  45. let _this = this
  46. uni.showModal({
  47. title: '提示',
  48. content: '您确定要退出登录吗?',
  49. success(res) {
  50. if (res.confirm) {
  51. logout({}).then(res => {
  52. getApp().globalData.token = ''
  53. _this.$u.vuex('vuex_token','')
  54. // 关闭socket
  55. _this.$store.commit("$closeWebsocket")
  56. uni.reLaunch({
  57. url: '/pages/index/index'
  58. })
  59. })
  60. }
  61. }
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="less">
  68. .userInfo-container{
  69. width: 100%;
  70. .logout-btn{
  71. width: 60%;
  72. margin-top: 200rpx;
  73. }
  74. .user-btn{
  75. padding: 85rpx 200rpx;
  76. }
  77. }
  78. </style>