setting.vue 894 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view>
  3. <u-navbar title="设置" @rightClick="rightClick" :autoBack="true"></u-navbar>
  4. <view style="margin-top: 180rpx;">
  5. <u-button type="primary" @click="quitLogin">退出登录</u-button>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import * as API_item from '@/api/login.js';
  11. export default {
  12. data() {
  13. return {
  14. }
  15. },
  16. methods: {
  17. quitLogin(){
  18. API_item.logout({}).then(res=>{
  19. if(res.code == 101){
  20. uni.showToast({ // 提示错误信息
  21. title: '退出成功',
  22. icon:'success',
  23. duration: 3000
  24. })
  25. uni.removeStorageSync('token')
  26. uni.removeStorageSync('userInfo')
  27. uni.navigateTo({
  28. url: "/pages/login/login",
  29. });
  30. }
  31. })
  32. }
  33. }
  34. }
  35. </script>
  36. <style>
  37. </style>