优化接口
This commit is contained in:
parent
acf9bc0952
commit
3e9a3731e5
4
.env
4
.env
@ -5,11 +5,11 @@ DEFAULT_TIMEZONE = Asia/Shanghai
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 212.64.112.158
|
||||
HOSTNAME = 192.168.31.10
|
||||
DATABASE = yunzertest
|
||||
USERNAME = yunzertest
|
||||
PASSWORD = zKMDMEs7YP3SLDEF
|
||||
HOSTPORT = 3388
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8
|
||||
DEBUG = true
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
runtime
|
||||
*.log
|
||||
config/database.php
|
||||
.env
|
||||
|
||||
@ -156,9 +156,6 @@ class ResourcesController extends BaseController
|
||||
]);
|
||||
|
||||
return View::fetch();
|
||||
} catch (\Exception $e) {
|
||||
Log::record('添加资源页面加载', 0, $e->getMessage(), '资源管理');
|
||||
$this->error('页面加载失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -308,6 +308,65 @@ class ArticlesController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 获取articleDetail详情
|
||||
public function getArticleDetail()
|
||||
{
|
||||
try {
|
||||
// 获取前端传递的ID
|
||||
$id = input('id/d', 0);
|
||||
|
||||
// 验证ID
|
||||
if ($id <= 0) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => 'ID参数错误'
|
||||
]);
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
$where = [
|
||||
['r.id', '=', $id],
|
||||
['r.delete_time', '=', null],
|
||||
['r.status', '=', 1], // 已审核的资源
|
||||
['r.push', '=', 1], // 已推送的资源
|
||||
];
|
||||
|
||||
// 查询资源详情,联查分类名称
|
||||
$resource = Resources::where($where)
|
||||
->field('r.id,r.title,r.cate,r.icon,r.price,r.code,r.desc,r.number,r.content,r.views,r.downloads,r.create_time,r.update_time,r.url,r.fileurl,c.name as cate_name')
|
||||
->alias('r')
|
||||
->join('resources_category c', 'r.cate = c.id')
|
||||
->find();
|
||||
|
||||
if (!$resource) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '资源不存在或已删除'
|
||||
]);
|
||||
}
|
||||
|
||||
// 转换为数组并处理数据
|
||||
$resource = $resource->toArray();
|
||||
|
||||
// 将cate字段替换为分类名称
|
||||
$resource['cate'] = $resource['cate_name'];
|
||||
unset($resource['cate_name']);
|
||||
|
||||
// 返回数据
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '获取成功',
|
||||
'data' => $resource
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '获取失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//文章中心
|
||||
public function index()
|
||||
{
|
||||
|
||||
@ -516,65 +516,6 @@ class ProgramController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 获取downloadPrograms详情
|
||||
public function getDownloadProgramsDetail()
|
||||
{
|
||||
try {
|
||||
// 获取前端传递的ID
|
||||
$id = input('id/d', 0);
|
||||
|
||||
// 验证ID
|
||||
if ($id <= 0) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => 'ID参数错误'
|
||||
]);
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
$where = [
|
||||
['r.id', '=', $id],
|
||||
['r.delete_time', '=', null],
|
||||
['r.status', '=', 1], // 已审核的资源
|
||||
['r.push', '=', 1], // 已推送的资源
|
||||
];
|
||||
|
||||
// 查询资源详情,联查分类名称
|
||||
$resource = Resources::where($where)
|
||||
->field('r.id,r.title,r.cate,r.icon,r.price,r.code,r.desc,r.number,r.content,r.views,r.downloads,r.create_time,r.update_time,r.url,r.fileurl,c.name as cate_name')
|
||||
->alias('r')
|
||||
->join('resources_category c', 'r.cate = c.id')
|
||||
->find();
|
||||
|
||||
if (!$resource) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '资源不存在或已删除'
|
||||
]);
|
||||
}
|
||||
|
||||
// 转换为数组并处理数据
|
||||
$resource = $resource->toArray();
|
||||
|
||||
// 将cate字段替换为分类名称
|
||||
$resource['cate'] = $resource['cate_name'];
|
||||
unset($resource['cate_name']);
|
||||
|
||||
// 返回数据
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '获取成功',
|
||||
'data' => $resource
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '获取失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取downloadGames分类
|
||||
public function getDownloadGamesCategory()
|
||||
{
|
||||
|
||||
@ -32,6 +32,66 @@ use app\index\model\Articles\Articles;
|
||||
|
||||
class ResourcesController extends BaseController
|
||||
{
|
||||
|
||||
// 获取resourceDetail详情
|
||||
public function getResourceDetail()
|
||||
{
|
||||
try {
|
||||
// 获取前端传递的ID
|
||||
$id = input('id/d', 0);
|
||||
|
||||
// 验证ID
|
||||
if ($id <= 0) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => 'ID参数错误'
|
||||
]);
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
$where = [
|
||||
['r.id', '=', $id],
|
||||
['r.delete_time', '=', null],
|
||||
['r.status', '=', 1], // 已审核的资源
|
||||
['r.push', '=', 1], // 已推送的资源
|
||||
];
|
||||
|
||||
// 查询资源详情,联查分类名称
|
||||
$resource = Resources::where($where)
|
||||
->field('r.id,r.title,r.cate,r.icon,r.price,r.code,r.desc,r.number,r.content,r.views,r.downloads,r.create_time,r.update_time,r.url,r.fileurl,c.name as cate_name')
|
||||
->alias('r')
|
||||
->join('resources_category c', 'r.cate = c.id')
|
||||
->find();
|
||||
|
||||
if (!$resource) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '资源不存在或已删除'
|
||||
]);
|
||||
}
|
||||
|
||||
// 转换为数组并处理数据
|
||||
$resource = $resource->toArray();
|
||||
|
||||
// 将cate字段替换为分类名称
|
||||
$resource['cate'] = $resource['cate_name'];
|
||||
unset($resource['cate_name']);
|
||||
|
||||
// 返回数据
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '获取成功',
|
||||
'data' => $resource
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '获取失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//资源中心
|
||||
public function index()
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:2:{s:58:"E:\Demo\PHP\yunzer\app\admin\view\articles\articlelist.php";i:1747649468;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
||||
<?php /*a:2:{s:58:"E:\Demo\PHP\yunzer\app\admin\view\articles\articlelist.php";i:1766587447;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?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;}*/ ?>
|
||||
<?php /*a:2:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\resources\edit.php";i:1766587447;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -106,11 +106,14 @@
|
||||
</div>
|
||||
<form class="layui-form" action="" method="post">
|
||||
<input type="hidden" name="id" value="<?php echo htmlentities((string) (isset($resource['id']) && ($resource['id'] !== '')?$resource['id']:'')); ?>">
|
||||
<div class="form-container">
|
||||
<div class="container-left">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">资源名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入资源名称" autocomplete="off"
|
||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['title']) && ($resource['title'] !== '')?$resource['title']:'')); ?>" lay-affix="clear">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入资源名称"
|
||||
autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($resource['title']) && ($resource['title'] !== '')?$resource['title']:'')); ?>"
|
||||
lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -126,15 +129,17 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">资源编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="number" required lay-verify="required" placeholder="请输入分类编号" autocomplete="off"
|
||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['number']) && ($resource['number'] !== '')?$resource['number']:'')); ?>" lay-affix="clear" disabled>
|
||||
<input type="text" name="number" required lay-verify="required" placeholder="请输入分类编号"
|
||||
autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($resource['number']) && ($resource['number'] !== '')?$resource['number']:'')); ?>"
|
||||
lay-affix="clear" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">描述</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" placeholder="请输入资源描述" class="layui-textarea" lay-affix="clear"><?php echo htmlentities((string) (isset($resource['desc']) && ($resource['desc'] !== '')?$resource['desc']:'')); ?></textarea>
|
||||
<textarea name="desc" placeholder="请输入资源描述" class="layui-textarea"
|
||||
lay-affix="clear"><?php echo htmlentities((string) (isset($resource['desc']) && ($resource['desc'] !== '')?$resource['desc']:'')); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -142,7 +147,16 @@
|
||||
<label class="layui-form-label">上传者</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="uploader" required lay-verify="required" placeholder="请输入上传者"
|
||||
autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($resource['uploader']) && ($resource['uploader'] !== '')?$resource['uploader']:'')); ?>" lay-affix="clear">
|
||||
autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($resource['uploader']) && ($resource['uploader'] !== '')?$resource['uploader']:'')); ?>"
|
||||
lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" value="<?php echo htmlentities((string) (isset($resource['sort']) && ($resource['sort'] !== '')?$resource['sort']:'0')); ?>" class="layui-input"
|
||||
placeholder="数字越大越靠前" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -158,12 +172,66 @@
|
||||
style="width: 118px; height: 118px;object-fit: cover;">
|
||||
<div id="upload-text"></div>
|
||||
</div>
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="icon-progress">
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes"
|
||||
lay-filter="icon-progress">
|
||||
<div class="layui-progress-bar" lay-percent=""></div>
|
||||
</div>
|
||||
<input type="hidden" name="icon" id="icon" value="">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
||||
<div class="layui-form-mid layui-word-aux">建议尺寸:250px * 140px</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图片上传</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="image-upload-container">
|
||||
<button type="button" class="btn btn-primary" id="imageUpload">
|
||||
<i class="fas fa-upload"></i> 多图片上传
|
||||
</button>
|
||||
<div class="image-preview-container" id="imagePreview">
|
||||
<?php if(isset($resource['images']) && !empty($resource['images'])): ?>
|
||||
<div class="image-list-table">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="100" align="center">缩略图</th>
|
||||
<th width="40" align="center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
// 处理图片字符串,正确拆分逗号分隔的路径
|
||||
$imageArray = [];
|
||||
if (isset($resource['images']) && !empty($resource['images'])) {
|
||||
$imageArray = explode(',', $resource['images']);
|
||||
$imageArray = array_map('trim', $imageArray); // 去除每个路径的前后空格
|
||||
$imageArray = array_filter($imageArray); // 过滤空值
|
||||
}
|
||||
if(is_array($imageArray) || $imageArray instanceof \think\Collection || $imageArray instanceof \think\Paginator): $i = 0; $__LIST__ = $imageArray;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$image): $mod = ($i % 2 );++$i;?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="image-thumbnail" onclick="previewImage('<?php echo (strpos($image, 'http') === 0 ? $image : request()->domain() . $image); ?>')">
|
||||
<img src="<?php echo (strpos($image, 'http') === 0 ? $image : request()->domain() . $image); ?>" alt="缩略图">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-xs delete-image" data-src="<?php echo htmlentities((string) $image); ?>">
|
||||
<i class="fas fa-trash"></i> 删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="upload-progress" id="imageProgress" style="display: none;">
|
||||
<div class="progress-bar" role="progressbar" style="width: 0%"></div>
|
||||
</div>
|
||||
<input type="hidden" name="images" id="images" value="<?php echo htmlentities((string) (isset($resource['images']) && ($resource['images'] !== '')?$resource['images']:'')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -171,7 +239,8 @@
|
||||
<label class="layui-form-label">资源文件</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="fileurl" required placeholder="本地资源地址" autocomplete="off"
|
||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['fileurl']) && ($resource['fileurl'] !== '')?$resource['fileurl']:'')); ?>" style="margin-bottom: 10px;" lay-affix="clear">
|
||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['fileurl']) && ($resource['fileurl'] !== '')?$resource['fileurl']:'')); ?>" style="margin-bottom: 10px;"
|
||||
lay-affix="clear">
|
||||
<div class="layui-upload-drag" style="display: block;" id="ID-upload-demo-drag">
|
||||
<i class="layui-icon layui-icon-upload"></i>
|
||||
<div>点击上传,或将文件拖拽到此处</div>
|
||||
@ -184,7 +253,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="file-progress" style="margin-top: 10px;">
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="file-progress"
|
||||
style="margin-top: 10px;">
|
||||
<div class="layui-progress-bar" lay-percent=""></div>
|
||||
</div>
|
||||
<input type="hidden" name="file" id="file" value="">
|
||||
@ -214,14 +284,8 @@
|
||||
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">
|
||||
<input type="number" name="sort" value="<?php echo htmlentities((string) (isset($resource['sort']) && ($resource['sort'] !== '')?$resource['sort']:'0')); ?>" class="layui-input" placeholder="数字越大越靠前" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-right">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">内容</label>
|
||||
<div class="layui-input-block">
|
||||
@ -232,12 +296,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item" style="margin-top: 80px;">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -305,7 +372,7 @@
|
||||
$('#upload-text').html('');
|
||||
layer.msg('图标上传成功', { icon: 1 });
|
||||
},
|
||||
uploadError: function () {
|
||||
error: function () {
|
||||
var demoText = $('#upload-text');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
@ -320,6 +387,58 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 多图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#imageUpload',
|
||||
url: '<?php echo url("index/upload_img"); ?>',
|
||||
multiple: true,
|
||||
accept: 'images',
|
||||
before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
$('#imagePreview').append('<div class="layui-upload-img-item" data-src="' + result + '"><img src="' + result + '" alt="' + file.name + '" style="width: 100px; height: 100px; object-fit: cover;"><p>' + file.name + '</p><button type="button" class="layui-btn layui-btn-xs layui-btn-danger delete-image" style="position: absolute; top: 0; right: 0;">删除</button></div>');
|
||||
});
|
||||
element.progress('image-progress', '0%');
|
||||
layer.msg('图片上传中', { icon: 16, time: 0 });
|
||||
},
|
||||
done: function (res) {
|
||||
if (res.code > 0) {
|
||||
return layer.msg('图片上传失败');
|
||||
}
|
||||
var images = $('#images').val().split(',');
|
||||
if (res.data) {
|
||||
images.push(res.data);
|
||||
}
|
||||
$('#images').val(images.filter(Boolean).join(','));
|
||||
layer.msg('图片上传成功', { icon: 1 });
|
||||
},
|
||||
error: function () {
|
||||
var demoText = $('#imagePreview');
|
||||
demoText.append('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
},
|
||||
progress: function (n, elem, e) {
|
||||
element.progress('image-progress', n + '%');
|
||||
if (n == 100) {
|
||||
layer.msg('图片上传完毕', { icon: 1 });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 删除图片功能
|
||||
$('#imagePreview').on('click', '.delete-image', function () {
|
||||
var $item = $(this).closest('.layui-upload-img-item');
|
||||
var imageSrc = $item.data('src');
|
||||
var images = $('#images').val().split(',');
|
||||
var index = images.indexOf(imageSrc);
|
||||
if (index > -1) {
|
||||
images.splice(index, 1);
|
||||
}
|
||||
$('#images').val(images.join(','));
|
||||
$item.remove();
|
||||
});
|
||||
|
||||
// 文件上传
|
||||
var fileUpload = upload.render({
|
||||
elem: '#ID-upload-demo-drag',
|
||||
@ -505,7 +624,7 @@
|
||||
editorConfig.MENU_CONF['uploadImage'] = {
|
||||
server: '<?php echo url("index/upload_img"); ?>',
|
||||
fieldName: 'file',
|
||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
||||
maxFileSize: 50 * 1024 * 1024, // 50M
|
||||
maxNumberOfFiles: 10,
|
||||
allowedFileTypes: ['image/*'],
|
||||
meta: {
|
||||
@ -515,7 +634,7 @@
|
||||
headers: {
|
||||
Accept: 'text/x-json'
|
||||
},
|
||||
timeout: 5 * 1000, // 5s
|
||||
timeout: 30 * 1000, // 30s
|
||||
|
||||
onBeforeUpload(file) {
|
||||
console.log('准备上传图片', file)
|
||||
@ -536,17 +655,18 @@
|
||||
console.error('上传出错', file, err, res)
|
||||
},
|
||||
customInsert(res, insertFn) {
|
||||
// res 即服务端的返回结果
|
||||
if (res.code === 0 && res.data) {
|
||||
// 从res.data中获取src字段
|
||||
const url = String(res.data.src || '');
|
||||
if (url) {
|
||||
insertFn(url);
|
||||
} else {
|
||||
layer.msg('图片地址无效', { icon: 2 });
|
||||
// 只使用返回的url字段,并确保使用完整的URL
|
||||
if (res.code === 0 && res.url) {
|
||||
// 如果URL不是以http开头,添加https://
|
||||
let imageUrl = res.url;
|
||||
if (!imageUrl.startsWith('http')) {
|
||||
imageUrl = 'https://' + imageUrl;
|
||||
}
|
||||
// 移除可能存在的重复域名和路径
|
||||
imageUrl = imageUrl.replace(/^https?:\/\/[^\/]+\/admin\/resources\//, 'https://www.yunzer.cn/');
|
||||
insertFn(imageUrl);
|
||||
} else {
|
||||
layer.msg('图片上传失败', { icon: 2 });
|
||||
layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -574,3 +694,272 @@
|
||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const imageUpload = document.getElementById('imageUpload');
|
||||
const imagePreview = document.getElementById('imagePreview');
|
||||
const imageProgress = document.getElementById('imageProgress');
|
||||
const progressBar = imageProgress.querySelector('.progress-bar');
|
||||
const imagesInput = document.getElementById('images');
|
||||
|
||||
// 处理图片上传
|
||||
imageUpload.addEventListener('click', function () {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.multiple = true;
|
||||
input.accept = 'image/*';
|
||||
|
||||
input.onchange = function (e) {
|
||||
const files = e.target.files;
|
||||
if (files.length === 0) return;
|
||||
|
||||
imageProgress.style.display = 'block';
|
||||
let uploadedCount = 0;
|
||||
|
||||
Array.from(files).forEach(file => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
fetch('<?php echo url("index/upload_img"); ?>', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(res => {
|
||||
if (res.code === 0) {
|
||||
addImagePreview(res.data);
|
||||
updateImagesInput();
|
||||
} else {
|
||||
alert('上传失败:' + res.msg);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('上传错误:', error);
|
||||
alert('上传出错');
|
||||
})
|
||||
.finally(() => {
|
||||
uploadedCount++;
|
||||
const progress = (uploadedCount / files.length) * 100;
|
||||
progressBar.style.width = progress + '%';
|
||||
|
||||
if (uploadedCount === files.length) {
|
||||
setTimeout(() => {
|
||||
imageProgress.style.display = 'none';
|
||||
progressBar.style.width = '0%';
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
input.click();
|
||||
});
|
||||
|
||||
// 添加图片预览
|
||||
function addImagePreview(imageUrl) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'image-preview-item';
|
||||
div.dataset.src = imageUrl;
|
||||
|
||||
div.innerHTML = `
|
||||
<img src="${imageUrl}" alt="已上传图片">
|
||||
<div class="image-preview-overlay">
|
||||
<button type="button" class="btn btn-danger btn-sm delete-image">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<p class="image-filename">${imageUrl.split('/').pop()}</p>
|
||||
`;
|
||||
|
||||
imagePreview.appendChild(div);
|
||||
}
|
||||
|
||||
// 更新隐藏输入框的值
|
||||
function updateImagesInput() {
|
||||
const images = Array.from(imagePreview.querySelectorAll('.image-preview-item'))
|
||||
.map(item => item.dataset.src);
|
||||
imagesInput.value = images.join(',');
|
||||
}
|
||||
|
||||
// 删除图片
|
||||
imagePreview.addEventListener('click', function (e) {
|
||||
if (e.target.closest('.delete-image')) {
|
||||
const item = e.target.closest('.image-preview-item');
|
||||
item.remove();
|
||||
updateImagesInput();
|
||||
}
|
||||
});
|
||||
|
||||
// 图片预览功能
|
||||
window.previewImage = function(imageUrl) {
|
||||
layer.photos({
|
||||
photos: {
|
||||
"data": [{
|
||||
"src": imageUrl,
|
||||
"alt": "图片预览"
|
||||
}]
|
||||
},
|
||||
anim: 5
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.image-upload-container {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.image-preview-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||
gap: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.image-preview-item {
|
||||
position: relative;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.image-preview-item img {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.image-preview-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
z-index: 1;
|
||||
/* 添加 z-index */
|
||||
}
|
||||
|
||||
.image-preview-item:hover .image-preview-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.image-filename {
|
||||
margin: 5px 0;
|
||||
font-size: 0.9em;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.upload-progress {
|
||||
margin-top: 10px;
|
||||
height: 4px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: #007bff;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background: #c82333;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.delete-image {
|
||||
/* background: #dc3545; */
|
||||
/* color: white; */
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s;
|
||||
z-index: 2;
|
||||
/* 确保按钮在悬停层之上 */
|
||||
}
|
||||
|
||||
.delete-image i {
|
||||
font-size: 40px;
|
||||
margin-right: 4px;
|
||||
/* 添加图标右边距 */
|
||||
}
|
||||
|
||||
.form-container {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.container-left {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.container-right {
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
/* 图片列表表格样式 */
|
||||
.image-list-table {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.image-thumbnail {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.image-thumbnail:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.image-thumbnail img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:1:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\index\index.php";i:1747649140;}*/ ?>
|
||||
<?php /*a:1:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\index\index.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?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;}*/ ?>
|
||||
<?php /*a:2:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\resources\lists.php";i:1766587447;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1746890051;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1749125154;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1748359853;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1749138336;}*/ ?>
|
||||
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1766587447;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1766587447;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1766587447;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@ -10,13 +10,32 @@
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/fontawesome.css">
|
||||
<link rel="stylesheet" href="/static/css/all.min.css">
|
||||
|
||||
<script src="/static/layui/layui.js" charset="utf-8"></script>
|
||||
<script src="/static/js/bootstrap.bundle.js"></script>
|
||||
<script src="/static/js/all.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
/**
|
||||
* 商业使用授权协议
|
||||
*
|
||||
* Copyright (c) 2025 [云泽网]. 保留所有权利.
|
||||
*
|
||||
* 本软件仅供评估使用。任何商业用途必须获得书面授权许可。
|
||||
* 未经授权商业使用本软件属于侵权行为,将承担法律责任。
|
||||
*
|
||||
* 授权购买请联系: 357099073@qq.com
|
||||
* 官方网站: https://www.yunzer.cn
|
||||
*
|
||||
* 评估用户须知:
|
||||
* 1. 禁止移除版权声明
|
||||
* 2. 禁止用于生产环境
|
||||
* 3. 禁止转售或分发
|
||||
*/
|
||||
|
||||
// 获取当前登录状态
|
||||
$isLoggedIn = false;
|
||||
$userInfo = [
|
||||
@ -87,6 +106,22 @@ $loginStatus = [
|
||||
<li><a href="/index/game/index?cateid=8">游戏下载</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-menu__search">
|
||||
<i class="layui-icon layui-icon-search search-icon" id="mainSearchIcon"></i>
|
||||
</div>
|
||||
<!-- 搜索蒙版 -->
|
||||
<div class="search-mask" id="searchMask" style="">
|
||||
<div class="search-container">
|
||||
<div class="search-box">
|
||||
<select id="searchType" class="search-type">
|
||||
<option value="articles">文章</option>
|
||||
<option value="resources">资源</option>
|
||||
</select>
|
||||
<input type="text" id="searchInput" placeholder="请输入搜索关键词">
|
||||
<button class="search-btn" id="searchBtn">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-menu__right">
|
||||
<div class="username">
|
||||
<?php if ($userInfo['is_login']): ?>
|
||||
@ -151,6 +186,9 @@ $loginStatus = [
|
||||
<li><a href="/index/game/index?cateid=8">游戏下载</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sticky-nav__search">
|
||||
<i class="layui-icon layui-icon-search search-icon" id="stickySearchIcon"></i>
|
||||
</div>
|
||||
<div class="sticky-nav__right">
|
||||
<div class="main-menu__right">
|
||||
<div class="username">
|
||||
@ -193,217 +231,6 @@ $loginStatus = [
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* 用户头像样式 */
|
||||
#userAvatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
#userAvatar:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 下拉菜单容器 */
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
width: 160px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-10px);
|
||||
transition: all 0.3s ease;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.user-dropdown.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* 下拉菜单列表 */
|
||||
.user-dropdown ul {
|
||||
margin: 0;
|
||||
padding: 5px 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* 下拉菜单项 */
|
||||
.user-dropdown li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 下拉菜单链接 */
|
||||
.user-dropdown li a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* 下拉菜单图标 */
|
||||
.user-dropdown li a i {
|
||||
margin-right: 10px;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 下拉菜单文字 */
|
||||
.user-dropdown li a span {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 下拉菜单悬停效果 */
|
||||
.user-dropdown li a:hover {
|
||||
background: #f5f5f5;
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.user-dropdown li a:hover i {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
/* 分隔线 */
|
||||
.user-dropdown li:not(:last-child) {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
#userDropdownSticky a {
|
||||
color: #0d6efd !important;
|
||||
}
|
||||
|
||||
/* Banner样式 */
|
||||
.banner-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 10%;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-text a {
|
||||
text-decoration: none;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 4em;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-desc {
|
||||
font-size: 2em;
|
||||
font-weight: 400;
|
||||
max-width: 800px;
|
||||
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-btn {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.banner-btn:hover {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-slider {
|
||||
width: 100%;
|
||||
height: 86vh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.banner-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
/* 关键:等比缩放并铺满 */
|
||||
display: block;
|
||||
}
|
||||
|
||||
.layui-carousel {
|
||||
background: #f8f8f8;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 确保轮播容器和项目的高度正确 */
|
||||
#test10,
|
||||
#test10 [carousel-item],
|
||||
#test10 [carousel-item]>* {
|
||||
height: 86vh !important;
|
||||
}
|
||||
|
||||
#test10 [carousel-item]>* {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.main-menu__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.username {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// 在页面加载时立即执行
|
||||
(function () {
|
||||
@ -435,8 +262,97 @@ $loginStatus = [
|
||||
}
|
||||
})();
|
||||
|
||||
layui.use(['carousel', 'form', 'layer'], function () {
|
||||
var carousel = layui.carousel, form = layui.form, layer = layui.layer, $ = layui.$;
|
||||
// 搜索功能相关代码
|
||||
layui.use(['layer'], function () {
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 执行搜索
|
||||
function executeSearch() {
|
||||
var searchInput = document.getElementById('searchInput');
|
||||
if (!searchInput) {
|
||||
layer.msg('搜索组件初始化失败');
|
||||
return;
|
||||
}
|
||||
|
||||
var keyword = searchInput.value.trim();
|
||||
var type = document.getElementById('searchType').value;
|
||||
|
||||
if (!keyword) {
|
||||
layer.msg('请输入搜索关键词');
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到统一的搜索结果页面
|
||||
window.location.href = '/index/search/index?keyword=' + encodeURIComponent(keyword) + '&type=' + type;
|
||||
}
|
||||
|
||||
// 绑定事件
|
||||
$(function() {
|
||||
var searchMask = $('#searchMask');
|
||||
var searchInput = $('#searchInput');
|
||||
var searchBtn = $('#searchBtn');
|
||||
var mainSearchIcon = $('#mainSearchIcon');
|
||||
var stickySearchIcon = $('#stickySearchIcon');
|
||||
|
||||
// 显示搜索框
|
||||
function showSearch() {
|
||||
searchMask.addClass('show');
|
||||
setTimeout(function() {
|
||||
searchInput.focus();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 隐藏搜索框
|
||||
function hideSearch() {
|
||||
searchMask.removeClass('show');
|
||||
searchInput.val('');
|
||||
}
|
||||
|
||||
// 绑定搜索图标点击事件
|
||||
mainSearchIcon.on('click', showSearch);
|
||||
stickySearchIcon.on('click', showSearch);
|
||||
|
||||
// 绑定搜索按钮点击事件
|
||||
searchBtn.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
executeSearch();
|
||||
});
|
||||
|
||||
// 绑定回车键搜索
|
||||
searchInput.on('keypress', function(e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
executeSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 点击遮罩层关闭搜索框
|
||||
searchMask.on('click', function(e) {
|
||||
if ($(e.target).hasClass('search-mask')) {
|
||||
hideSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 绑定ESC键关闭搜索框
|
||||
$(document).on('keydown', function(e) {
|
||||
if (e.keyCode === 27 && searchMask.hasClass('show')) {
|
||||
hideSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 输入框获得焦点时选中所有文本
|
||||
searchInput.on('focus', function() {
|
||||
this.select();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 其他功能相关代码
|
||||
layui.use(['carousel', 'form'], function () {
|
||||
var carousel = layui.carousel;
|
||||
var form = layui.form;
|
||||
var $ = layui.$;
|
||||
|
||||
// 检查本地存储并自动登录
|
||||
function checkAutoLogin() {
|
||||
@ -690,6 +606,326 @@ $loginStatus = [
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 用户头像样式 */
|
||||
#userAvatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
#userAvatar:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 下拉菜单容器 */
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
width: 160px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-10px);
|
||||
transition: all 0.3s ease;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.user-dropdown.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* 下拉菜单列表 */
|
||||
.user-dropdown ul {
|
||||
margin: 0;
|
||||
padding: 5px 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* 下拉菜单项 */
|
||||
.user-dropdown li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 下拉菜单链接 */
|
||||
.user-dropdown li a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* 下拉菜单图标 */
|
||||
.user-dropdown li a i {
|
||||
margin-right: 10px;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 下拉菜单文字 */
|
||||
.user-dropdown li a span {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 下拉菜单悬停效果 */
|
||||
.user-dropdown li a:hover {
|
||||
background: #f5f5f5;
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.user-dropdown li a:hover i {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
/* 分隔线 */
|
||||
.user-dropdown li:not(:last-child) {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
#userDropdownSticky a {
|
||||
color: #0d6efd !important;
|
||||
}
|
||||
|
||||
/* Banner样式 */
|
||||
.banner-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 10%;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-text a {
|
||||
text-decoration: none;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 4em;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-desc {
|
||||
font-size: 2em;
|
||||
font-weight: 400;
|
||||
max-width: 800px;
|
||||
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-btn {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.banner-btn:hover {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-slider {
|
||||
width: 100%;
|
||||
height: 86vh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.banner-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
/* 关键:等比缩放并铺满 */
|
||||
display: block;
|
||||
}
|
||||
|
||||
.layui-carousel {
|
||||
background: #f8f8f8;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 确保轮播容器和项目的高度正确 */
|
||||
#test10,
|
||||
#test10 [carousel-item],
|
||||
#test10 [carousel-item]>* {
|
||||
height: 86vh !important;
|
||||
}
|
||||
|
||||
#test10 [carousel-item]>* {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.main-menu__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.username {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
color: #333;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.search-icon:hover {
|
||||
color: #1e9fff;
|
||||
}
|
||||
|
||||
.search-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-mask.show {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
position: relative;
|
||||
width: 80%;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-20px);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.search-mask.show .search-container {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 60px;
|
||||
background: #fff;
|
||||
border-radius: 30px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding: 0 20px;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.search-box button {
|
||||
height: 100%;
|
||||
padding: 0 30px;
|
||||
border: none;
|
||||
background: #1E9FFF;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.search-box button:hover {
|
||||
background: #1a8fe6;
|
||||
}
|
||||
|
||||
.search-type {
|
||||
height: 100%;
|
||||
padding: 0 15px;
|
||||
border: none;
|
||||
border-right: 1px solid #eee;
|
||||
background: #f8f8f8;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 10px center;
|
||||
background-size: 12px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.search-type:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.search-type:focus {
|
||||
background-color: #fff;
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
||||
}
|
||||
</style>
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<!-- 站点资讯模块 -->
|
||||
@ -706,7 +942,7 @@ $loginStatus = [
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/articles/index?cateid=1', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/articles/index?cateid=3', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="webArticlesList">
|
||||
<!-- 文章将通过JavaScript动态加载 -->
|
||||
@ -748,7 +984,7 @@ $loginStatus = [
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/program/index?cateid=2', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=2', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="resourcesDownloadList">
|
||||
<!-- 文章将通过JavaScript动态加载 -->
|
||||
@ -769,7 +1005,7 @@ $loginStatus = [
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/program/index?cateid=1', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=1', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="programDownloadList">
|
||||
<!-- 程序将通过JavaScript动态加载 -->
|
||||
@ -790,7 +1026,7 @@ $loginStatus = [
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/game/index?cateid=8', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=8', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="gameDownloadList">
|
||||
<!-- 游戏将通过JavaScript动态加载 -->
|
||||
@ -1188,9 +1424,9 @@ $loginStatus = [
|
||||
});
|
||||
|
||||
return `
|
||||
<div class="opencourse product-item" onclick="window.open('/index/program/detail?id=${program.id || ''}', '_blank')">
|
||||
<div class="opencourse product-item" onclick="window.open('/index/resources/detail?id=${program.id || ''}', '_blank')">
|
||||
<div class="video">
|
||||
<img src="${program.icon || '/static/images/default-program.png'}" alt="" class="cover">
|
||||
<img src="${program.icon || ''}" alt="" class="cover">
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<div class="title">${program.title || '无标题'}</div>
|
||||
@ -1268,7 +1504,7 @@ $loginStatus = [
|
||||
if (!game) return '';
|
||||
|
||||
return `
|
||||
<div class="opencourse product-item" onclick="window.open('/index/game/detail?id=${game.id || ''}', '_blank')">
|
||||
<div class="opencourse product-item" onclick="window.open('/index/resources/detail?id=${game.id || ''}', '_blank')">
|
||||
<div class="video">
|
||||
<img src="${game.icon || '/static/images/default-game.png'}" alt="" class="cover">
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:5:{s:49:"E:\Demo\PHP\yunzer\app\index\view\game\detail.php";i:1748261449;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\head.php";i:1747649140;s:61:"E:\Demo\PHP\yunzer\app\index\view\component\header-simple.php";i:1748261449;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1747649140;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\foot.php";i:1746808046;}*/ ?>
|
||||
<?php /*a:5:{s:49:"E:\Demo\PHP\yunzer\app\index\view\game\detail.php";i:1766587447;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\head.php";i:1766587447;s:61:"E:\Demo\PHP\yunzer\app\index\view\component\header-simple.php";i:1766587447;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1766587447;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\foot.php";i:1766587447;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@ -10,40 +10,65 @@
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/fontawesome.css">
|
||||
<link rel="stylesheet" href="/static/css/all.min.css">
|
||||
|
||||
<script src="/static/layui/layui.js" charset="utf-8"></script>
|
||||
<script src="/static/js/all.min.js"></script>
|
||||
<script src="/static/js/bootstrap.bundle.js"></script>
|
||||
<script charset="UTF-8" id="LA_COLLECT" src="//www.yunzer.cn/plugins/js-sdk-pro.min.js"></script>
|
||||
<script>LA.init({ id: "KoyzaWWEcLvPzkQn", ck: "KoyzaWWEcLvPzkQn", autoTrack: true, prefix: 'event' })</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
/**
|
||||
* 商业使用授权协议
|
||||
*
|
||||
* Copyright (c) 2025 [云泽网]. 保留所有权利.
|
||||
*
|
||||
* 本软件仅供评估使用。任何商业用途必须获得书面授权许可。
|
||||
* 未经授权商业使用本软件属于侵权行为,将承担法律责任。
|
||||
*
|
||||
* 授权购买请联系: 357099073@qq.com
|
||||
* 官方网站: https://www.yunzer.cn
|
||||
*
|
||||
* 评估用户须知:
|
||||
* 1. 禁止移除版权声明
|
||||
* 2. 禁止用于生产环境
|
||||
* 3. 禁止转售或分发
|
||||
*/
|
||||
|
||||
// 获取当前登录状态
|
||||
$isLoggedIn = false;
|
||||
$userInfo = [
|
||||
'is_login' => false,
|
||||
'name' => '',
|
||||
'avatar' => '/static/images/avatar.png' // 默认头像
|
||||
];
|
||||
|
||||
// 检查cookie
|
||||
$userAccount = cookie('user_account');
|
||||
if ($userAccount) {
|
||||
$isLoggedIn = true;
|
||||
$userInfo = [
|
||||
'is_login' => true,
|
||||
'name' => cookie('user_name'),
|
||||
'avatar' => cookie('user_avatar') ? cookie('user_avatar') : '/static/images/avatar.png'
|
||||
];
|
||||
}
|
||||
|
||||
// 添加一个隐藏的div来存储登录状态
|
||||
$loginStatus = [
|
||||
'isLoggedIn' => $isLoggedIn,
|
||||
'userAccount' => $userAccount ?? ''
|
||||
];
|
||||
?>
|
||||
|
||||
<!-- 添加一个隐藏的div来存储登录状态 -->
|
||||
<div id="loginStatus" style="display: none;" data-is-logged-in="<?php echo htmlentities((string) $isLoggedIn); ?>" data-user-account="<?php echo isset($userAccount) ? htmlentities((string) $userAccount) : ''; ?>">
|
||||
</div>
|
||||
|
||||
<div style="display: flex;flex-direction: column;">
|
||||
<div class="topbar-one">
|
||||
<div class="container">
|
||||
<div style="width: 70%;">
|
||||
<ul class="list-unstyled topbar-one__info">
|
||||
<li class="topbar-one__info__item">
|
||||
<span class="topbar-one__info__icon fas fa-phone-alt" style="margin-right: 10px;"></span>
|
||||
<a href="<?php echo htmlentities((string) $config['admin_phone']); ?>"><?php echo htmlentities((string) $config['admin_phone']); ?></a>
|
||||
</li>
|
||||
<li class="topbar-one__info__item">
|
||||
<span class="topbar-one__info__icon fas fa-envelope" style="margin-right: 10px;"></span>
|
||||
<a href="mailto:<?php echo htmlentities((string) $config['admin_email']); ?>"><?php echo htmlentities((string) $config['admin_email']); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="topbar-one__social" style="width: 30%;">
|
||||
<a href="/index/user/login" class="mr-10"><i class="layui-icon layui-icon-username"></i> 登录</a>
|
||||
<a href="/index/user/register" class="mr-10"><i class="layui-icon layui-icon-user"></i> 注册</a>
|
||||
<a href="javascript:;" class="qrcode-trigger"><i class="layui-icon layui-icon-qrcode"></i> 公众号</a>
|
||||
<div class="qrcode-popup"
|
||||
style="display:none;position:absolute;right:54px;top:32px;background:#fff;padding:10px;box-shadow:0 0 10px rgba(0,0,0,0.1); z-index: 1000;">
|
||||
<img src="<?php echo htmlentities((string) $config['admin_wechat']); ?>" alt="公众号二维码" style="width:180px;height:180px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 导航栏 -->
|
||||
<div class="main-menu">
|
||||
<div class="container">
|
||||
@ -52,59 +77,28 @@
|
||||
</div>
|
||||
<div class="main-menu__nav">
|
||||
<ul class="main-menu__list">
|
||||
<li><a href="/index.html">首页</a></li>
|
||||
<li><a href="/about.html">关于我们</a></li>
|
||||
<li><a href="/products.html">产品服务</a></li>
|
||||
<li><a href="/contact.html">联系我们</a></li>
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/index/articles/index?cateid=1">站点资讯</a></li>
|
||||
<li><a href="/index/articles/index?cateid=3">技术文章</a></li>
|
||||
<li><a href="/index/program/index?cateid=2">办公资源</a></li>
|
||||
<li><a href="/index/program/index?cateid=1">程序下载</a></li>
|
||||
<li><a href="/index/game/index?cateid=8">游戏下载</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-menu__search">
|
||||
<i class="layui-icon layui-icon-search search-icon" id="mainSearchIcon"></i>
|
||||
</div>
|
||||
<div class="main-menu__right">
|
||||
<div class="username">
|
||||
<?php if ($userInfo['is_login']): ?>
|
||||
<span class="username-text"><?php echo htmlentities((string) $userInfo['name']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-inline" style="position: relative;">
|
||||
<img src="/static/images/avatar.webp" class="layui-circle"
|
||||
style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarMain">
|
||||
<div class="user-dropdown" id="userDropdownMain">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/index/user/profile"><i
|
||||
class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/index/user/settings"><i
|
||||
class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" class="logout-btn"><i
|
||||
class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 固定导航 -->
|
||||
<div class="sticky-nav" style="display: none;">
|
||||
<div class="container">
|
||||
<div class="sticky-nav__logo">
|
||||
<a href="/index.html"><img src="/static/images/logo1.png" width="150" alt="Logo"></a>
|
||||
</div>
|
||||
<div class="sticky-nav__menu">
|
||||
<ul>
|
||||
<li><a href="/index.html">首页</a></li>
|
||||
<li><a href="/about.html">关于我们</a></li>
|
||||
<li><a href="/products.html">产品服务</a></li>
|
||||
<li><a href="/contact.html">联系我们</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sticky-nav__right">
|
||||
<div class="main-menu__right">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-inline" style="position: relative;">
|
||||
<img src="/static/images/avatar.webp" class="layui-circle"
|
||||
<!-- 根据登录状态显示不同的内容 -->
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<div class="layui-inline" style="position: relative;margin-left:20px;">
|
||||
<img src="<?php echo htmlentities((string) $userInfo['avatar']); ?>" class="layui-circle"
|
||||
style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarSticky">
|
||||
<div class="user-dropdown" id="userDropdownSticky">
|
||||
<ul>
|
||||
@ -123,12 +117,426 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="layui-inline">
|
||||
<a href="/index/user/login" class="layui-btn layui-btn-normal">登录</a>
|
||||
<a href="/index/user/register" class="layui-btn layui-btn-primary">注册</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 固定导航 -->
|
||||
<div class="sticky-nav" style="display: none;">
|
||||
<div class="container">
|
||||
<div class="sticky-nav__logo">
|
||||
<a href="/index.html"><img src="/static/images/logo1.png" width="150" alt="Logo"></a>
|
||||
</div>
|
||||
<div class="sticky-nav__menu">
|
||||
<ul>
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/index/articles/index?cateid=1">站点资讯</a></li>
|
||||
<li><a href="/index/articles/index?cateid=3">技术文章</a></li>
|
||||
<li><a href="/index/program/index?cateid=2">办公资源</a></li>
|
||||
<li><a href="/index/program/index?cateid=1">程序下载</a></li>
|
||||
<li><a href="/index/game/index?cateid=8">游戏下载</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sticky-nav__search">
|
||||
<i class="layui-icon layui-icon-search search-icon" id="stickySearchIcon"></i>
|
||||
</div>
|
||||
<div class="sticky-nav__right">
|
||||
<div class="main-menu__right">
|
||||
<div class="username">
|
||||
<?php if ($userInfo['is_login']): ?>
|
||||
<span class="username-text"><?php echo htmlentities((string) $userInfo['name']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<!-- 根据登录状态显示不同的内容 -->
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<div class="layui-inline" style="position: relative;margin-left:20px;">
|
||||
<img src="<?php echo htmlentities((string) $userInfo['avatar']); ?>" class="layui-circle"
|
||||
style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarSticky">
|
||||
<div class="user-dropdown" id="userDropdownSticky">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/index/user/profile"><i
|
||||
class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/index/user/settings"><i
|
||||
class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" class="logout-btn"><i
|
||||
class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="layui-inline">
|
||||
<a href="/index/user/login" class="layui-btn layui-btn-normal">登录</a>
|
||||
<a href="/index/user/register" class="layui-btn layui-btn-primary">注册</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索遮罩 -->
|
||||
<div class="search-mask" id="searchMask">
|
||||
<div class="search-container">
|
||||
<div class="search-box">
|
||||
<select id="searchType" class="search-type">
|
||||
<option value="articles">文章</option>
|
||||
<option value="resources">资源</option>
|
||||
</select>
|
||||
<input type="text" id="searchInput" placeholder="请输入搜索关键词">
|
||||
<button id="searchBtn">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 在页面加载时立即执行
|
||||
(function () {
|
||||
// 检查是否已经刷新过
|
||||
if (sessionStorage.getItem('has_refreshed') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查localStorage中是否有用户账号
|
||||
var userAccount = localStorage.getItem('user_account');
|
||||
if (userAccount) {
|
||||
// 同步到cookie
|
||||
document.cookie = "user_account=" + userAccount + "; path=/";
|
||||
|
||||
// 如果有其他必要的数据,也同步到cookie
|
||||
var userId = localStorage.getItem('user_id');
|
||||
var userName = localStorage.getItem('user_name');
|
||||
var userAvatar = localStorage.getItem('user_avatar');
|
||||
|
||||
if (userId) document.cookie = "user_id=" + userId + "; path=/";
|
||||
if (userName) document.cookie = "user_name=" + userName + "; path=/";
|
||||
if (userAvatar) document.cookie = "user_avatar=" + userAvatar + "; path=/";
|
||||
|
||||
// 刷新页面以应用新的cookie,并标记已刷新
|
||||
if (!document.cookie.includes('user_id')) {
|
||||
sessionStorage.setItem('has_refreshed', 'true');
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
layui.use(['carousel', 'form', 'layer'], function () {
|
||||
var carousel = layui.carousel, form = layui.form, layer = layui.layer, $ = layui.$;
|
||||
|
||||
// 检查本地存储并自动登录
|
||||
function checkAutoLogin() {
|
||||
// 如果已经登录,不再执行自动登录
|
||||
if ($('#userAvatarMain').length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果已经尝试过自动登录,不再执行
|
||||
if (sessionStorage.getItem('auto_login_attempted') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 从localStorage获取用户账号
|
||||
var userAccount = localStorage.getItem('user_account');
|
||||
if (userAccount) {
|
||||
// 标记已尝试自动登录
|
||||
sessionStorage.setItem('auto_login_attempted', 'true');
|
||||
|
||||
// 发送自动登录请求
|
||||
$.ajax({
|
||||
url: '/index/user/login',
|
||||
type: 'POST',
|
||||
data: {
|
||||
account: userAccount,
|
||||
password: atob(localStorage.getItem('user_password'))
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.code === 0) {
|
||||
// 设置cookie
|
||||
document.cookie = "user_id=" + res.data.id + "; path=/";
|
||||
document.cookie = "user_name=" + res.data.name + "; path=/";
|
||||
document.cookie = "user_avatar=" + res.data.avatar + "; path=/";
|
||||
document.cookie = "user_account=" + userAccount + "; path=/";
|
||||
|
||||
// 同时更新localStorage
|
||||
localStorage.setItem('user_id', res.data.id);
|
||||
localStorage.setItem('user_name', res.data.name);
|
||||
localStorage.setItem('user_avatar', res.data.avatar);
|
||||
|
||||
// 登录成功,强制刷新页面
|
||||
window.location.href = window.location.href + '?t=' + new Date().getTime();
|
||||
} else {
|
||||
// 登录失败,清除所有相关存储
|
||||
localStorage.removeItem('user_account');
|
||||
localStorage.removeItem('user_password');
|
||||
sessionStorage.removeItem('auto_login_attempted');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载时检查自动登录
|
||||
checkAutoLogin();
|
||||
|
||||
$(document).ready(function () {
|
||||
// 主导航头像
|
||||
$("#userAvatarMain").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownMain").toggleClass("show");
|
||||
$("#userDropdownSticky").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
// 固定导航头像
|
||||
$("#userAvatarSticky").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownSticky").toggleClass("show");
|
||||
$("#userDropdownMain").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
|
||||
// 点击页面其他地方隐藏所有菜单
|
||||
$(document).click(function (e) {
|
||||
if (!$(e.target).closest('.user-dropdown, #userAvatarMain, #userAvatarSticky').length) {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
}
|
||||
});
|
||||
|
||||
// 点击菜单项时隐藏菜单
|
||||
$("#userDropdownMain li a, #userDropdownSticky li a").click(function () {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
});
|
||||
});
|
||||
|
||||
// 退出登录
|
||||
$('.logout-btn').on('click', function () {
|
||||
layer.confirm('确定要退出登录吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
// 先发送退出请求
|
||||
$.ajax({
|
||||
url: '/index/user/logout',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.code === 0) {
|
||||
// 清除localStorage
|
||||
localStorage.removeItem('user_account');
|
||||
localStorage.removeItem('user_password');
|
||||
localStorage.removeItem('user_id');
|
||||
localStorage.removeItem('user_name');
|
||||
localStorage.removeItem('user_avatar');
|
||||
|
||||
// 清除sessionStorage
|
||||
sessionStorage.removeItem('auto_login_attempted');
|
||||
sessionStorage.removeItem('has_refreshed');
|
||||
|
||||
// 清除cookie
|
||||
document.cookie = "user_id=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
document.cookie = "user_name=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
document.cookie = "user_avatar=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
document.cookie = "user_account=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
document.cookie = "user_password=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
|
||||
// 强制刷新页面,不使用缓存
|
||||
window.location.href = window.location.href + '?t=' + new Date().getTime();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function () {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
if (scrollTop > 150) { // 当滚动超过150px时显示固定导航
|
||||
$('.sticky-nav').fadeIn();
|
||||
} else {
|
||||
$('.sticky-nav').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// 公众号二维码
|
||||
const trigger = document.querySelector('.qrcode-trigger');
|
||||
const popup = document.querySelector('.qrcode-popup');
|
||||
|
||||
// 鼠标移入显示二维码
|
||||
trigger.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出隐藏二维码
|
||||
trigger.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
|
||||
// 鼠标移入二维码区域时保持显示
|
||||
popup.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出二维码区域时隐藏
|
||||
popup.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
|
||||
form.on('submit(accountLogin)', function (data) {
|
||||
$.ajax({
|
||||
url: '<?php echo url("index/user/login"); ?>',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.code === 0) {
|
||||
// 存储登录数据,设置7天过期
|
||||
var expireTime = new Date().getTime() + 7 * 24 * 60 * 60 * 1000;
|
||||
|
||||
// 设置localStorage
|
||||
localStorage.setItem('user_account', data.field.account);
|
||||
localStorage.setItem('user_password', btoa(data.field.password));
|
||||
localStorage.setItem('expire_time', expireTime);
|
||||
localStorage.setItem('is_auto_login', 'true');
|
||||
|
||||
// 设置cookie
|
||||
document.cookie = "user_id=" + res.data.id + "; path=/";
|
||||
document.cookie = "user_name=" + res.data.name + "; path=/";
|
||||
document.cookie = "user_avatar=" + res.data.avatar + "; path=/";
|
||||
document.cookie = "expire_time=" + expireTime + "; path=/";
|
||||
document.cookie = "is_auto_login=true; path=/";
|
||||
document.cookie = "user_account=" + data.field.account + "; path=/";
|
||||
document.cookie = "user_password=" + btoa(data.field.password) + "; path=/";
|
||||
|
||||
// 设置sessionStorage
|
||||
sessionStorage.setItem('auto_login_attempted', 'true');
|
||||
|
||||
layer.msg('登录成功', {
|
||||
icon: 1,
|
||||
time: 2000,
|
||||
shade: 0.3
|
||||
}, function () {
|
||||
// 获取当前页面URL
|
||||
var currentUrl = window.location.href;
|
||||
|
||||
// 如果当前页面是登录页面,则跳转到首页
|
||||
if (currentUrl.includes('/index/user/login')) {
|
||||
window.location.href = '/index.html';
|
||||
} else {
|
||||
// 否则刷新当前页面
|
||||
window.location.href = currentUrl + '?t=' + new Date().getTime();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, {
|
||||
icon: 2,
|
||||
time: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// 搜索功能相关代码
|
||||
layui.use(['layer'], function () {
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 执行搜索
|
||||
function executeSearch() {
|
||||
var searchInput = document.getElementById('searchInput');
|
||||
if (!searchInput) {
|
||||
layer.msg('搜索组件初始化失败');
|
||||
return;
|
||||
}
|
||||
|
||||
var keyword = searchInput.value.trim();
|
||||
var type = document.getElementById('searchType').value;
|
||||
|
||||
if (!keyword) {
|
||||
layer.msg('请输入搜索关键词');
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到统一的搜索结果页面
|
||||
window.location.href = '/index/search/index?keyword=' + encodeURIComponent(keyword) + '&type=' + type;
|
||||
}
|
||||
|
||||
// 绑定事件
|
||||
$(function() {
|
||||
var searchMask = $('#searchMask');
|
||||
var searchInput = $('#searchInput');
|
||||
var searchBtn = $('#searchBtn');
|
||||
var mainSearchIcon = $('#mainSearchIcon');
|
||||
var stickySearchIcon = $('#stickySearchIcon');
|
||||
|
||||
// 显示搜索框
|
||||
function showSearch() {
|
||||
searchMask.addClass('show');
|
||||
setTimeout(function() {
|
||||
searchInput.focus();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 隐藏搜索框
|
||||
function hideSearch() {
|
||||
searchMask.removeClass('show');
|
||||
searchInput.val('');
|
||||
}
|
||||
|
||||
// 绑定搜索图标点击事件
|
||||
mainSearchIcon.on('click', showSearch);
|
||||
stickySearchIcon.on('click', showSearch);
|
||||
|
||||
// 绑定搜索按钮点击事件
|
||||
searchBtn.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
executeSearch();
|
||||
});
|
||||
|
||||
// 绑定回车键搜索
|
||||
searchInput.on('keypress', function(e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
executeSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 点击遮罩层关闭搜索框
|
||||
searchMask.on('click', function(e) {
|
||||
if ($(e.target).hasClass('search-mask')) {
|
||||
hideSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 绑定ESC键关闭搜索框
|
||||
$(document).on('keydown', function(e) {
|
||||
if (e.keyCode === 27 && searchMask.hasClass('show')) {
|
||||
hideSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// 输入框获得焦点时选中所有文本
|
||||
searchInput.on('focus', function() {
|
||||
this.select();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 用户头像样式 */
|
||||
#userAvatar {
|
||||
@ -328,123 +736,198 @@
|
||||
#test10 [carousel-item]>* {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.main-menu__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.username {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 搜索相关样式 */
|
||||
.search-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-mask.show {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
position: relative;
|
||||
width: 80%;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-20px);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.search-mask.show .search-container {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 60px;
|
||||
background: #fff;
|
||||
border-radius: 30px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding: 0 20px;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.search-box button {
|
||||
height: 100%;
|
||||
padding: 0 30px;
|
||||
border: none;
|
||||
background: #1E9FFF;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.search-box button:hover {
|
||||
background: #1a8fe6;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
color: #333;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.search-icon:hover {
|
||||
color: #1e9fff;
|
||||
}
|
||||
|
||||
.search-type {
|
||||
height: 100%;
|
||||
padding: 0 15px;
|
||||
border: none;
|
||||
border-right: 1px solid #eee;
|
||||
background: #f8f8f8;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 10px center;
|
||||
background-size: 12px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.search-type:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.search-type:focus {
|
||||
background-color: #fff;
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.search-results {
|
||||
padding: 15px;
|
||||
max-height: 370px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.search-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.search-section h3 {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.search-section ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.search-section li {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px dashed #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.search-section li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.search-section a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-section a:hover {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.search-section .downloads {
|
||||
color: #1E9FFF;
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/* 自定义滚动条样式 */
|
||||
.search-results::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.search-results::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.search-results::-webkit-scrollbar-thumb {
|
||||
background: #ccc;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.search-results::-webkit-scrollbar-thumb:hover {
|
||||
background: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
layui.use(['carousel', 'form', 'layer'], function () {
|
||||
var carousel = layui.carousel, form = layui.form, layer = layui.layer, $ = layui.$;
|
||||
|
||||
// 加载banner数据
|
||||
$.ajax({
|
||||
url: '/index/index/bannerlist',
|
||||
type: 'GET',
|
||||
success: function (res) {
|
||||
if (res.code === 1) {
|
||||
var bannerHtml = '';
|
||||
res.banner.forEach(function (banner) {
|
||||
bannerHtml += '<div>' +
|
||||
'<div class="banner-content">' +
|
||||
'<div class="banner-image">' +
|
||||
'<img src="' + banner.image + '" alt="' + (banner.title || '') + '">' +
|
||||
'</div>' +
|
||||
'<div class="banner-text">' +
|
||||
'<span class="banner-title">' + (banner.title || '') + '</span>' +
|
||||
'<span class="banner-desc">' + (banner.desc || '') + '</span>' +
|
||||
'<a href="' + (banner.url || 'javascript:;') + '" class="banner-slide">' +
|
||||
'<span class="banner-btn">查看详情</span>' +
|
||||
'</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
});
|
||||
$('#test10 div[carousel-item]').html(bannerHtml);
|
||||
|
||||
// 图片轮播
|
||||
carousel.render({
|
||||
elem: '#test10',
|
||||
width: '100%',
|
||||
height: '100vh',
|
||||
interval: 4000,
|
||||
anim: 'fade',
|
||||
autoplay: true,
|
||||
full: false,
|
||||
arrow: 'hover'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
// 主导航头像
|
||||
$("#userAvatarMain").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownMain").toggleClass("show");
|
||||
$("#userDropdownSticky").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
// 固定导航头像
|
||||
$("#userAvatarSticky").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownSticky").toggleClass("show");
|
||||
$("#userDropdownMain").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
|
||||
// 点击页面其他地方隐藏所有菜单
|
||||
$(document).click(function (e) {
|
||||
if (!$(e.target).closest('.user-dropdown, #userAvatarMain, #userAvatarSticky').length) {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
}
|
||||
});
|
||||
|
||||
// 点击菜单项时隐藏菜单
|
||||
$("#userDropdownMain li a, #userDropdownSticky li a").click(function () {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
});
|
||||
});
|
||||
|
||||
// 退出登录
|
||||
$('.logout-btn').on('click', function () {
|
||||
layer.confirm('确定要退出登录吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
window.location.href = '/index/user/logout';
|
||||
});
|
||||
});
|
||||
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function () {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
if (scrollTop > 150) { // 当滚动超过150px时显示固定导航
|
||||
$('.sticky-nav').fadeIn();
|
||||
} else {
|
||||
$('.sticky-nav').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// 公众号二维码
|
||||
const trigger = document.querySelector('.qrcode-trigger');
|
||||
const popup = document.querySelector('.qrcode-popup');
|
||||
|
||||
// 鼠标移入显示二维码
|
||||
trigger.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出隐藏二维码
|
||||
trigger.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
|
||||
// 鼠标移入二维码区域时保持显示
|
||||
popup.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出二维码区域时隐藏
|
||||
popup.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="main">
|
||||
<div class="main-top">
|
||||
<div class="main-top-main">
|
||||
@ -489,11 +972,17 @@
|
||||
<div class="game-info">
|
||||
<div class="title">Free</div>
|
||||
<div class="infos">
|
||||
<div class="infoitem"><span>更新时间:</span><?php echo date('Y-m-d', $game['create_time']); ?></div>
|
||||
<div class="infoitem"><span>所属分类:</span><?php echo $cateName; ?></div>
|
||||
<div class="infoitem"><span>程序编号:</span><?php echo $game['number']; ?></div>
|
||||
<div class="infoitem"><span>查看:</span><?php echo $game['views']; ?></div>
|
||||
<div class="infoitem"><span>下载:</span><?php echo $game['downloads']; ?></div>
|
||||
<div class="infoitem"><span>更新时间:</span><span
|
||||
class="infoitem-value"><?php echo date('Y-m-d', $game['create_time']); ?></span>
|
||||
</div>
|
||||
<div class="infoitem"><span>所属分类:</span><span
|
||||
class="infoitem-value"><?php echo $cateName; ?></span></div>
|
||||
<div class="infoitem"><span>程序编号:</span><span
|
||||
class="infoitem-value"><?php echo $game['number']; ?></span></div>
|
||||
<div class="infoitem"><span>查看:</span><span
|
||||
class="infoitem-value"><?php echo $game['views']; ?></span></div>
|
||||
<div class="infoitem"><span>下载:</span><span
|
||||
class="infoitem-value"><?php echo $game['downloads']; ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -635,6 +1124,10 @@
|
||||
<p class="copyright__text">Copyright <span class="dynamic-year">2025</span> | All Rights By <a
|
||||
href="http://www.yunzer.cn">Yunzer</a></p>
|
||||
</div>
|
||||
<div class="container wow fadeInUp animated" data-wow-delay="400ms"
|
||||
style="visibility: visible; animation-delay: 400ms; animation-name: fadeInUp;">
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow"><?php echo htmlentities((string) $config['admin_icp']); ?></a>
|
||||
</div>
|
||||
<div class="tongji">
|
||||
<script id="LA-DATA-WIDGET" crossorigin="anonymous" charset="UTF-8"
|
||||
src="https://v6-widget.51.la/v6/KoyzaWWEcLvPzkQn/quote.js?theme=#1690FF,#FFFFFF,#999999,#FFFFFF,#FFFFFF,#1690FF,12&f=12"></script>
|
||||
@ -1205,6 +1698,14 @@
|
||||
.disclaimer-content p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.infoitem-value {
|
||||
border: 1px #0d6efd dashed;
|
||||
padding: 3px 6px;
|
||||
font-size: 13px;
|
||||
background-color: #0081ff12;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</body>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user