
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@xtc/common-login
Advanced tools
npm install @xtc/common-login --save
import LoginManager from '@xtc/common-login'
/**
*
*/
import {
//获取用户信息
getUserInfo,
//退出登录
logout,
//切换代理
switchAgent,
//切换系统
switchSystem,
//window.open方式打开统一菜单界面
openAdminPage
} from '@xtc/common-login'
const loginManager = new LoginManager({
loginRequire: true,
onReady: onReady
});
//lm === loginManager;router为路由对象
function onReady(lm, router, errorInfo) {
if(lm.state) {
console.log("状态正常")
} else {
console.log("状态异常")
}
//获取用户ID
lm.getUserId()
//获取品牌
lm.getBrand()
//获取代理Id
lm.getAgentId()
//获取代理名称
lm.getAgentName()
//获取token
lm.getToken()
//获取全部参数
lm.getParams()
//获取菜单数组
const menuList = router.getMenuList()
//获取具有层级已排序的菜单列表
const routeList = router.getRouteList()
/*层级菜单结构
routeList: [
{
menuUrl: 菜单地址
name: 标题
expand: 扩展信息
children: 子级菜单数组
}
]
*/
//获取用户信息,用户角色信息
const {userInfo, userRoleInfo} = getUserInfo()
/*用户信息结构、用户角色结构
userInfo: { object
brand: 品牌
mobile: 手机号
remark: 备注
userId: 用户Id,
userName: 用户名
}
userRoleInfo: [ array
{
agentId: 代理Id,
code: 角色代号,
name: 角色别名,
roleId: 角色Id,
system: 所属系统
}
]
*/
/*
如果你把lm挂到Vue的原型对象上,那么你可以在创建的Vue组件中以
如下方式调用。
Vue.prototype.$login = lm
//若this指向vue实例
//跳转到选择系统页
this.$login.switchSystem()
//退出登录
this.$login.logout()
//跳转至登录权限管理
this.$login.toAdmin()
//跳转至选择代理页
this.$login.switchAgent()
*/
}
FAQs
公共登录js
The npm package @xtc/common-login receives a total of 11 weekly downloads. As such, @xtc/common-login popularity was classified as not popular.
We found that @xtc/common-login demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.