<template>
    <div class="settings">
      <van-nav-bar
        title="设置"
        left-arrow
        @click-left="onClickLeft"
      />
      <van-cell-group class="settings-cell">
        <van-cell title="建议和意见" is-link />
        <van-cell title="关于我们" is-link />
      </van-cell-group>
      <div class="settings-logout">
        <van-button round block @click="_logout">退出登录</van-button>
      </div>
    </div>
</template>

<script>
export default {
  name: 'settings',
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    _logout () {
      this.$http.user.logout().then(({ code, msg }) => {
        if (code === 200) {
          this.$toast.success(msg)
          this.$store.commit('setToken', null)
          this.$router.push('/login')
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.settings {
  &-cell {
    margin-top: 20px;
  }
  &-logout {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
  }
}
</style>
