2025-07-24 00:18:40 +08:00
|
|
|
const routeMap = {
|
|
|
|
'dym': 'separate', // 单页面
|
|
|
|
'xp': 'inquiry', // 询盘栏目
|
2025-07-25 00:39:16 +08:00
|
|
|
'wz': 'article-page', // 文章栏目
|
|
|
|
'cp': 'products' // 产品栏目
|
2025-07-24 00:18:40 +08:00
|
|
|
}
|
|
|
|
|
2025-06-28 21:10:52 +08:00
|
|
|
export const state = () => ({
|
2025-06-29 01:26:10 +08:00
|
|
|
locales: ['en', 'zh'],
|
2025-07-12 19:41:58 +08:00
|
|
|
locale: 'en',
|
2025-07-24 00:18:40 +08:00
|
|
|
menuTree: [],
|
2025-07-12 19:41:58 +08:00
|
|
|
footerInfo: {}
|
2025-06-28 21:10:52 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
export const mutations = {
|
2025-06-29 01:26:10 +08:00
|
|
|
SET_LANG (state, locale) {
|
|
|
|
if (state.locales.includes(locale)) {
|
|
|
|
state.locale = locale
|
|
|
|
}
|
2025-07-12 19:41:58 +08:00
|
|
|
},
|
|
|
|
SET_FOOTER_INFO (state, info) {
|
|
|
|
state.footerInfo = info
|
2025-07-24 00:18:40 +08:00
|
|
|
},
|
|
|
|
SET_MENU_TREE (state, tree) {
|
|
|
|
state.menuTree = [
|
|
|
|
{label:'Home', to: '/', children: []}
|
|
|
|
]
|
|
|
|
const fn = (list) => {
|
|
|
|
list.forEach(item => {
|
|
|
|
if (item.catgLevel===1) {
|
2025-07-25 00:39:16 +08:00
|
|
|
item.to = `/${routeMap[item.catgType]}?maxCatgId=${item.id}&title=${item.label}`
|
2025-07-24 00:18:40 +08:00
|
|
|
} else {
|
2025-07-25 00:39:16 +08:00
|
|
|
item.to = `/${routeMap[item.catgType]}?&catgId=${item.id}&maxCatgId=${item.maxParentId}&title=${item.label}`
|
2025-07-24 00:18:40 +08:00
|
|
|
}
|
|
|
|
if (item.children.length) {
|
|
|
|
fn(item.children)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
fn(tree)
|
|
|
|
state.menuTree = [...state.menuTree, ...tree]
|
2025-06-28 21:10:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
|
|
|
|
}
|