三级菜单地区图片
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2026-01-11 11:51:48 +08:00
parent 1032cbabf5
commit 123750e904
523 changed files with 63 additions and 9 deletions

View File

@@ -148,19 +148,22 @@ class ThemeConfigModel
'name' => '香港SAS',
'file_address' => '/cloud.html?region=hk',
'description' => '香港数据中心',
'blank' => false
'blank' => false,
'country_code' => 'HK'
],
[
'name' => '美国SAS',
'file_address' => '/cloud.html?region=us',
'description' => '美国数据中心',
'blank' => false
'blank' => false,
'country_code' => 'US'
],
[
'name' => '日本SAS',
'file_address' => '/cloud.html?region=jp',
'description' => '日本数据中心',
'blank' => false
'blank' => false,
'country_code' => 'JP'
]
]
],
@@ -175,19 +178,22 @@ class ThemeConfigModel
'name' => '宁波ECS',
'file_address' => '/dedicated.html?region=nb',
'description' => '宁波数据中心',
'blank' => false
'blank' => false,
'country_code' => 'CN'
],
[
'name' => '镇江ECS',
'file_address' => '/dedicated.html?region=zj',
'description' => '镇江数据中心',
'blank' => false
'blank' => false,
'country_code' => 'CN'
],
[
'name' => '北京ECS',
'file_address' => '/dedicated.html?region=bj',
'description' => '北京数据中心',
'blank' => false
'blank' => false,
'country_code' => 'CN'
]
]
]

View File

@@ -762,13 +762,27 @@
grandChildren.forEach((grandChild, grandIndex) => {
const item = document.createElement('div');
item.style.cssText = 'padding:8px; margin-bottom:6px; background:#fafafa; border-radius:3px; border-left:2px solid #52c41a;';
// 生成地区选项(只使用方形图标,排除-y后缀的圆形图标
const countryOptions = getCountryOptions();
const selectedCountry = grandChild.country_code || '';
const countrySelectHTML = `
<select class="form-control form-control-sm" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="country_code" style="font-size:12px;">
<option value="">无地区标识</option>
${countryOptions.map(code => `<option value="${code}" ${selectedCountry === code ? 'selected' : ''}>${code}</option>`).join('')}
</select>
`;
item.innerHTML = `
<div style="display:flex; gap:6px; align-items:start;">
<div style="flex:1; display:grid; gap:6px;">
<input type="text" class="form-control form-control-sm" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="name" value="${grandChild.name || ''}" placeholder="三级菜单名称香港SAS" style="font-size:12px;">
<input type="text" class="form-control form-control-sm" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="file_address" value="${grandChild.file_address || ''}" placeholder="链接地址" style="font-size:12px;">
<input type="text" class="form-control form-control-sm" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="description" value="${grandChild.description || ''}" placeholder="描述(可选)" style="font-size:12px;">
<label style="font-size:11px;"><input type="checkbox" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="blank" ${grandChild.blank ? 'checked' : ''}> 新窗口</label>
<div style="display:flex; gap:8px; align-items:center;">
<label style="font-size:11px; margin:0;"><input type="checkbox" data-hnav-grandchild="${navIndex}.${childIndex}.${grandIndex}" data-field="blank" ${grandChild.blank ? 'checked' : ''}> 新窗口</label>
<div style="flex:1;">${countrySelectHTML}</div>
</div>
</div>
<button class="btn-icon btn-icon-danger btn-sm" onclick="removeThirdLevelItem(${navIndex}, ${childIndex}, ${grandIndex})" style="font-size:11px;">×</button>
</div>
@@ -777,6 +791,18 @@
});
}
// 获取国家/地区代码列表(只使用方形图标)
function getCountryOptions() {
// 常用国家/地区代码列表(方形图标)
return [
'CN', 'HK', 'TW', 'MO', // 中国及特别行政区
'US', 'JP', 'KR', 'SG', 'GB', // 常用国家
'DE', 'FR', 'CA', 'AU', 'IN', // 其他常用
'TH', 'MY', 'ID', 'PH', 'VN', // 东南亚
'AE', 'RU', 'BR', 'IT', 'ES', 'NL', 'CH', 'SE' // 其他
];
}
// 切换三级菜单显示
window.toggleThirdLevel = function (navIndex, childIndex) {
const container = document.getElementById(`third-level-${navIndex}-${childIndex}`);
@@ -802,7 +828,8 @@
name: '',
file_address: '',
description: '',
blank: false
blank: false,
country_code: '' // 新增地区代码字段
});
renderHeaderNav(navs);