动态表格列表优化,分页组件新增自定义页数
parent
9305677837
commit
7cbbfcc9d3
|
|
@ -28,7 +28,7 @@
|
|||
#### ShopXO国内领先企业级免费开源电商系统!
|
||||
* 求实进取、创新专注、自主研发、国内领先企业级电商系统解决方案。
|
||||
* 遵循MIT开源协议发布,无需授权、可商用、可二次开发、满足99%的电商运营需求。
|
||||
* 支持PC+H5、支付宝小程序、微信小程序、百度小程序、头条&抖音小程序、QQ小程序、APP等...
|
||||
* 支持PC+H5,小程序(支付宝、微信、百度、头条&抖音、QQ、快手),APP等...
|
||||
* 支持多仓库、多商户、线下门店模式运营(组件插件化、即插即用),可视化DIY拖拽装修。
|
||||
|
||||
### 体验码
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class Common extends BaseController
|
|||
|
||||
// 分页信息
|
||||
$this->page = max(1, isset($this->data_request['page']) ? intval($this->data_request['page']) : 1);
|
||||
$this->page_size = MyC('common_page_size', 10, true);
|
||||
$this->page_size = min(empty($this->data_request['page_size']) ? MyC('common_page_size', 10, true) : intval($this->data_request['page_size']), 1000);
|
||||
MyViewAssign('page', $this->page);
|
||||
MyViewAssign('page_size', $this->page_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@
|
|||
<!-- search -->
|
||||
{{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1}}
|
||||
<tr class="form-table-search">
|
||||
{{if !empty($params['page_size'])}}
|
||||
<input type="hidden" name="page_size" value="{{$params.page_size}}" />
|
||||
{{/if}}
|
||||
{{foreach $form_table['form'] as $k=>$t}}
|
||||
{{if !isset($t['is_list']) or $t['is_list'] eq 1}}
|
||||
<td class="
|
||||
|
|
@ -76,13 +79,13 @@
|
|||
{{if !empty($t['search_config']['data']) and is_array($t['search_config']['data'])}}
|
||||
{{foreach $t['search_config']['data'] as $k=>$v}}
|
||||
{{if is_array($v)}}
|
||||
<option value="{{if isset($t['search_config']['data_key']) and isset($v[$t['search_config']['data_key']])}}{{$v[$t['search_config']['data_key']]}}{{/if}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and is_array($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and in_array($v[$t['search_config']['data_key']], $form_params[$t['form_key']])}}selected{{/if}}>
|
||||
<option value="{{if isset($t['search_config']['data_key']) and isset($v[$t['search_config']['data_key']])}}{{$v[$t['search_config']['data_key']]}}{{/if}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and ((is_array($form_params[$t['form_key']]) and in_array($v[$t['search_config']['data_key']], $form_params[$t['form_key']])) or (!is_array($form_params[$t['form_key']]) and $v[$t['search_config']['data_key']] eq $form_params[$t['form_key']]))}}selected{{/if}}>
|
||||
{{if isset($t['search_config']['data_name']) and isset($v[$t['search_config']['data_name']])}}
|
||||
{{$v[$t['search_config']['data_name']]}}
|
||||
{{/if}}
|
||||
</option>
|
||||
{{else /}}
|
||||
<option value="{{$k}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and $form_params[$t['form_key']] eq $k}}selected{{/if}}>{{$v}}</option>
|
||||
<option value="{{$k}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and ((is_array($form_params[$t['form_key']]) and in_array($k, $form_params[$t['form_key']])) or (!is_array($form_params[$t['form_key']]) and $k eq $form_params[$t['form_key']]))}}selected{{/if}}>{{$v}}</option>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ class Common extends BaseController
|
|||
|
||||
// 分页信息
|
||||
$this->page = max(1, isset($this->data_request['page']) ? intval($this->data_request['page']) : 1);
|
||||
$this->page_size = MyC('common_page_size', 10, true);
|
||||
$this->page_size = min(empty($this->data_request['page_size']) ? MyC('common_page_size', 10, true) : intval($this->data_request['page_size']), 1000);
|
||||
MyViewAssign('page', $this->page);
|
||||
MyViewAssign('page_size', $this->page_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@
|
|||
<!-- search -->
|
||||
{{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1}}
|
||||
<tr class="form-table-search">
|
||||
{{if !empty($params['page_size'])}}
|
||||
<input type="hidden" name="page_size" value="{{$params.page_size}}" />
|
||||
{{/if}}
|
||||
{{foreach $form_table['form'] as $k=>$t}}
|
||||
{{if !isset($t['is_list']) or $t['is_list'] eq 1}}
|
||||
<td class="
|
||||
|
|
@ -76,13 +79,13 @@
|
|||
{{if !empty($t['search_config']['data']) and is_array($t['search_config']['data'])}}
|
||||
{{foreach $t['search_config']['data'] as $k=>$v}}
|
||||
{{if is_array($v)}}
|
||||
<option value="{{if isset($t['search_config']['data_key']) and isset($v[$t['search_config']['data_key']])}}{{$v[$t['search_config']['data_key']]}}{{/if}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and is_array($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and in_array($v[$t['search_config']['data_key']], $form_params[$t['form_key']])}}selected{{/if}}>
|
||||
<option value="{{if isset($t['search_config']['data_key']) and isset($v[$t['search_config']['data_key']])}}{{$v[$t['search_config']['data_key']]}}{{/if}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and ((is_array($form_params[$t['form_key']]) and in_array($v[$t['search_config']['data_key']], $form_params[$t['form_key']])) or (!is_array($form_params[$t['form_key']]) and $v[$t['search_config']['data_key']] eq $form_params[$t['form_key']]))}}selected{{/if}}>
|
||||
{{if isset($t['search_config']['data_name']) and isset($v[$t['search_config']['data_name']])}}
|
||||
{{$v[$t['search_config']['data_name']]}}
|
||||
{{/if}}
|
||||
</option>
|
||||
{{else /}}
|
||||
<option value="{{$k}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and $form_params[$t['form_key']] eq $k}}selected{{/if}}>{{$v}}</option>
|
||||
<option value="{{$k}}" {{if !empty($form_params) and isset($form_params[$t['form_key']]) and isset($t['search_config']['data_key']) and ((is_array($form_params[$t['form_key']]) and in_array($k, $form_params[$t['form_key']])) or (!is_array($form_params[$t['form_key']]) and $k eq $form_params[$t['form_key']]))}}selected{{/if}}>{{$v}}</option>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,25 @@
|
|||
+=========================================================+
|
||||
ShopXO 2.2.8 Release 202205xxx http://shopxo.net
|
||||
+=========================================================+
|
||||
全局
|
||||
1. 商品类型不一致不可售卖提示更新
|
||||
2. 新增电子面单插件(批量打单+批量发货)
|
||||
3. 商品管理新增智能工具插件分类批量移动
|
||||
4. 商品详情相册小图片增加轮播优化
|
||||
5. 可视化拖拽新增8:4和4:8布局
|
||||
6. 支持快手小程序
|
||||
7. 系统类型细节优化
|
||||
8. 门店插件优化
|
||||
9. 多商户插件优化
|
||||
10. 活动配置插件优化
|
||||
11. 电子面单插件优化
|
||||
12. 微信小程序直播插件优化
|
||||
13. 多语言插件优化
|
||||
14. 智能工具插件优化
|
||||
15. 分页组件支持自定义传入数值
|
||||
|
||||
|
||||
|
||||
+=========================================================+
|
||||
ShopXO 2.2.7 Release 20220422 http://shopxo.net
|
||||
+=========================================================+
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace base;
|
|||
class Page
|
||||
{
|
||||
private $page;
|
||||
private $page_size;
|
||||
private $total;
|
||||
private $number;
|
||||
private $bt_number;
|
||||
private $where;
|
||||
private $not_fields;
|
||||
|
|
@ -32,19 +32,20 @@ class Page
|
|||
private $tips_msg;
|
||||
|
||||
/**
|
||||
* [__construct description]
|
||||
* @param [int] $params['total'] [数据总数]
|
||||
* @param [int] $params['number'] [每页数据条数]
|
||||
* @param [int] $params['bt_number'] [分页显示按钮个数]
|
||||
* @param [array] $params['where'] [额外条件(键值对)]
|
||||
* @param [array] $params['not_fields'] [不参与条件拼接的字段]
|
||||
* @param [string] $params['url'] [url地址]
|
||||
* 构造方法
|
||||
* @param [int] $params['page'] [页码]
|
||||
* @param [int] $params['page_size / number'][每页数据条数]
|
||||
* @param [int] $params['total'] [数据总数]
|
||||
* @param [int] $params['bt_number'] [分页显示按钮个数]
|
||||
* @param [array] $params['where'] [额外条件(键值对)]
|
||||
* @param [array] $params['not_fields'] [不参与条件拼接的字段]
|
||||
* @param [string] $params['url'] [url地址]
|
||||
*/
|
||||
public function __construct($params = [])
|
||||
{
|
||||
$this->page = max(1, isset($params['page']) ? intval($params['page']) : 1);
|
||||
$this->page_size = empty($params['page_size']) ? (empty($params['number']) ? 10 : intval($params['number'])) : intval($params['page_size']);
|
||||
$this->total = max(1, isset($params['total']) ? intval($params['total']) : 1);
|
||||
$this->number = max(1, isset($params['number']) ? intval($params['number']) : 1);
|
||||
$this->bt_number = isset($params['bt_number']) ? intval($params['bt_number']) : 2;
|
||||
$this->where = (isset($params['where']) && is_array($params['where'])) ? $params['where'] : '';
|
||||
$this->not_fields = (!empty($params['not_fields']) && is_array($params['not_fields'])) ? $params['not_fields'] : [];
|
||||
|
|
@ -63,7 +64,7 @@ class Page
|
|||
private function SetParem()
|
||||
{
|
||||
/* 防止超出最大页码数 */
|
||||
$this->page_total = ceil($this->total/$this->number);
|
||||
$this->page_total = ceil($this->total/$this->page_size);
|
||||
if($this->page > $this->page_total) $this->page = $this->page_total;
|
||||
|
||||
/* url是否包含问号 */
|
||||
|
|
@ -127,16 +128,20 @@ class Page
|
|||
$this->html .= '<a href="'.$this->url.$this->page_join.'page='.$this->page_total.'" class="am-radius am-icon-angle-double-right"></a>';
|
||||
$this->html .= '</li>';
|
||||
|
||||
$this->html .= ' <span>跳转到</span>';
|
||||
$this->html .= '<input type="text" min="1" class="am-form-field am-inline-block am-text-center am-margin-horizontal-xs pagination-input" value="'.$this->page.'" onchange="window.location.href=\''.$this->url.$this->page_join.'page=\'+(isNaN(parseInt(this.value)) ? 1 : parseInt(this.value) || 1);" onclick="this.select()" />';
|
||||
$this->html .= '<span class="am-margin-left-sm">每页</span>';
|
||||
$this->html .= '<input type="text" min="1" class="am-form-field am-inline-block am-text-center am-margin-horizontal-xs am-radius pagination-input" value="'.$this->page_size.'" onchange="window.location.href=\''.$this->url.$this->page_join.'page_size=\'+(isNaN(parseInt(this.value)) ? 10 : parseInt(this.value) || 10);" onclick="this.select()" />';
|
||||
$this->html .= '<span>条</span>';
|
||||
|
||||
$this->html .= '<span class="am-margin-left-sm">跳转到</span>';
|
||||
$this->html .= '<input type="text" min="1" class="am-form-field am-inline-block am-text-center am-margin-horizontal-xs am-radius pagination-input" value="'.$this->page.'" onchange="window.location.href=\''.$this->url.$this->page_join.'page=\'+(isNaN(parseInt(this.value)) ? 1 : parseInt(this.value) || 1);" onclick="this.select()" />';
|
||||
$this->html .= '<span>页</span>';
|
||||
|
||||
$this->html .= '<div>';
|
||||
$this->html .= '<span>共 '.$this->total.' 条数据</span>';
|
||||
$this->html .= ' <span>共 '.$this->page_total.' 页</span>';
|
||||
$this->html .= '<span class="am-margin-left-sm">共 '.$this->page_total.' 页</span>';
|
||||
if(!empty($this->tips_msg))
|
||||
{
|
||||
$this->html .= ' <span>'.$this->tips_msg.'</span>';
|
||||
$this->html .= '<span class="am-margin-left-sm">'.$this->tips_msg.'</span>';
|
||||
}
|
||||
$this->html .= '</div>';
|
||||
$this->html .= '</ul>';
|
||||
|
|
@ -183,7 +188,7 @@ class Page
|
|||
*/
|
||||
public function GetPageStarNumber()
|
||||
{
|
||||
return intval(($this->page-1)*$this->number);
|
||||
return intval(($this->page-1)*$this->page_size);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -848,10 +848,13 @@ a.am-badge-danger-plain:focus {
|
|||
/**
|
||||
* 分页
|
||||
*/
|
||||
.am-pagination > li > a {
|
||||
border-radius: 2px;
|
||||
}
|
||||
.pagination-input {
|
||||
width: 50px;
|
||||
vertical-align: inherit !important;
|
||||
padding: 5px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue