setting.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="user-setting">
  3. <nav-bar title="设置" @init="onInitNavbar"></nav-bar>
  4. <van-cell-group>
  5. <van-cell title="个人信息" is-link @click="navigateTo('/pages/user/info')">
  6. </van-cell>
  7. <van-cell class="user-logout" title="退出登录" is-link @click="onLogout">
  8. </van-cell>
  9. </van-cell-group>
  10. </view>
  11. </template>
  12. <script>
  13. import NavBar from '@/components/layout/nav-bar'
  14. import UScrollView from '@/components/common/u-scroll-view'
  15. import VanCellGroup from '@/wxcomponents/vant/cell-group/index'
  16. import VanCell from '@/wxcomponents/vant/cell/index'
  17. export default {
  18. options: {
  19. styleIsolation: 'shared'
  20. },
  21. components: {
  22. NavBar,
  23. UScrollView,
  24. VanCellGroup,
  25. VanCell
  26. },
  27. computed: {
  28. },
  29. data() {
  30. return {}
  31. },
  32. created() {
  33. this.checkAuth('/pages/user/setting')
  34. },
  35. onShow() {},
  36. methods: {
  37. onLogout() {
  38. // this.$store.dispatch('logout').then(() => {
  39. // uni.navigateTo({
  40. // url: '/pages/user/login'
  41. // })
  42. // })
  43. this.$store.dispatch('logout').then(() => {
  44. this.redirectTo('/pages/user/login')
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .user-setting{
  52. .user-logout{
  53. .van-cell__title{
  54. @include display-flex-center;
  55. }
  56. .van-icon{
  57. display: none;
  58. }
  59. }
  60. }
  61. </style>