methods.js 606 B

123456789101112131415161718192021222324252627282930
  1. import Apis from '@/common/apis/index'
  2. export default {
  3. login() {
  4. try {
  5. uni.showModal({
  6. title: '提示',
  7. content: '确定退出登录吗?',
  8. async success(res) {
  9. if (res.confirm) {
  10. console.log('用户点击确定');
  11. uni.showLoading({
  12. title: '退出中...'
  13. });
  14. const res = await Apis.PostLogout()
  15. uni.hideLoading();
  16. uni.clearStorageSync()
  17. uni.switchTab({
  18. url: '../my/index'
  19. })
  20. } else if (res.cancel) {
  21. console.log('用户点击取消');
  22. }
  23. }
  24. });
  25. } catch (error) {
  26. console.log(error)
  27. }
  28. },
  29. }