lyh
6 天以前 73e6916dfb4956e733be0542bb3f8bf87fd89925
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
  <div class="container">
    <div class="row">
      <el-row>
        <div class="loginBox">
          <div class="note-release-success" style="text-align: center">
            <p class="ico">
              <img src="/static/images/page-success.png" alt style="width:15%;height:auto"/>
            </p>
            <p class="title" >{{message}}</p>
            <!--<p class="info"></p>-->
            <p class="button">
              <router-link :to="{path: '/login'}">
                重新登陆
                <span id="num">{{count}}秒后自动跳转</span>
              </router-link>
            </p>
          </div>
        </div>
      </el-row>
    </div>
  </div>
</template>
<script>
import PHead from "@/base/components/head.vue";
import PFoot from "@/base/components/foot.vue";
import utilApi from "../../../common/utils";
import * as loginApi from "../api/login";
export default {
  components: {
    PHead,
    PFoot
  },
  data() {
    return {
      logoutsuccess: false,
      message:'',
      timer:null,
      count: "" //倒计时
    };
  },
  methods: {
    
    //几秒后进入跳转页面
    goGrdoupRecor() {
      const TIME_COUNT = 3;
      if (!this.timer) {
        this.count = TIME_COUNT;
        this.show = false;
        this.timer = setInterval(() => {
          if (this.count > 0 && this.count <= TIME_COUNT) {
            this.count--;
          } else {
            this.show = true;
            clearInterval(this.timer);
            this.timer = null;
            //跳转的页面写在此处
          
            this.$router.push({ path: "/login" });
          }
        }, 1000);
      }
    },
  },
  created() {
    loginApi.user_logout({}).then(
      res => {
        if (res.success) {
          this.message='退出成功'
          sessionStorage.removeItem("activeUser");
          this.logoutsuccess = true;
          this.goGrdoupRecor();
        } else {
          this.logoutsuccess = false;
        }
      },
      res => {
         this.message='退出失败,请重新尝试!'
        this.logoutsuccess = false;
      }
    )
  },
  beforeDestroy(){
      clearInterval(this.timer);
      this.timer = null;
  },
  mounted() {}
};
</script>
<style scoped>
.container {
  position: absolute;
  display: table;
  height: 100%;
  width: 100%;
  text-align: center;
  margin: auto;
  background: url("/static/images/background.png") no-repeat;
  background-size: 100% 100%;
}
.row {
  display: table-cell;
  vertical-align: middle;
}
  .loginBox{
    width: 20%;
    height: 20%;
    margin: auto;
    padding: 4% 5%;
    border-radius: 20px;
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    background-color: rgba(250,250,250,0.2);
  }
.login-form {
  width: 40%;
  margin: 5% auto 0;
}
</style>