zhangzengfei
2020-07-23 ecdff0d7764b810640fad072f3a9fb69d78dc7db
桌面添加token过期的跳转到登陆页的处理.应用通过postMessage通知桌面
2个文件已修改
12 ■■■■■ 已修改文件
src/pages/desktop/index/components/DFrame.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/scripts/httpRequest.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/desktop/index/components/DFrame.vue
@@ -39,6 +39,13 @@
      height: this.data.height || 512
    }
  },
  mounted() {
    window.addEventListener('message', e => {
      if (e.data && e.data.msg == "logout") {
        location.assign("/");
      }
    })
  },
  methods: {
    closeFrame: function () {
      this.$store.dispatch('desktop/closeFrame', this.data);
src/scripts/httpRequest.ts
@@ -55,7 +55,6 @@
  res => {
    /* //对响应数据做些事 */
    if (res.data && res.statusText !== 'OK' && res.status !== 200) {
      console.log('听说你对相应数据做了些事', res)
      Notification({
        title: '',
        message: res.data.message,
@@ -77,6 +76,7 @@
    // } else {
    //   window.sessionStorage.setItem('policeCameravideoIsLoginTimeout', JSON.stringify(true))
    // }
    return res.data ? res.data : {}
    /* //return res.data ? res.data : {}; */
@@ -95,6 +95,9 @@
        case 401:
          errJson.status = error.response.status
          errJson.message = '未授权,请重新登录(401)'
          window.parent.postMessage({
            msg: "logout"
          }, '*')
          // console.log("标志位:",AuthData.isLoginout)
          // if (!AuthData.isLoginout) {
          //   Notification({