0.1.4 • Published 4 years ago

vue-vincce-outlogin v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

vue vincce outlogin

Install

$ npm i vue-vincce-outlogin --save

Usage

// 注册
import OutLogin from "vue-vincce-outlogin";
Vue.use(OutLogin, {
  window: window,
  sysList: [],
  urlSuffix: "user/outlogin"
});

// 登录其他系统
this.$ologin.renderIframe({
  username: '用户名',
  password: '密码',
  sysList: 'sysList节点数据',
  currentSysId: '当前系统id'
});

// 被其他系统登录
// 新建OutLogin.vue  config路径配置成/user/outlogin 与login路径平级
// whiteList白名单加入以上路径名 (outlogin)
// OutLogin.vue添加以下代码
addListener() {
  let self = this;
  parent.postMessage({ msg: "startOutLogin", currentSysId: '填入当前系统id' }, "*");
  window.onmessage = function(e) {
    if (e.data.msg === "doOutlogin") {
      // 执行当前系统的登录逻辑
      self
        .Login({
          userName: e.data.username,
          password: e.data.password
        })
        .then(() => {
          // console.log(res);
        })
        .catch(() => {
          // console.log(err);
        })
        .finally(() => {});
    }
  };
}
0.1.4

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago