Skip to content

Commit 0cd354a

Browse files
committed
blog list page not reset when switch category
1 parent 03546e9 commit 0cd354a

File tree

32 files changed

+448
-85
lines changed

32 files changed

+448
-85
lines changed

module/Blog/Docs/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 3.5.0
1+
## 3.5.0 博客公告,二级分类,定时发布
22

33
- 新增:系统公告模块适配,支持博客公告
44
- 优化:博客自动发布逻辑优化调整,支持定时发布

module/Blog/View/pc/blog/list.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
<div class="tw-px-3 tw-pt-3">
3737
@foreach($categoryChain as $catIndex=>$catItem)
3838
<div class="margin-bottom">
39-
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$catItem['pid']?$catItem['pid']:null])}}"
39+
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$catItem['pid']?$catItem['pid']:null,'page'=>null])}}"
4040
class="btn btn-round @if($catItem['id']<=0) btn-primary @endif">
4141
全部
4242
</a>
4343
@foreach($catItem['_items'] as $item)
44-
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$item['id']?$item['id']:null])}}"
44+
<a href="?{{\ModStart\Core\Input\Request::mergeQueries(['categoryId'=>$item['id']?$item['id']:null,'page'=>null])}}"
4545
class="btn btn-round @if($catItem['id']==$item['id']) btn-primary @endif"
4646
>
4747
{{$item['title']}}

module/Blog/config.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"tags": [
1818
"博客"
1919
],
20+
"modstartVersion": ">=4.0.0",
2021
"version": "3.5.0",
2122
"author": "ModStart",
2223
"description": "提供一个基础的博客系统",
@@ -27,8 +28,8 @@
2728
"SiteMapManager",
2829
"PayCenter",
2930
"HotSearch",
30-
"ShareJS"
31+
"ShareJS",
32+
"Notice"
3133
],
32-
"config": {
33-
}
34+
"config": {}
3435
}

module/Vendor/Docs/release.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.5.0
2+
3+
- 新增:RandomImageProvider 逻辑升级重构,支持更丰富的随机图片生成
4+
5+
---
6+
17
## 4.4.0 优化后台操作工具类,新增分类操作工具类
28

39
- 新增:订单快捷操作工具类 OrderUtil

module/Vendor/Provider/RandomImage/AbstractRandomImageProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66

77
abstract class AbstractRandomImageProvider
88
{
9-
abstract public function get($param = []);
9+
abstract public function name();
10+
11+
abstract public function title();
12+
13+
abstract public function get($biz, $type = 'background', $param = []);
1014
}

module/Vendor/Provider/RandomImage/DefaultRandomImageProvider.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

module/Vendor/Provider/RandomImage/RandomImageProvider.php

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,63 @@
44
namespace Module\Vendor\Provider\RandomImage;
55

66

7+
use ModStart\Core\Assets\AssetsUtil;
8+
use ModStart\Core\Input\Response;
9+
use ModStart\Core\Util\SerializeUtil;
10+
use Module\Vendor\Provider\ProviderTrait;
11+
12+
13+
/**
14+
* @method static AbstractRandomImageProvider first()
15+
* @method static AbstractRandomImageProvider[] listAll()
16+
*/
717
class RandomImageProvider
818
{
9-
/**
10-
* @return AbstractRandomImageProvider
11-
*/
12-
public static function get()
19+
use ProviderTrait;
20+
21+
public static function getImage($provider, $biz, $type = 'background', $param = [])
1322
{
14-
static $instance = null;
15-
if (null === $instance) {
16-
$driver = config('RandomImageProvider');
17-
if (empty($driver)) {
18-
$driver = DefaultRandomImageProvider::class;
19-
}
20-
$instance = app($driver);
23+
$ret = null;
24+
$error = null;
25+
if ($provider) {
26+
$ret = $provider->get($biz, $type, $param);
27+
} else {
28+
$error = 'NoProvider';
29+
}
30+
if (Response::isSuccess($ret)) {
31+
return $ret['data'];
2132
}
22-
return $instance;
33+
if (isset($ret['msg'])) {
34+
$error = $ret['msg'];
35+
} else {
36+
$error = 'ERROR:' . SerializeUtil::jsonEncode($ret);
37+
}
38+
return [
39+
'url' => AssetsUtil::fixFull('asset/image/none.svg'),
40+
'error' => $error,
41+
];
2342
}
2443

25-
public static function getImage($biz = '', $param = [])
44+
public static function getProviderImage($name, $biz, $type = 'background', $param = [])
2645
{
27-
return self::get()->get(array_merge(['biz' => $biz], $param));
46+
$provider = self::getByName($name);
47+
return self::getImage($provider, $biz, $type, $param);
2848
}
49+
50+
public static function getConfigProviderImage($configName, $biz, $type = 'background', $param = [])
51+
{
52+
$name = modstart_config($configName, '');
53+
if ($name) {
54+
$provider = self::getByName($name);
55+
} else {
56+
$provider = self::first();
57+
}
58+
return self::getImage($provider, $biz, $type, $param);
59+
}
60+
61+
public static function getFirstImage($biz, $type = 'background', $param = [])
62+
{
63+
return self::getImage(self::first(), $biz, $type, $param);
64+
}
65+
2966
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Module\Vendor\Provider\RandomImage;
4+
5+
use ModStart\Core\Type\BaseType;
6+
7+
class RandomImageType implements BaseType
8+
{
9+
const BACKGROUND = 'background';
10+
const COVER = 'cover';
11+
12+
public static function getList()
13+
{
14+
return [
15+
self::BACKGROUND => '背景',
16+
self::COVER => '封面',
17+
];
18+
}
19+
}

module/Vendor/Provider/Recommend/AbstractRecommendBiz.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract public function title();
1212
abstract public function providerName();
1313

1414
/**
15-
* 批量彤彤股
15+
* 批量同步
1616
* @param $nextId int 下一个ID
1717
* @param $param array 参数
1818
* @return array

module/Vendor/Util/UniappUtil.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public static function build($dir)
6262
'"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $module . '/"',
6363
// '(/static/' => '(/vendor/' . $module . '/static/',
6464
'"/static/' => 'window.__msCDN+"vendor/' . $module . '/static/',
65+
// "url('/static/image/dialog-bg.png')"
66+
'"url(\'/static/' => '"url(\'"+window.__msCDN+"vendor/' . $module . '/static/',
6567
];
6668
$files = glob('dist/build/h5/static/js/*.js');
6769
foreach ($files as $file) {

0 commit comments

Comments
 (0)