增加友链功能
This commit is contained in:
1 parent
e46a4100c7
commit
1f8d876cef
9 files changed
+503
-83
No files matched your search
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller\Cms\Friendlink;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use think\response\Json;
|
||||
use app\model\Cms\Friendlink;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 友情链接管理控制器
|
||||
*/
|
||||
class FriendlinkController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 获取友情链接列表
|
||||
* @return Json
|
||||
*/
|
||||
public function getList(): Json
|
||||
{
|
||||
try {
|
||||
$page = (int)$this->request->param('page', 1);
|
||||
$limit = (int)$this->request->param('limit', 10);
|
||||
$keyword = $this->request->param('keyword', '');
|
||||
$status = $this->request->param('status', '');
|
||||
|
||||
$query = Friendlink::where('delete_time', null)
|
||||
->where('tid', $this->getTenantId());
|
||||
|
||||
// 关键词搜索
|
||||
if (!empty($keyword)) {
|
||||
$query->where('link_name', 'like', '%' . $keyword . '%');
|
||||
}
|
||||
|
||||
// 状态筛选
|
||||
if ($status !== '') {
|
||||
$query->where('status', (int)$status);
|
||||
}
|
||||
|
||||
$total = $query->count();
|
||||
$list = $query->order('sort', 'asc')
|
||||
->order('id', 'desc')
|
||||
->page($page, $limit)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'data' => [
|
||||
'list' => $list,
|
||||
'total' => $total
|
||||
]
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '获取失败:' . $e->getMessage(),
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有友情链接(用于下拉选择)
|
||||
* @return Json
|
||||
*/
|
||||
public function getAll(): Json
|
||||
{
|
||||
try {
|
||||
$list = Friendlink::where('delete_time', null)
|
||||
->where('tid', $this->getTenantId())
|
||||
->where('status', 1)
|
||||
->order('sort', 'asc')
|
||||
->field('id,link_name')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'data' => $list
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '获取失败:' . $e->getMessage(),
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加友情链接
|
||||
* @return Json
|
||||
*/
|
||||
public function add(): Json
|
||||
{
|
||||
try {
|
||||
$data = $this->request->param();
|
||||
|
||||
// 验证参数
|
||||
$this->validate($data, [
|
||||
'link_name|链接名称' => 'require|max:100',
|
||||
'link_url|链接地址' => 'require|url|max:255',
|
||||
'sort|排序' => 'integer',
|
||||
'status|状态' => 'in:0,1'
|
||||
]);
|
||||
|
||||
$friendlink = new Friendlink();
|
||||
$friendlink->tid = $this->getTenantId();
|
||||
$friendlink->link_name = $data['link_name'];
|
||||
$friendlink->link_url = $data['link_url'];
|
||||
$friendlink->link_logo = $data['link_logo'] ?? '';
|
||||
$friendlink->description = $data['description'] ?? '';
|
||||
$friendlink->sort = $data['sort'] ?? 0;
|
||||
$friendlink->status = $data['status'] ?? 1;
|
||||
$friendlink->create_time = date('Y-m-d H:i:s');
|
||||
$friendlink->save();
|
||||
|
||||
$this->logSuccess('友情链接', '添加链接', ['id' => $friendlink->id]);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '添加成功',
|
||||
'data' => $friendlink->toArray()
|
||||
]);
|
||||
} catch (ValidateException $e) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => $e->getError()
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logFail('友情链接', '添加链接', $e->getMessage());
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '添加失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新友情链接
|
||||
* @param int $id
|
||||
* @return Json
|
||||
*/
|
||||
public function update(int $id): Json
|
||||
{
|
||||
try {
|
||||
$data = $this->request->param();
|
||||
|
||||
$friendlink = Friendlink::where('id', $id)
|
||||
->where('tid', $this->getTenantId())
|
||||
->where('delete_time', null)
|
||||
->find();
|
||||
|
||||
if (!$friendlink) {
|
||||
return json([
|
||||
'code' => 404,
|
||||
'msg' => '链接不存在'
|
||||
]);
|
||||
}
|
||||
|
||||
// 验证参数
|
||||
if (isset($data['link_name'])) {
|
||||
$this->validate($data, [
|
||||
'link_name|链接名称' => 'require|max:100'
|
||||
]);
|
||||
}
|
||||
if (isset($data['link_url'])) {
|
||||
$this->validate($data, [
|
||||
'link_url|链接地址' => 'require|url|max:255'
|
||||
]);
|
||||
}
|
||||
|
||||
if (isset($data['link_name'])) $friendlink->link_name = $data['link_name'];
|
||||
if (isset($data['link_url'])) $friendlink->link_url = $data['link_url'];
|
||||
if (isset($data['link_logo'])) $friendlink->link_logo = $data['link_logo'];
|
||||
if (isset($data['description'])) $friendlink->description = $data['description'];
|
||||
if (isset($data['sort'])) $friendlink->sort = $data['sort'];
|
||||
if (isset($data['status'])) $friendlink->status = $data['status'];
|
||||
$friendlink->update_time = date('Y-m-d H:i:s');
|
||||
$friendlink->save();
|
||||
|
||||
$this->logSuccess('友情链接', '更新链接', ['id' => $id]);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '更新成功',
|
||||
'data' => $friendlink->toArray()
|
||||
]);
|
||||
} catch (ValidateException $e) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => $e->getError()
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logFail('友情链接', '更新链接', $e->getMessage());
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '更新失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除友情链接
|
||||
* @param int $id
|
||||
* @return Json
|
||||
*/
|
||||
public function delete(int $id): Json
|
||||
{
|
||||
try {
|
||||
$friendlink = Friendlink::where('id', $id)
|
||||
->where('tid', $this->getTenantId())
|
||||
->where('delete_time', null)
|
||||
->find();
|
||||
|
||||
if (!$friendlink) {
|
||||
return json([
|
||||
'code' => 404,
|
||||
'msg' => '链接不存在'
|
||||
]);
|
||||
}
|
||||
|
||||
$friendlink->delete();
|
||||
|
||||
$this->logSuccess('友情链接', '删除链接', ['id' => $id]);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '删除成功'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logFail('友情链接', '删除链接', $e->getMessage());
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '删除失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除友情链接
|
||||
* @return Json
|
||||
*/
|
||||
public function batchDelete(): Json
|
||||
{
|
||||
try {
|
||||
$ids = $this->request->param('ids', []);
|
||||
|
||||
if (empty($ids)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '请选择要删除的链接'
|
||||
]);
|
||||
}
|
||||
|
||||
Friendlink::whereIn('id', $ids)
|
||||
->where('tid', $this->getTenantId())
|
||||
->where('delete_time', null)
|
||||
->update(['delete_time' => date('Y-m-d H:i:s')]);
|
||||
|
||||
$this->logSuccess('友情链接', '批量删除链接', ['ids' => $ids]);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '批量删除成功'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logFail('友情链接', '批量删除链接', $e->getMessage());
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '批量删除失败:' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
use think\facade\Route;
|
||||
|
||||
// 友情链接路由
|
||||
Route::get('friendlinks', 'app\admin\controller\Cms\Friendlink\FriendlinkController@getList');
|
||||
Route::get('friendlinks/all', 'app\admin\controller\Cms\Friendlink\FriendlinkController@getAll');
|
||||
Route::post('friendlinks', 'app\admin\controller\Cms\Friendlink\FriendlinkController@add');
|
||||
Route::put('friendlinks/:id', 'app\admin\controller\Cms\Friendlink\FriendlinkController@update');
|
||||
Route::delete('friendlinks/:id', 'app\admin\controller\Cms\Friendlink\FriendlinkController@delete');
|
||||
Route::post('friendlinks/batchdelete', 'app\admin\controller\Cms\Friendlink\FriendlinkController@batchDelete');
|
||||
@@ -109,6 +109,33 @@ abstract class BaseController
|
||||
return $this->tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据域名获取租户ID(静态方法,方便全局调用)
|
||||
* @return int
|
||||
*/
|
||||
public static function getTenantIdByDomain(): int
|
||||
{
|
||||
$request = request();
|
||||
|
||||
// 优先从 Referer 获取来源域名(跨域调用场景)
|
||||
$referer = $request->header('Referer');
|
||||
if ($referer) {
|
||||
$host = parse_url($referer, PHP_URL_HOST);
|
||||
} else {
|
||||
// 否则使用当前访问域名
|
||||
$host = $request->host(true);
|
||||
}
|
||||
|
||||
// 查询域名对应的租户ID
|
||||
$tenantDomain = Db::name('mete_tenant_domain')
|
||||
->where('full_domain', $host)
|
||||
->where('status', 1)
|
||||
->whereNull('delete_time')
|
||||
->find();
|
||||
|
||||
return $tenantDomain ? (int)$tenantDomain['tid'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @access protected
|
||||
|
||||
@@ -14,8 +14,7 @@ use think\db\exception\DbException;
|
||||
use think\facade\Env;
|
||||
use think\facade\Request;
|
||||
use app\model\Cms\TemplateSiteConfig;
|
||||
use app\model\Tenant\Tenant;
|
||||
use app\model\Cms\Demand;
|
||||
use app\model\Cms\Friendlink;
|
||||
|
||||
class Index extends BaseController
|
||||
{
|
||||
@@ -351,24 +350,35 @@ class Index extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业信息
|
||||
* 获取友情链接列表
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function getCompanyInfos()
|
||||
public function getFriendlinkList()
|
||||
{
|
||||
// 从基类获取租户ID
|
||||
$tid = $this->tenantId;
|
||||
|
||||
try {
|
||||
$companyInfo = Tenant::where('delete_time', null)
|
||||
->where('id', $tid)
|
||||
->field('contact_phone, contact_email, address, worktime')
|
||||
->find();
|
||||
// 通过域名获取租户ID
|
||||
$tid = BaseController::getTenantIdByDomain();
|
||||
|
||||
if (empty($tid)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '无法识别租户信息',
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
|
||||
$friendlinkList = Friendlink::where('delete_time', null)
|
||||
->where('tid', $tid)
|
||||
->where('status', 1)
|
||||
->order('sort', 'asc')
|
||||
->field('id,link_name,link_url,link_logo,description')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'data' => $companyInfo ?: null
|
||||
'data' => $friendlinkList
|
||||
]);
|
||||
} catch (DbException $e) {
|
||||
return json([
|
||||
@@ -378,66 +388,4 @@ class Index extends BaseController
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户需求接口
|
||||
* post /index/requirement
|
||||
* @param string $title 标题
|
||||
* @param string $desc 描述
|
||||
* @param string $applicant 申请人
|
||||
* @param string $phone 手机号
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function requirement()
|
||||
{
|
||||
// 获取参数
|
||||
$title = Request::param('title', '');
|
||||
$desc = Request::param('desc', '');
|
||||
$applicant = Request::param('applicant', '');
|
||||
$phone = Request::param('phone', '');
|
||||
|
||||
// 验证必填字段
|
||||
if (empty($title)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '标题不能为空',
|
||||
'data' => null
|
||||
]);
|
||||
}
|
||||
if (empty($desc)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '描述不能为空',
|
||||
'data' => null
|
||||
]);
|
||||
}
|
||||
|
||||
// 从基类获取租户ID
|
||||
$tid = $this->tenantId;
|
||||
|
||||
try {
|
||||
// 保存到需求表
|
||||
$id = Demand::insertGetId([
|
||||
'tid' => $tid,
|
||||
'title' => $title,
|
||||
'desc' => $desc,
|
||||
'applicant' => $applicant,
|
||||
'phone' => $phone,
|
||||
'status' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '提交成功',
|
||||
'data' => ['id' => $id]
|
||||
]);
|
||||
} catch (DbException $e) {
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => '提交失败:' . $e->getMessage(),
|
||||
'data' => null
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ Route::get('init', 'app\index\controller\Index@init');
|
||||
Route::get('footerdata', 'app\index\controller\Index@getFooterData');
|
||||
Route::get('companyInfos', 'app\index\controller\Index@getCompanyInfos');
|
||||
Route::post('requirement', 'app\index\controller\Index@requirement');
|
||||
Route::get('friendlinks', 'app\index\controller\Index@getFriendlinkList');
|
||||
|
||||
// --- 客户需求路由 ---
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\model\Cms;
|
||||
|
||||
use think\Model;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 文章分类模型
|
||||
*/
|
||||
class Friendlink extends Model
|
||||
{
|
||||
// 启用软删除
|
||||
use SoftDelete;
|
||||
|
||||
// 数据库表名
|
||||
protected $name = 'mete_apps_cms_friendlink';
|
||||
|
||||
// 字段类型转换
|
||||
protected $type = [
|
||||
'id' => 'integer',
|
||||
'tid' => 'integer',
|
||||
'link_name' => 'string',
|
||||
'link_url' => 'string',
|
||||
'link_logo' => 'string',
|
||||
'description' => 'string',
|
||||
'sort' => 'integer',
|
||||
'status' => 'integer',
|
||||
'create_time' => 'datetime',
|
||||
'update_time' => 'datetime',
|
||||
'delete_time' => 'datetime',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Swiper 11.2.10
|
||||
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||
* https://swiperjs.com
|
||||
*
|
||||
* Copyright 2014-2025 Vladimir Kharlampidi
|
||||
*
|
||||
* Released under the MIT License
|
||||
*
|
||||
* Released on: June 28, 2025
|
||||
*/
|
||||
|
||||
@font-face{font-family:swiper-icons;src:url('data:application/font-woff;charset=utf-8;base64, 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');font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d .swiper-slide{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-cLine truncated
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Swiper 11.2.10
|
||||
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||
* https://swiperjs.com
|
||||
*
|
||||
* Copyright 2014-2025 Vladimir Kharlampidi
|
||||
*
|
||||
* Released under the MIT License
|
||||
*
|
||||
* Released on: June 28, 2025
|
||||
*/
|
||||
|
||||
var Swiper=function(){"use strict";function e(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function t(s,a){void 0===s&&(s={}),void 0===a&&(a={});const i=["__proto__","constructor","prototype"];Object.keys(a).filter((e=>i.indexOf(e)<0)).forEach((i=>{void 0===s[i]?s[i]=a[i]:e(a[i])&&e(s[i])&&Object.keys(a[i]).length>0&&t(s[i],a[i])}))}const s={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function a(){const e="undefined"!=typeof document?document:{};return t(e,s),e}const i={document:s,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function r(){const e="undefined"!=typeof window?window:{};return t(e,i),e}function n(e){return void 0===e&&(e=""),e.trim().split(" ").filter((e=>!!e.trim()))}function l(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function o(){return Date.now()}function d(e,t){void 0===t&&(t="x");const s=r();let a,i,n;const l=function(e){const t=r();let s;return t.getComputedStyle&&(s=t.getComputedStyle(e,null)),!s&&e.currentStyle&&(s=e.currentStyle),s||(s=e.style),s}(e);return s.WebKitCSSMatrix?(i=l.transform||l.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map((e=>e.replace(",","."))).join(", ")),n=new s.WebKitCSSMatrix("none"===i?"":i)):(n=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),a=n.toString().split(",")),"x"===t&&(i=s.WebKitCSSMatrix?n.m41:16===a.length?parseFloat(a[12]):parseFloat(a[4])),"y"===t&&(i=s.WebKitCSSMatrix?n.m42:16===a.length?parseFloat(a[13]):parseFloat(a[5])),i||0}function c(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function p(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let a=1;a<arguments.length;a+=1){const i=a<0||arguments.length<=a?void 0:arguments[a];if(null!=i&&(s=i,!("undefined"!=typeof window&&void 0!==window.HTMLElement?s instanceof HTMLElement:s&&(1===s.nodeType||11===s.nodeType)))){const s=Object.keys(Object(i)).filter((e=>t.indexOf(e)<0));for(let t=0,a=s.length;t<a;t+=1){const a=s[t],r=Object.getOwnPropertyDescriptor(i,a);void 0!==r&&r.enumerable&&(c(e[a])&&c(i[a])?i[a].__swiper__?e[a]=i[a]:p(e[a],i[a]):!c(e[a])&&c(i[a])?(e[a]={},i[a].__swiper__?e[a]=i[a]:p(e[a],i[a])):e[a]=i[a])}}}var s;return e}function u(e,t,s){e.style.setProperty(t,s)}function m(e){let{swiper:t,targetPosition:s,side:a}=e;const i=r(),n=-t.translate;let l,o=null;const d=t.params.speed;t.wrapperEl.style.scrollSnapType="none",i.cancelAnimationFrame(t.cssModeFrameID);const c=s>n?"next":"prev",p=(e,t)=>"next"===c&&e>=t||"prev"===c&&e<=t,u=()=>{l=(new Date).getTime(),null===o&&(o=l);const e=Math.max(Math.min((l-o)/d,1),0),r=.5-Math.cos(e*Math.PI)/2;let c=n+r*(s-n);if(p(c,s)&&(c=s),t.wrapperEl.scrollTo({[a]:c}),p(c,s))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout((()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[a]:c})})),void i.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=i.requestAnimationFrame(u)};u()}function h(e){return e.querySelector(".swiper-slide-transform")||e.shadowRoot&&e.shadowRoot.querySelector(".swiper-slide-transform")||e}function f(e,t){void 0===t&&(t="");const s=r(),a=[...e.children];return s.HTMLSlotElement&&e instanceof HTMLSlotElement&&a.push(...e.assignedElements()),t?a.filter((e=>e.matches(t))):a}function g(e){try{return void console.warn(e)}catch(e){}}function v(e,t){void 0===t&&(t=[]);const s=document.createElement(e);return s.classList.add(...Array.isArray(t)?t:n(t)),s}function w(e){const t=r(),s=a(),i=e.getBoundingClientRect(),n=s.body,l=e.clientTop||n.clientTop||0,o=e.clientLeft||n.clientLeft||0,d=e===t?t.scrollY:e.scrollTop,c=e===t?t.scrollX:e.scrollLeft;return{top:i.top+d-l,left:i.left+c-o}}function b(e,t){return r().getComputedStyle(e,null).getPropertyValue(t)}function y(e){let t,s=e;if(s){for(t=0;null!==(s=s.previousSibling);)1===s.nodeType&&(t+=1);return t}}function E(e,t){const s=[];let a=e.parentElement;for(;a;)t?a.matches(t)&&s.push(a):s.push(a),a=a.parentElement;rLine truncated
|
||||
//# sourceMappingURL=swiper-bundle.min.js.map
|
||||
@@ -122,7 +122,7 @@ function stripHtml($html) {
|
||||
<link rel="stylesheet" href="assets/css/lindy-uikit.css" />
|
||||
<link rel="stylesheet" href="assets/css/all.min.css" />
|
||||
<!-- Swiper CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
|
||||
<link rel="stylesheet" href="assets/css/swiper-bundle.min.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -172,7 +172,7 @@ function stripHtml($html) {
|
||||
<a class="page-scroll active" href="#home">主页</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="page-scroll" href="#feature">文章中心</a>
|
||||
<a class="page-scroll" href="#feature">新闻中心</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="page-scroll" href="#about">关于我们</a>
|
||||
@@ -207,7 +207,7 @@ function stripHtml($html) {
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xxl-5 col-xl-5 col-lg-7 col-md-8">
|
||||
<div class="section-title text-center mb-60">
|
||||
<h3 class="mb-15 wow fadeInUp" data-wow-delay=".2s">文章中心</h3>
|
||||
<h3 class="mb-15 wow fadeInUp" data-wow-delay=".2s">新闻中心</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -257,8 +257,8 @@ function stripHtml($html) {
|
||||
<div class="row align-items-center">
|
||||
<div class="col-xl-5 col-lg-6">
|
||||
<div class="section-title mb-60">
|
||||
<h3 class="mb-15 wow fadeInUp" data-wow-delay=".2s">Pricing Plan</h3>
|
||||
<p class="wow fadeInUp" data-wow-delay=".4s">Stop wasting time and money designing and managing a website that doesn’t get results. Happiness guaranteed!Stop wasting time and money designing and managing a website that doesn’t get results. Happiness guaranteed!</p>
|
||||
<h3 class="mb-15 wow fadeInUp" data-wow-delay=".2s">特色业务</h3>
|
||||
<p class="wow fadeInUp" data-wow-delay=".4s">我们始终以专业、高效、创新为核心,深耕行业多年,形成了独具优势的特色业务体系。凭借成熟的服务流程、过硬的技术实力与丰富的实战经验,为客户提供一站式、定制化解决方案。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-7 col-lg-6">
|
||||
@@ -470,15 +470,19 @@ function stripHtml($html) {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 友情链接 -->
|
||||
<section class="clients-logo-section pt-100 pb-100">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="client-logo wow fadeInUp" data-wow-delay=".2s">
|
||||
<img src="assets/img/clients/brands.svg" alt="" class="w-100">
|
||||
<div class="section-title text-center mb-50">
|
||||
<h3 class="wow fadeInUp" data-wow-delay=".2s">友情链接</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="friendlink-container">
|
||||
<!-- 友情链接将通过 JavaScript 动态加载 -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="footer footer-style-4">
|
||||
@@ -554,7 +558,7 @@ function stripHtml($html) {
|
||||
<script src="assets/js/main.js"></script>
|
||||
<script src="assets/js/all.min.js"></script>
|
||||
<!-- Swiper JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
|
||||
<script src="assets/js/swiper-bundle.min.js"></script>
|
||||
|
||||
<!-- 加载新闻数据 -->
|
||||
<script>
|
||||
@@ -656,11 +660,51 @@ function stripHtml($html) {
|
||||
return API_BASE_URL + (imagePath.startsWith('/') ? imagePath : '/' + imagePath);
|
||||
}
|
||||
|
||||
// 加载友情链接
|
||||
function loadFriendlinks() {
|
||||
const container = document.getElementById('friendlink-container');
|
||||
if (!container) return;
|
||||
|
||||
fetch(API_BASE_URL + '/friendlinks')
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.code !== 200 || !result.data || result.data.length === 0) {
|
||||
container.innerHTML = '<div class="col-12 text-center"><p>暂无友情链接</p></div>';
|
||||
return;
|
||||
}
|
||||
|
||||
let html = '';
|
||||
result.data.forEach((item) => {
|
||||
const logoUrl = item.link_logo ? (item.link_logo.startsWith('http') ? item.link_logo : API_BASE_URL + item.link_logo) : '';
|
||||
const linkName = item.link_name || '';
|
||||
const linkUrl = item.link_url || '#';
|
||||
const description = item.description || '';
|
||||
|
||||
html += '<div class="col-lg-3 col-md-4 col-sm-6 mb-4">' +
|
||||
'<a href="' + linkUrl + '" target="_blank" class="friendlink-item" title="' + description + '">' +
|
||||
'<div class="friendlink-card">' +
|
||||
(logoUrl ? '<img src="' + logoUrl + '" alt="' + linkName + '" class="friendlink-logo">' : '<div class="friendlink-name">' + linkName + '</div>') +
|
||||
'</div>' +
|
||||
'</a>' +
|
||||
'</div>';
|
||||
});
|
||||
|
||||
container.innerHTML = html;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('加载友情链接失败:', err);
|
||||
container.innerHTML = '<div class="col-12 text-center"><p>加载失败</p></div>';
|
||||
});
|
||||
}
|
||||
|
||||
// 页面加载完成后执行
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 加载 Banner 轮播图
|
||||
loadBanners();
|
||||
|
||||
// 加载友情链接
|
||||
loadFriendlinks();
|
||||
|
||||
// 加载新闻数据
|
||||
const container = document.getElementById('news-container');
|
||||
if (!container) return;
|
||||
@@ -764,6 +808,45 @@ function stripHtml($html) {
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* 友情链接样式 */
|
||||
.friendlink-item {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.friendlink-card {
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
height: 150px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.3s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.friendlink-card:hover {
|
||||
border-color: #5864FF;
|
||||
box-shadow: 0 4px 12px rgba(88, 100, 255, 0.15);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.friendlink-logo {
|
||||
max-width: 100%;
|
||||
max-height: 120px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.friendlink-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 新闻卡片样式 -->
|
||||
|
||||
Reference in new issue
Block a user