Skip to content

Commit

Permalink
blog list page not reset when switch category
Browse files Browse the repository at this point in the history
  • Loading branch information
modstart committed Aug 11, 2024
1 parent 03546e9 commit 0cd354a
Show file tree
Hide file tree
Showing 32 changed files with 448 additions and 85 deletions.
2 changes: 1 addition & 1 deletion module/Blog/Docs/release.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 3.5.0
## 3.5.0 博客公告,二级分类,定时发布

- 新增:系统公告模块适配,支持博客公告
- 优化:博客自动发布逻辑优化调整,支持定时发布
Expand Down
4 changes: 2 additions & 2 deletions module/Blog/View/pc/blog/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
<div class="tw-px-3 tw-pt-3">
@foreach($categoryChain as $catIndex=>$catItem)
<div class="margin-bottom">
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$catItem['pid']?$catItem['pid']:null])}}"
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$catItem['pid']?$catItem['pid']:null,'page'=>null])}}"
class="btn btn-round @if($catItem['id']<=0) btn-primary @endif">
全部
</a>
@foreach($catItem['_items'] as $item)
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$item['id']?$item['id']:null])}}"
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$item['id']?$item['id']:null,'page'=>null])}}"
class="btn btn-round @if($catItem['id']==$item['id']) btn-primary @endif"
>
{{$item['title']}}
Expand Down
7 changes: 4 additions & 3 deletions module/Blog/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"tags": [
"博客"
],
"modstartVersion": ">=4.0.0",
"version": "3.5.0",
"author": "ModStart",
"description": "提供一个基础的博客系统",
Expand All @@ -27,8 +28,8 @@
"SiteMapManager",
"PayCenter",
"HotSearch",
"ShareJS"
"ShareJS",
"Notice"
],
"config": {
}
"config": {}
}
6 changes: 6 additions & 0 deletions module/Vendor/Docs/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.5.0

- 新增:RandomImageProvider 逻辑升级重构,支持更丰富的随机图片生成

---

## 4.4.0 优化后台操作工具类,新增分类操作工具类

- 新增:订单快捷操作工具类 OrderUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@

abstract class AbstractRandomImageProvider
{
abstract public function get($param = []);
abstract public function name();

abstract public function title();

abstract public function get($biz, $type = 'background', $param = []);
}
19 changes: 0 additions & 19 deletions module/Vendor/Provider/RandomImage/DefaultRandomImageProvider.php

This file was deleted.

65 changes: 51 additions & 14 deletions module/Vendor/Provider/RandomImage/RandomImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,63 @@
namespace Module\Vendor\Provider\RandomImage;


use ModStart\Core\Assets\AssetsUtil;
use ModStart\Core\Input\Response;
use ModStart\Core\Util\SerializeUtil;
use Module\Vendor\Provider\ProviderTrait;


/**
* @method static AbstractRandomImageProvider first()
* @method static AbstractRandomImageProvider[] listAll()
*/
class RandomImageProvider
{
/**
* @return AbstractRandomImageProvider
*/
public static function get()
use ProviderTrait;

public static function getImage($provider, $biz, $type = 'background', $param = [])
{
static $instance = null;
if (null === $instance) {
$driver = config('RandomImageProvider');
if (empty($driver)) {
$driver = DefaultRandomImageProvider::class;
}
$instance = app($driver);
$ret = null;
$error = null;
if ($provider) {
$ret = $provider->get($biz, $type, $param);
} else {
$error = 'NoProvider';
}
if (Response::isSuccess($ret)) {
return $ret['data'];
}
return $instance;
if (isset($ret['msg'])) {
$error = $ret['msg'];
} else {
$error = 'ERROR:' . SerializeUtil::jsonEncode($ret);
}
return [
'url' => AssetsUtil::fixFull('asset/image/none.svg'),
'error' => $error,
];
}

public static function getImage($biz = '', $param = [])
public static function getProviderImage($name, $biz, $type = 'background', $param = [])
{
return self::get()->get(array_merge(['biz' => $biz], $param));
$provider = self::getByName($name);
return self::getImage($provider, $biz, $type, $param);
}

public static function getConfigProviderImage($configName, $biz, $type = 'background', $param = [])
{
$name = modstart_config($configName, '');
if ($name) {
$provider = self::getByName($name);
} else {
$provider = self::first();
}
return self::getImage($provider, $biz, $type, $param);
}

public static function getFirstImage($biz, $type = 'background', $param = [])
{
return self::getImage(self::first(), $biz, $type, $param);
}

}
19 changes: 19 additions & 0 deletions module/Vendor/Provider/RandomImage/RandomImageType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Module\Vendor\Provider\RandomImage;

use ModStart\Core\Type\BaseType;

class RandomImageType implements BaseType
{
const BACKGROUND = 'background';
const COVER = 'cover';

public static function getList()
{
return [
self::BACKGROUND => '背景',
self::COVER => '封面',
];
}
}
2 changes: 1 addition & 1 deletion module/Vendor/Provider/Recommend/AbstractRecommendBiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract public function title();
abstract public function providerName();

/**
* 批量彤彤股
* 批量同步
* @param $nextId int 下一个ID
* @param $param array 参数
* @return array
Expand Down
2 changes: 2 additions & 0 deletions module/Vendor/Util/UniappUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public static function build($dir)
'"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $module . '/"',
// '(/static/' => '(/vendor/' . $module . '/static/',
'"/static/' => 'window.__msCDN+"vendor/' . $module . '/static/',
// "url('/static/image/dialog-bg.png')"
'"url(\'/static/' => '"url(\'"+window.__msCDN+"vendor/' . $module . '/static/',
];
$files = glob('dist/build/h5/static/js/*.js');
foreach ($files as $file) {
Expand Down
4 changes: 2 additions & 2 deletions module/Vendor/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Vendor",
"title": "通用功能包",
"version": "4.4.0",
"version": "4.5.0",
"author": "官方",
"description": "提供基础功能",
"modstartVersion": ">=3.9.0",
Expand All @@ -16,4 +16,4 @@
"基础组件"
],
"config": {}
}
}
Loading

0 comments on commit 0cd354a

Please sign in to comment.