Files
sist_web/src/utils/sist.js
clay 6b2d1034c2 11
2022-01-22 20:45:07 +08:00

69 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @author: Clay
* @date: 2022/1/16 11:13
* @descriptionsist
* @email: clay@hchyun.com
*/
export function getParentNode(id) {
try {
let menuList = JSON.parse(sessionStorage.getItem("menu"));
for (let menu of menuList) {
for (let child of menu.children) {
if (id == child.encodeId) {
menu.children = []
child.children = []
return {
stair: menu,
second: child,
}
}
for (let item of child.children) {
if (id == item.encodeId) {
menu.children = []
child.children = []
item.children = []
return {
stair: menu,
second: child,
three: item
}
}
}
}
}
return null
} catch (e) {
return null
}
}
export function setAppLanguage(that){
let lang = sessionStorage.getItem("lang");
if (lang != null){
that.$i18n.locale = lang
return
}
var language = window.navigator.userLanguage || window.navigator.language;
if (language == 'zh-CN'){
lang = 'cn'
}else {
lang = 'en'
}
that.$i18n.locale = lang
sessionStorage.setItem("lang",lang)
}
export function setLanguage(that){
let lang = that.$route.query && that.$route.query.lang
if (lang != undefined){
that.$i18n.locale = lang
sessionStorage.setItem("lang",lang)
}
}