修复bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php /*a:2:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\resources\edit.php";i:1747747200;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<?php /*a:2:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\resources\edit.php";i:1747755572;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -207,6 +207,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">解压密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="zipcode" required placeholder="请输入解压密码" autocomplete="off"
|
||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['zipcode']) && ($resource['zipcode'] !== '')?$resource['zipcode']:'')); ?>" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php /*a:2:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\resources\add.php";i:1747744873;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<?php /*a:2:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\resources\add.php";i:1747755547;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -206,6 +206,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">解压密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="zipcode" required placeholder="请输入解压密码" autocomplete="off"
|
||||
class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
@@ -349,27 +357,58 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 查找选中的分类信息
|
||||
var parentCategory = null;
|
||||
var childCategory = null;
|
||||
|
||||
window.categoryData.forEach(function(parent) {
|
||||
if (parent.children) {
|
||||
parent.children.forEach(function(child) {
|
||||
if (child.id == selectedId) {
|
||||
parentCategory = parent;
|
||||
childCategory = child;
|
||||
// 递归查找分类信息的函数
|
||||
function findCategory(categories, targetId) {
|
||||
for (let category of categories) {
|
||||
// 检查当前分类
|
||||
if (category.id == targetId) {
|
||||
return {
|
||||
parent: null,
|
||||
current: category,
|
||||
total: category.total || 0
|
||||
};
|
||||
}
|
||||
// 检查子分类
|
||||
if (category.children && category.children.length > 0) {
|
||||
for (let child of category.children) {
|
||||
if (child.id == targetId) {
|
||||
return {
|
||||
parent: category,
|
||||
current: child,
|
||||
total: child.total || 0
|
||||
};
|
||||
}
|
||||
// 递归检查更深层级的子分类
|
||||
if (child.children && child.children.length > 0) {
|
||||
const result = findCategory([child], targetId);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parentCategory && childCategory) {
|
||||
// 查找选中的分类信息
|
||||
const categoryInfo = findCategory(window.categoryData, selectedId);
|
||||
|
||||
if (categoryInfo) {
|
||||
// 生成资源编号
|
||||
var total = childCategory.total || 0;
|
||||
var nextNumber = total + 1;
|
||||
var nextNumber = categoryInfo.total + 1;
|
||||
var numberStr = nextNumber.toString().padStart(5, '0');
|
||||
var resourceNumber = parentCategory.number + childCategory.number + numberStr;
|
||||
var resourceNumber = '';
|
||||
|
||||
// 构建编号前缀
|
||||
if (categoryInfo.parent) {
|
||||
resourceNumber = categoryInfo.parent.number + categoryInfo.current.number;
|
||||
} else {
|
||||
resourceNumber = categoryInfo.current.number;
|
||||
}
|
||||
|
||||
// 添加序号
|
||||
resourceNumber += numberStr;
|
||||
|
||||
// 设置资源编号
|
||||
$('input[name="number"]').val(resourceNumber);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php /*a:2:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\resources\lists.php";i:1747747324;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<?php /*a:2:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\resources\lists.php";i:1747755163;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
Reference in New Issue
Block a user