更新程序界面和后端
This commit is contained in:
parent
3a54244afb
commit
204c388de6
@ -451,7 +451,7 @@ function initVisitTrend() {
|
|||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: {$chartData.visitTrend.dates|json_encode},
|
data: {$chartData.visitTrend.dates|json_encode|raw},
|
||||||
axisLine: {
|
axisLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: '#e2e8f0'
|
color: '#e2e8f0'
|
||||||
@ -473,7 +473,7 @@ function initVisitTrend() {
|
|||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: '访问量',
|
name: '访问量',
|
||||||
data: {$chartData.visitTrend.visits|json_encode},
|
data: {$chartData.visitTrend.visits|json_encode|raw},
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
@ -487,7 +487,7 @@ function initVisitTrend() {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: '独立访客',
|
name: '独立访客',
|
||||||
data: {$chartData.visitTrend.uvs|json_encode},
|
data: {$chartData.visitTrend.uvs|json_encode|raw},
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
@ -526,7 +526,7 @@ function initUserGrowth() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.userGrowth.dates|json_encode}
|
data: {$chartData.userGrowth.dates|json_encode|raw}
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@ -535,7 +535,7 @@ function initUserGrowth() {
|
|||||||
{
|
{
|
||||||
name: '新增用户',
|
name: '新增用户',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.userGrowth.newUsers|json_encode},
|
data: {$chartData.userGrowth.newUsers|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ function initUserGrowth() {
|
|||||||
name: '总用户数',
|
name: '总用户数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.userGrowth.totalUsers|json_encode},
|
data: {$chartData.userGrowth.totalUsers|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
},
|
},
|
||||||
@ -582,7 +582,7 @@ function initResourceStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.resourceStats.dates|json_encode}
|
data: {$chartData.resourceStats.dates|json_encode|raw}
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@ -591,7 +591,7 @@ function initResourceStats() {
|
|||||||
{
|
{
|
||||||
name: '新增资源',
|
name: '新增资源',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.resourceStats.newResources|json_encode},
|
data: {$chartData.resourceStats.newResources|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
@ -600,7 +600,7 @@ function initResourceStats() {
|
|||||||
name: '总资源数',
|
name: '总资源数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.resourceStats.totalResources|json_encode},
|
data: {$chartData.resourceStats.totalResources|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
},
|
},
|
||||||
@ -612,7 +612,7 @@ function initResourceStats() {
|
|||||||
name: '下载量',
|
name: '下载量',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.resourceStats.downloads|json_encode},
|
data: {$chartData.resourceStats.downloads|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#f59e0b'
|
color: '#f59e0b'
|
||||||
},
|
},
|
||||||
@ -650,7 +650,7 @@ function initArticleStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.articleStats.dates|json_encode}
|
data: {$chartData.articleStats.dates|json_encode|raw}
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@ -659,7 +659,7 @@ function initArticleStats() {
|
|||||||
{
|
{
|
||||||
name: '新增文章',
|
name: '新增文章',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.articleStats.newArticles|json_encode},
|
data: {$chartData.articleStats.newArticles|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
@ -668,7 +668,7 @@ function initArticleStats() {
|
|||||||
name: '总文章数',
|
name: '总文章数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.articleStats.totalArticles|json_encode},
|
data: {$chartData.articleStats.totalArticles|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
},
|
},
|
||||||
@ -680,7 +680,7 @@ function initArticleStats() {
|
|||||||
name: '浏览量',
|
name: '浏览量',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.articleStats.views|json_encode},
|
data: {$chartData.articleStats.views|json_encode|raw},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#f59e0b'
|
color: '#f59e0b'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -90,6 +90,19 @@ class ProgramController extends BaseController
|
|||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
// 处理每个资源的size
|
||||||
|
foreach ($programs as &$program) {
|
||||||
|
if (empty($program['size'])) {
|
||||||
|
// 从Attachments表中查找对应的src
|
||||||
|
$attachment = Attachments::where('src', $program['icon'])
|
||||||
|
->field('size')
|
||||||
|
->find();
|
||||||
|
if ($attachment) {
|
||||||
|
$program['size'] = $attachment['size'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 按子分类分组资源
|
// 按子分类分组资源
|
||||||
$groupedPrograms = [];
|
$groupedPrograms = [];
|
||||||
foreach ($subCategories as $subCategory) {
|
foreach ($subCategories as $subCategory) {
|
||||||
@ -125,20 +138,19 @@ class ProgramController extends BaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 根据请求方式返回不同的输出
|
// 根据请求方式返回不同的输出
|
||||||
if (request()->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
return json([
|
return json([
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
'msg' => '获取成功',
|
'msg' => '获取成功',
|
||||||
'data' => $data
|
'data' => $data
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
// 为视图准备数据
|
|
||||||
$viewData = [
|
|
||||||
'categories' => $categories,
|
|
||||||
'cate' => $data['cate']
|
|
||||||
];
|
|
||||||
return view('index', $viewData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET请求渲染页面
|
||||||
|
return view('index', [
|
||||||
|
'categories' => $categories,
|
||||||
|
'cate' => $data['cate']
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 程序列表页
|
// 程序列表页
|
||||||
@ -212,43 +224,19 @@ class ProgramController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 程序详情页
|
// 程序详情页
|
||||||
public function detail()
|
public function detail($id)
|
||||||
{
|
{
|
||||||
$id = Request::param('id/d', 0);
|
// 获取资源详情
|
||||||
$program = Resources::where('id', $id)->find();
|
$program = Resources::where('id', $id)
|
||||||
|
->where('delete_time', null)
|
||||||
|
->where('status', 1)
|
||||||
|
->find();
|
||||||
|
|
||||||
if (!$program) {
|
if (!$program) {
|
||||||
return json(['code' => 0, 'msg' => '程序不存在或已被删除']);
|
if ($this->request->isPost()) {
|
||||||
}
|
return json(['code' => 0, 'msg' => '资源不存在']);
|
||||||
|
|
||||||
// 如果size没有,从附件表中获取
|
|
||||||
if (empty($program['size']) && !empty($program['fileurl'])) {
|
|
||||||
$attachment = Attachments::where('src', $program['fileurl'])
|
|
||||||
->find();
|
|
||||||
|
|
||||||
if ($attachment && !empty($attachment['size'])) {
|
|
||||||
$size = $attachment['size'];
|
|
||||||
// 转换文件大小为合适的单位
|
|
||||||
if ($size >= 1073741824) { // 1GB = 1024MB = 1024*1024KB = 1024*1024*1024B
|
|
||||||
$program['size'] = round($size / 1073741824, 2) . 'GB';
|
|
||||||
} elseif ($size >= 1048576) { // 1MB = 1024KB = 1024*1024B
|
|
||||||
$program['size'] = round($size / 1048576, 2) . 'MB';
|
|
||||||
} else {
|
|
||||||
$program['size'] = round($size / 1024, 2) . 'KB';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果size存在,确保转换为合适的单位
|
|
||||||
if (!empty($program['size']) && is_numeric($program['size'])) {
|
|
||||||
$size = $program['size'];
|
|
||||||
if ($size >= 1073741824) {
|
|
||||||
$program['size'] = round($size / 1073741824, 2) . 'GB';
|
|
||||||
} elseif ($size >= 1048576) {
|
|
||||||
$program['size'] = round($size / 1048576, 2) . 'MB';
|
|
||||||
} else {
|
|
||||||
$program['size'] = round($size / 1024, 2) . 'KB';
|
|
||||||
}
|
}
|
||||||
|
$this->error('资源不存在');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取分类名称
|
// 获取分类名称
|
||||||
@ -256,26 +244,33 @@ class ProgramController extends BaseController
|
|||||||
->value('name');
|
->value('name');
|
||||||
|
|
||||||
// 获取作者信息
|
// 获取作者信息
|
||||||
$authorInfo = Users::where('name', $program['uploader'])->find();
|
$uploaderInfo = [
|
||||||
if ($authorInfo) {
|
'name' => $program['uploader'],
|
||||||
// 统计作者的文章数
|
'avatar' => $program['icon'],
|
||||||
$articleCount = Articles::where('author', $program['uploader'])->count();
|
'resource_count' => Resources::where('uploader', $program['uploader'])->count(),
|
||||||
// 统计作者的资源数
|
'article_count' => 0
|
||||||
$resourceCount = Resources::where('uploader', $program['uploader'])->count();
|
];
|
||||||
|
|
||||||
$authorData = [
|
// 处理资源size
|
||||||
'avatar' => $authorInfo['avatar'] ?: '/static/images/avatar.png',
|
if (empty($program['size'])) {
|
||||||
'name' => $authorInfo['name'],
|
$attachment = Attachments::where('src', $program['icon'])
|
||||||
'resource_count' => $resourceCount,
|
->field('size')
|
||||||
'article_count' => $articleCount
|
->find();
|
||||||
];
|
if ($attachment) {
|
||||||
} else {
|
$program['size'] = $attachment['size'];
|
||||||
$authorData = [
|
}
|
||||||
'avatar' => '/static/images/avatar.png',
|
}
|
||||||
'name' => $program['uploader'],
|
|
||||||
'resource_count' => 0,
|
// 转换文件大小为合适的单位
|
||||||
'article_count' => 0
|
if (!empty($program['size']) && is_numeric($program['size'])) {
|
||||||
];
|
$size = $program['size'];
|
||||||
|
if ($size >= 1073741824) { // 1GB = 1024MB = 1024*1024KB = 1024*1024*1024B
|
||||||
|
$program['size'] = round($size / 1073741824, 2) . 'GB';
|
||||||
|
} elseif ($size >= 1048576) { // 1MB = 1024KB = 1024*1024B
|
||||||
|
$program['size'] = round($size / 1048576, 2) . 'MB';
|
||||||
|
} else {
|
||||||
|
$program['size'] = round($size / 1024, 2) . 'KB';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取上一个和下一个程序
|
// 获取上一个和下一个程序
|
||||||
@ -312,33 +307,27 @@ class ProgramController extends BaseController
|
|||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 如果是 AJAX 请求,返回 JSON 数据
|
// 准备返回数据
|
||||||
if (Request::isAjax()) {
|
$data = [
|
||||||
return json([
|
|
||||||
'code' => 1,
|
|
||||||
'msg' => '获取成功',
|
|
||||||
'data' => [
|
|
||||||
'authorInfo' => $authorData,
|
|
||||||
'program' => $program,
|
|
||||||
'cateName' => $cateName,
|
|
||||||
'prevProgram' => $prevProgram,
|
|
||||||
'nextProgram' => $nextProgram,
|
|
||||||
'relatedPrograms' => $relatedPrograms
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 非 AJAX 请求返回视图
|
|
||||||
View::assign([
|
|
||||||
'authorInfo' => $authorData,
|
|
||||||
'program' => $program,
|
'program' => $program,
|
||||||
|
'uploaderInfo' => $uploaderInfo,
|
||||||
'cateName' => $cateName,
|
'cateName' => $cateName,
|
||||||
'prevProgram' => $prevProgram,
|
'prevProgram' => $prevProgram,
|
||||||
'nextProgram' => $nextProgram,
|
'nextProgram' => $nextProgram,
|
||||||
'relatedPrograms' => $relatedPrograms
|
'relatedPrograms' => $relatedPrograms
|
||||||
]);
|
];
|
||||||
|
|
||||||
return View::fetch('detail');
|
// 根据请求方式返回不同的输出
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
return json([
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => '获取成功',
|
||||||
|
'data' => $data
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET请求渲染页面
|
||||||
|
return view('', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 程序下载
|
// 程序下载
|
||||||
|
|||||||
@ -16,9 +16,11 @@
|
|||||||
<h1 class="program-title">{$program.title}</h1>
|
<h1 class="program-title">{$program.title}</h1>
|
||||||
<div class="program-meta">
|
<div class="program-meta">
|
||||||
<span class="program-author"><i class="fa fa-user"></i> <span>{$program.author}</span></span>
|
<span class="program-author"><i class="fa fa-user"></i> <span>{$program.author}</span></span>
|
||||||
<span class="program-date"><i class="fa fa-calendar"></i> <span>{$program.create_time|date="Y-m-d"}</span></span>
|
<span class="program-date"><i class="fa fa-calendar"></i>
|
||||||
|
<span>{$program.create_time|date="Y-m-d"}</span></span>
|
||||||
<span class="program-views"><i class="fa-solid fa-eye"></i> <span>{$program.views}</span> 阅读</span>
|
<span class="program-views"><i class="fa-solid fa-eye"></i> <span>{$program.views}</span> 阅读</span>
|
||||||
<span class="program-downloads"><i class="fa-solid fa-download"></i> <span>{$program.downloads}</span> 下载</span>
|
<span class="program-downloads"><i class="fa-solid fa-download"></i>
|
||||||
|
<span>{$program.downloads}</span> 下载</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -107,25 +109,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="program-detail-right">
|
<div class="program-detail-right">
|
||||||
<div class="aboutauthor">
|
<div class="aboutauthor">
|
||||||
<div class="aboutauthor-title">关于作者</div>
|
<!-- <div class="aboutauthor-title">关于作者</div> -->
|
||||||
<div class="aboutauthor-main">
|
<div class="aboutauthor-main">
|
||||||
<div class="aboutauthor-main-top">
|
<div class="aboutauthor-main-top">
|
||||||
<div class="aboutauthor-avatar">
|
<div class="aboutauthor-avatar">
|
||||||
<img src="{$authorInfo.avatar}" alt="作者头像">
|
<img src="{$uploaderInfo.avatar}" alt="作者头像">
|
||||||
</div>
|
</div>
|
||||||
<div class="aboutauthor-info">
|
<div class="aboutauthor-info">
|
||||||
<div class="author-name">{$authorInfo.name}</div>
|
<div class="author-name">{$uploaderInfo.name}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="aboutauthor-main-middle">
|
<div class="aboutauthor-main-middle">
|
||||||
<div class="author-stats">
|
<div class="author-stats">
|
||||||
<div class="author-stats-item">
|
<div class="author-stats-item">
|
||||||
<h6>资源</h6>
|
<h6>资源</h6>
|
||||||
<span class="count">{$authorInfo.resource_count}</span>
|
<span class="count">{$uploaderInfo.resource_count}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="author-stats-item">
|
<div class="author-stats-item">
|
||||||
<h6>文章</h6>
|
<h6>文章</h6>
|
||||||
<span class="count">{$authorInfo.article_count}</span>
|
<span class="count">{$uploaderInfo.article_count}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="author-stats-item">
|
<div class="author-stats-item">
|
||||||
<h6>粉丝</h6>
|
<h6>粉丝</h6>
|
||||||
@ -143,6 +145,56 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="infos">
|
||||||
|
<!-- <div class="infos-title">下载</div> -->
|
||||||
|
<div class="infos-main">
|
||||||
|
<div class="infos-main-top">
|
||||||
|
<div class="infos-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">软件编码:</span>
|
||||||
|
<span>{$program.number}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">软件大小:</span>
|
||||||
|
<span>{$program.size|default='未知'}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">更新时间:</span>
|
||||||
|
<span>{$program.create_time|date="Y-m-d"}</span>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="info-item">
|
||||||
|
<span class="info-label">软件版本:</span>
|
||||||
|
<span>{$program.version|default='1.0.0'}</span>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="infos-main-middle">
|
||||||
|
<div class="infos-stats">
|
||||||
|
<div class="infos-stats-item">
|
||||||
|
<h6>下载</h6>
|
||||||
|
<a href="{$program.url}" target="_blank">点击下载</a>
|
||||||
|
</div>
|
||||||
|
<div class="infos-stats-item">
|
||||||
|
<h6>分享码</h6>
|
||||||
|
{if $program.code}
|
||||||
|
<a href="">{$program.code}</a>
|
||||||
|
{else}
|
||||||
|
<span>-</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="infos-stats-item">
|
||||||
|
<h6>解压密码</h6>
|
||||||
|
{if $program.zipcode}
|
||||||
|
<a href="">{$program.zipcode}</a>
|
||||||
|
{else}
|
||||||
|
<span>-</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -221,6 +273,66 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const authorSection = document.querySelector('.aboutauthor');
|
||||||
|
const downloadSection = document.querySelector('.infos');
|
||||||
|
const originalOffset = authorSection.offsetTop;
|
||||||
|
const parentContainer = authorSection.parentElement;
|
||||||
|
const parentRect = parentContainer.getBoundingClientRect();
|
||||||
|
|
||||||
|
// 创建一个占位元素,防止内容跳动
|
||||||
|
const placeholder = document.createElement('div');
|
||||||
|
placeholder.style.height = (authorSection.offsetHeight + downloadSection.offsetHeight + 30) + 'px'; // 30px是间距
|
||||||
|
placeholder.style.display = 'none';
|
||||||
|
parentContainer.insertBefore(placeholder, authorSection);
|
||||||
|
|
||||||
|
function handleScroll() {
|
||||||
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||||
|
const parentTop = parentRect.top + scrollTop;
|
||||||
|
const parentBottom = parentTop + parentRect.height;
|
||||||
|
const totalHeight = authorSection.offsetHeight + downloadSection.offsetHeight + 30; // 30px是间距
|
||||||
|
|
||||||
|
// 当作者信息区域到达父容器顶部时
|
||||||
|
if (scrollTop > originalOffset) {
|
||||||
|
// 检查是否到达父容器底部
|
||||||
|
if (scrollTop + totalHeight + 20 > parentBottom) {
|
||||||
|
authorSection.style.position = 'absolute';
|
||||||
|
downloadSection.style.position = 'absolute';
|
||||||
|
authorSection.style.top = (parentRect.height - totalHeight) + 'px';
|
||||||
|
downloadSection.style.top = (parentRect.height - downloadSection.offsetHeight) + 'px';
|
||||||
|
authorSection.classList.remove('sticky');
|
||||||
|
downloadSection.classList.remove('sticky');
|
||||||
|
} else {
|
||||||
|
authorSection.style.position = 'fixed';
|
||||||
|
downloadSection.style.position = 'fixed';
|
||||||
|
authorSection.style.top = '100px';
|
||||||
|
downloadSection.style.top = (100 + authorSection.offsetHeight + 30) + 'px'; // 30px是间距
|
||||||
|
authorSection.style.width = '350px';
|
||||||
|
downloadSection.style.width = '350px';
|
||||||
|
authorSection.classList.add('sticky');
|
||||||
|
downloadSection.classList.add('sticky');
|
||||||
|
placeholder.style.display = 'block';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
authorSection.style.position = 'static';
|
||||||
|
downloadSection.style.position = 'static';
|
||||||
|
authorSection.classList.remove('sticky');
|
||||||
|
downloadSection.classList.remove('sticky');
|
||||||
|
placeholder.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听滚动事件
|
||||||
|
window.addEventListener('scroll', handleScroll);
|
||||||
|
// 监听窗口大小改变事件
|
||||||
|
window.addEventListener('resize', function () {
|
||||||
|
parentRect = parentContainer.getBoundingClientRect();
|
||||||
|
handleScroll();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.location {
|
.location {
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
@ -270,8 +382,8 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 20px !important;
|
padding-left: 20px !important;
|
||||||
padding: 20px 0;
|
/* padding: 20px 0; */
|
||||||
border-bottom: 1px solid #efefef;
|
/* border-bottom: 1px solid #efefef; */
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +430,7 @@
|
|||||||
.main .body-container .program-detail-right .aboutauthor-btn {
|
.main .body-container .program-detail-right .aboutauthor-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
padding: 20px 0;
|
/* padding: 20px 0; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.main .body-container .program-detail-right .aboutauthor-btn .follow-btn {
|
.main .body-container .program-detail-right .aboutauthor-btn .follow-btn {
|
||||||
@ -386,6 +498,11 @@
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-item span {
|
||||||
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-label {
|
.info-label {
|
||||||
@ -599,6 +716,187 @@
|
|||||||
.disclaimer-content p {
|
.disclaimer-content p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
|
.aboutauthor {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor.sticky {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
width: calc(300px - 40px);
|
||||||
|
/* 假设父容器宽度为300px,减去padding */
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-main-top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-avatar {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-avatar img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-name {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding: 15px 0;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-stats-item {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-stats-item h6 {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-stats-item .count {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-btn {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-btn button {
|
||||||
|
flex: 1;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-btn {
|
||||||
|
background: #3881fd;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-btn:hover {
|
||||||
|
background: #2c5fd9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn {
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #333;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn:hover {
|
||||||
|
background: #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aboutauthor-btn i {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos.sticky {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 100;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos {
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-top: 30px;
|
||||||
|
padding: 20px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-main {}
|
||||||
|
|
||||||
|
.infos-main-top {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-title {
|
||||||
|
height: 60px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-left: 20px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-main-middle {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
border-top: 1px solid #efefef;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-stats-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-stats-item h6 {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos-btn-blue {
|
||||||
|
background-color: #0081ff;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
{include file="component/foot" /}
|
{include file="component/foot" /}
|
||||||
Loading…
x
Reference in New Issue
Block a user