|
|
@@ -32,20 +32,20 @@
|
|
|
<div class="panel-header" style="padding: 12px 20px; background: #f8f9fa; border-bottom: 1px solid #dee2e6;">
|
|
|
<h3 style="margin: 0; font-size: 18px;">基本信息</h3>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div class="panel-body" style="padding: 20px;">
|
|
|
<form method="POST" action="{{ route('admin.dynamicmenu.store') }}">
|
|
|
@csrf
|
|
|
-
|
|
|
+
|
|
|
{{-- 名称 --}}
|
|
|
<div class="form-group" style="margin-bottom: 20px;">
|
|
|
<label class="required" style="display: block; margin-bottom: 5px; font-weight: 500;">
|
|
|
名称 <span style="color: red;">*</span>
|
|
|
</label>
|
|
|
- <input type="text"
|
|
|
- name="name"
|
|
|
- class="control"
|
|
|
- value="{{ old('name') }}"
|
|
|
+ <input type="text"
|
|
|
+ name="name"
|
|
|
+ class="control"
|
|
|
+ value="{{ old('name') }}"
|
|
|
required
|
|
|
placeholder="例如:仪表盘"
|
|
|
style="width: 100%; padding: 8px 12px; border: 1px solid #dee2e6; border-radius: 4px; font-size: 14px;">
|
|
|
@@ -56,15 +56,15 @@
|
|
|
<label class="required" style="display: block; margin-bottom: 5px; font-weight: 500;">
|
|
|
Key <span style="color: red;">*</span>
|
|
|
</label>
|
|
|
- <input type="text"
|
|
|
- name="key"
|
|
|
- class="control"
|
|
|
- value="{{ old('key') }}"
|
|
|
+ <input type="text"
|
|
|
+ name="key"
|
|
|
+ class="control"
|
|
|
+ value="{{ old('key') }}"
|
|
|
required
|
|
|
placeholder="例如:settings.dynamic-menu"
|
|
|
style="width: 100%; padding: 8px 12px; border: 1px solid #dee2e6; border-radius: 4px; font-size: 14px;">
|
|
|
<small class="control-info" style="display: block; margin-top: 5px; font-size: 12px; color: #6c757d;">
|
|
|
- <strong style="color: #dc3545;">重要提示:</strong>
|
|
|
+ <strong style="color: #dc3545;">重要提示:</strong>
|
|
|
如果想让菜单显示在 Settings 下,Key 必须以 <strong style="background: #f0f0f0; padding: 2px 5px; border-radius: 3px;">settings.</strong> 开头<br>
|
|
|
例如:<code>settings.dynamic-menu</code>、<code>settings.my-menu</code>、<code>settings.custom</code>
|
|
|
</small>
|
|
|
@@ -73,9 +73,9 @@
|
|
|
{{-- URL/路由 --}}
|
|
|
<div class="form-group" style="margin-bottom: 20px;">
|
|
|
<label style="display: block; margin-bottom: 5px; font-weight: 500;">URL/路由</label>
|
|
|
- <input type="text"
|
|
|
- name="route"
|
|
|
- class="control"
|
|
|
+ <input type="text"
|
|
|
+ name="route"
|
|
|
+ class="control"
|
|
|
value="{{ old('route') }}"
|
|
|
placeholder="例如:admin.dashboard"
|
|
|
style="width: 100%; padding: 8px 12px; border: 1px solid #dee2e6; border-radius: 4px; font-size: 14px;">
|
|
|
@@ -87,9 +87,9 @@
|
|
|
{{-- 图标 --}}
|
|
|
<div class="form-group" style="margin-bottom: 20px;">
|
|
|
<label style="display: block; margin-bottom: 5px; font-weight: 500;">图标</label>
|
|
|
- <input type="text"
|
|
|
- name="icon"
|
|
|
- class="control"
|
|
|
+ <input type="text"
|
|
|
+ name="icon"
|
|
|
+ class="control"
|
|
|
value="{{ old('icon', 'fas fa-file') }}"
|
|
|
placeholder="例如:fas fa-dashboard、fas fa-users等"
|
|
|
style="width: 100%; padding: 8px 12px; border: 1px solid #dee2e6; border-radius: 4px; font-size: 14px;">
|
|
|
@@ -117,9 +117,9 @@
|
|
|
{{-- 排序 --}}
|
|
|
<div class="form-group" style="margin-bottom: 20px;">
|
|
|
<label style="display: block; margin-bottom: 5px; font-weight: 500;">排序</label>
|
|
|
- <input type="number"
|
|
|
- name="sort_order"
|
|
|
- class="control"
|
|
|
+ <input type="number"
|
|
|
+ name="sort_order"
|
|
|
+ class="control"
|
|
|
value="{{ old('sort_order', 0) }}"
|
|
|
min="0"
|
|
|
style="width: 100%; padding: 8px 12px; border: 1px solid #dee2e6; border-radius: 4px; font-size: 14px;">
|
|
|
@@ -161,12 +161,12 @@
|
|
|
@push('scripts')
|
|
|
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
<script>
|
|
|
- $(document).ready(function() {
|
|
|
+ /* $(document).ready(function() {
|
|
|
// 自动生成key
|
|
|
$('input[name="name"]').on('blur', function() {
|
|
|
var name = $(this).val();
|
|
|
var keyInput = $('input[name="key"]');
|
|
|
-
|
|
|
+
|
|
|
if (keyInput.val() === '') {
|
|
|
// 将名称转换为小写,空格替换为横线,移除特殊字符
|
|
|
var key = name.toLowerCase()
|
|
|
@@ -174,13 +174,13 @@
|
|
|
.replace(/[^a-z0-9-]/g, '');
|
|
|
// 默认添加到 settings 下
|
|
|
keyInput.val('settings.' + key);
|
|
|
-
|
|
|
+
|
|
|
// 添加一个视觉提示
|
|
|
keyInput.css('border-color', '#28a745');
|
|
|
setTimeout(function() {
|
|
|
keyInput.css('border-color', '');
|
|
|
}, 1000);
|
|
|
-
|
|
|
+
|
|
|
// 显示成功提示
|
|
|
var successMsg = $('<small class="key-success" style="display: block; margin-top: 5px; font-size: 12px; color: #28a745;">' +
|
|
|
'✓ 已自动生成Key: settings.' + key + '</small>');
|
|
|
@@ -190,10 +190,10 @@
|
|
|
}, 3000);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 为所有表单元素添加Bagisto样式类
|
|
|
$('.control').addClass('form-control');
|
|
|
-
|
|
|
+
|
|
|
// 检查key格式
|
|
|
$('form').on('submit', function(e) {
|
|
|
var keyValue = $('input[name="key"]').val();
|
|
|
@@ -203,7 +203,7 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 添加提示
|
|
|
$('input[name="key"]').on('focus', function() {
|
|
|
var currentVal = $(this).val();
|
|
|
@@ -212,13 +212,13 @@
|
|
|
'<small class="key-warning" style="display: block; margin-top: 5px; font-size: 12px; color: #dc3545;">' +
|
|
|
'⚠️ 警告:当前Key不以"settings."开头,菜单可能不会显示在Settings下</small>'
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
setTimeout(function() {
|
|
|
$('.key-warning').remove();
|
|
|
}, 3000);
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ });*/
|
|
|
</script>
|
|
|
@endpush
|
|
|
-</x-admin::layouts>
|
|
|
+</x-admin::layouts>
|