system.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <!-- 系统设置 -->
  3. <view>
  4. <u-navbar title="系统设置" autoBack placeholder></u-navbar>
  5. <view class="card_system">
  6. <view class="space_between card_mine_option" @click="logOut">
  7. <view class="option_title">退出登录</view>
  8. <u-icon name="arrow-right" size="20"></u-icon>
  9. </view>
  10. <u-modal :show="logoutShow" showCancelButton :title="title" :content='content' @cancel="cancel"
  11. @confirm="confirm"></u-modal>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. logoutShow: false,
  20. title: '确定退出?',
  21. content: '退出登录后将无法查看订单,重新登录后即可查看'
  22. }
  23. },
  24. methods: {
  25. // 退出登录
  26. logOut() {
  27. this.logoutShow = true
  28. },
  29. // 确定退出登录
  30. confirm() {
  31. this.$api.post('/api/logout').then(res => {
  32. if (res.code == 200) {
  33. this.$cache.removeToken()
  34. this.$cache.removeCache('userInfo')
  35. this.logoutShow = false
  36. uni.reLaunch({
  37. url: '/pages/login'
  38. })
  39. }
  40. })
  41. },
  42. // 取消
  43. cancel() {
  44. this.logoutShow = false
  45. },
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .card_system {
  51. margin: 30rpx 30rpx 30rpx 30rpx;
  52. }
  53. .card_mine_option {
  54. margin: 40rpx 0rpx;
  55. border-bottom: 2rpx solid #E4E7ED;
  56. padding-bottom: 30rpx;
  57. }
  58. .option_title {
  59. font-size: 32rpx;
  60. font-weight: bold;
  61. }
  62. </style>