新增快捷导航

This commit is contained in:
devil 2020-09-11 18:06:09 +08:00
parent 220dc549bb
commit 05960694e8
46 changed files with 1068 additions and 115 deletions

View File

@ -0,0 +1,211 @@
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\service\QuickNavService;
/**
* 快捷导航管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class QuickNav extends Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function __construct()
{
// 调用父类前置方法
parent::__construct();
// 登录校验
$this->IsLogin();
// 权限校验
$this->IsPower();
}
/**
* [Index 快捷导航列表]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Index()
{
// 总数
$total = QuickNavService::QuickNavTotal($this->form_where);
// 分页
$page_params = [
'number' => $this->page_size,
'total' => $total,
'where' => $this->data_request,
'page' => $this->page,
'url' => MyUrl('admin/QuickNav/index'),
];
$page = new \base\Page($page_params);
// 获取列表
$data_params = [
'where' => $this->form_where,
'm' => $page->GetPageStarNumber(),
'n' => $this->page_size,
];
$ret = QuickNavService::QuickNavList($data_params);
// 基础参数赋值
$this->assign('params', $this->data_request);
$this->assign('page_html', $page->GetPageHtml());
$this->assign('data_list', $ret['data']);
return $this->fetch();
}
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public function Detail()
{
if(!empty($this->data_request['id']))
{
// 条件
$where = [
['id', '=', intval($this->data_request['id'])],
];
// 获取列表
$data_params = [
'm' => 0,
'n' => 1,
'where' => $where,
];
$ret = QuickNavService::QuickNavList($data_params);
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
$this->assign('data', $data);
}
return $this->fetch();
}
/**
* [SaveInfo 添加/编辑页面]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-14T21:37:02+0800
*/
public function SaveInfo()
{
// 参数
$params = $this->data_request;
// 数据
$data = [];
if(!empty($params['id']))
{
// 获取列表
$data_params = array(
'm' => 0,
'n' => 1,
'where' => ['id'=>intval($params['id'])],
'field' => '*',
);
$ret = QuickNavService::QuickNavList($data_params);
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
}
$this->assign('data', $data);
// 静态数据
$this->assign('common_platform_type', lang('common_platform_type'));
$this->assign('common_app_event_type', lang('common_app_event_type'));
// 参数
$this->assign('params', $params);
// 编辑器文件存放地址
$this->assign('editor_path_type', 'quick_nav');
return $this->fetch();
}
/**
* [Save 快捷导航添加/编辑]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-14T21:37:02+0800
*/
public function Save()
{
// 是否ajax请求
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 开始处理
$params = $this->data_request;
return QuickNavService::QuickNavSave($params);
}
/**
* [Delete 快捷导航删除]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-15T11:03:30+0800
*/
public function Delete()
{
// 是否ajax请求
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 开始处理
$params = $this->data_request;
$params['user_type'] = 'admin';
return QuickNavService::QuickNavDelete($params);
}
/**
* [StatusUpdate 状态更新]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-12T22:23:06+0800
*/
public function StatusUpdate()
{
// 是否ajax请求
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 开始处理
$params = $this->data_request;
return QuickNavService::QuickNavStatusUpdate($params);
}
}
?>

View File

@ -0,0 +1,162 @@
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\form;
/**
* 快捷导航动态表格
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-20
* @desc description
*/
class Quicknav
{
// 基础条件
public $condition_base = [];
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-20
* @desc description
* @param [array] $params [输入参数]
*/
public function Run($params = [])
{
return [
// 基础配置
'base' => [
'key_field' => 'id',
'status_field' => 'is_enable',
'is_search' => 1,
'search_url' => MyUrl('admin/quicknav/index'),
'is_delete' => 1,
'delete_url' => MyUrl('admin/quicknav/delete'),
'delete_key' => 'ids',
],
// 表单配置
'form' => [
[
'view_type' => 'checkbox',
'is_checked' => 0,
'checked_text' => '反选',
'not_checked_text' => '全选',
'align' => 'center',
'width' => 80,
],
[
'label' => '名称',
'view_type' => 'field',
'view_key' => 'name',
'search_config' => [
'form_type' => 'input',
'where_type' => 'like',
],
],
[
'label' => '所属平台',
'view_type' => 'field',
'view_key' => 'platform',
'view_data_key' => 'name',
'view_data' => lang('common_platform_type'),
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
'data' => lang('common_platform_type'),
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
'label' => '导航图标',
'view_type' => 'module',
'view_key' => 'quicknav/module/images',
'align' => 'center',
],
[
'label' => '事件类型',
'view_type' => 'field',
'view_key' => 'event_type',
'view_data_key' => 'name',
'view_data' => lang('common_app_event_type'),
'grid_size' => 'sm',
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
'data' => lang('common_app_event_type'),
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
'label' => '事件值',
'view_type' => 'field',
'view_key' => 'event_value',
'grid_size' => 'sm',
'search_config' => [
'form_type' => 'input',
'where_type' => 'like',
],
],
[
'label' => '是否启用',
'view_type' => 'status',
'view_key' => 'is_enable',
'post_url' => MyUrl('admin/quicknav/statusupdate'),
'is_form_su' => 1,
'align' => 'center',
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
'data' => lang('common_is_enable_list'),
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
'label' => '排序',
'view_type' => 'field',
'view_key' => 'sort',
],
[
'label' => '创建时间',
'view_type' => 'field',
'view_key' => 'add_time',
'search_config' => [
'form_type' => 'datetime',
],
],
[
'label' => '更新时间',
'view_type' => 'field',
'view_key' => 'upd_time',
'search_config' => [
'form_type' => 'datetime',
],
],
[
'label' => '操作',
'view_type' => 'operate',
'view_key' => 'quicknav/module/operate',
'align' => 'center',
'fixed' => 'right',
],
],
];
}
}
?>

View File

@ -64,7 +64,7 @@
{{/if}}
<!-- 插件扩展数据 end -->
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data['id'])}}value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -6,7 +6,7 @@
<!-- form start -->
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/appcenternav/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/appcenternav/index', $params)}}" enctype="multipart/form-data">
<legend>
<span class="am-text-default">用户中心导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
<span class="am-text-default">手机用户中心导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
<a href="{{:MyUrl('admin/appcenternav/index', $params)}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
</legend>
<div class="am-form-group">
@ -36,14 +36,14 @@
</select>
</div>
<div class="am-form-group">
<label>事件值</label>
<input type="text" name="event_value" placeholder="事件值" data-validation-message="事件值最多 255 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.event_value}}"{{/if}} />
<div class="am-alert am-alert-warning am-radius" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p class="am-text-xs">
WEB页面<br />&nbsp&nbsp&nbsp;1.以http开头<br />&nbsp&nbsp&nbsp;2.并在小程序后台加入白名单<br /><br /> 内部页面(小程序/APP内部地址)<br />&nbsp&nbsp&nbsp;1.小程序或APP内部地址<br />&nbsp&nbsp&nbsp;2.小程序以/pages开始<br />&nbsp&nbsp&nbsp;3.例如:/pages/user/user<br />&nbsp&nbsp&nbsp;4.支持带参数 ?x=xx<br /><br /> 跳转原生地图查看指定位置<br />&nbsp&nbsp&nbsp;1.以 | 竖线分割,分别顺序 名称|地址|经度|纬度<br />&nbsp&nbsp&nbsp;2.例如ShopXO|上海浦东新区张江高科技园区XXX号|121.626444|31.20843
</p>
</div>
<label>事件值</label>
<input type="text" name="event_value" placeholder="事件值" data-validation-message="事件值最多 255 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.event_value}}"{{/if}} />
</div>
<div class="am-form-group">
@ -70,7 +70,7 @@
<label class="block">是否启用</label>
<input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if !empty($data) and $data['is_enable'] eq 1}} checked="true"{{/if}} />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -6,7 +6,7 @@
<!-- form start -->
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/apphomenav/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/apphomenav/index', $params)}}" enctype="multipart/form-data">
<legend>
<span class="am-text-default">导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
<span class="am-text-default">手机首页导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
<a href="{{:MyUrl('admin/apphomenav/index', $params)}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
</legend>
<div class="am-form-group">
@ -36,14 +36,14 @@
</select>
</div>
<div class="am-form-group">
<label>事件值</label>
<input type="text" name="event_value" placeholder="事件值" data-validation-message="事件值最多 255 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.event_value}}"{{/if}} />
<div class="am-alert am-alert-warning am-radius" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p class="am-text-xs">
WEB页面<br />&nbsp&nbsp&nbsp;1.以http开头<br />&nbsp&nbsp&nbsp;2.并在小程序后台加入白名单<br /><br /> 内部页面(小程序/APP内部地址)<br />&nbsp&nbsp&nbsp;1.小程序或APP内部地址<br />&nbsp&nbsp&nbsp;2.小程序以/pages开始<br />&nbsp&nbsp&nbsp;3.例如:/pages/user/user<br />&nbsp&nbsp&nbsp;4.支持带参数 ?x=xx<br /><br /> 跳转原生地图查看指定位置<br />&nbsp&nbsp&nbsp;1.以 | 竖线分割,分别顺序 名称|地址|经度|纬度<br />&nbsp&nbsp&nbsp;2.例如ShopXO|上海浦东新区张江高科技园区XXX号|121.626444|31.20843
</p>
</div>
<label>事件值</label>
<input type="text" name="event_value" placeholder="事件值" data-validation-message="事件值最多 255 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.event_value}}"{{/if}} />
</div>
<div class="am-form-group am-form-file">
@ -76,7 +76,7 @@
<label class="block">是否启用</label>
<input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if !empty($data) and $data['is_enable'] eq 1}} checked="true"{{/if}} />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -71,7 +71,7 @@
{{include file="lib/seo" /}}
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -73,7 +73,7 @@
{{include file="lib/seo" /}}
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -37,7 +37,7 @@
<label>内容{{if IsMobile()}}<span class="am-form-group-label-tips">更多编辑功能请使用电脑访问</span>{{/if}}</label>
<textarea class="am-radius am-validate" name="content" rows="5" minlength="10" maxlength="105000" {{if !IsMobile()}}id="editor-tag" data-url="{{:MyUrl('admin/ueditor/index', ['path_type'=>'customview'])}}" placeholder="内容长度最少 10~105000 个字符" {{else /}} placeholder="内容长度最少 10~105000 个字符更多编辑功能请使用电脑访问" {{/if}} data-validation-message="内容长度最少 10~105000 个字符" required>{{if !empty($data)}}{{$data.content}}{{/if}}</textarea>
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -631,7 +631,7 @@
{{include file="lib/seo" /}}
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if isset($data) and !empty($data['id']) and (!isset($is_copy) or $is_copy neq 1)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -159,7 +159,7 @@
<label class="block">是否启用</label>
<input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['is_enable']) and $data['is_enable'] eq 1) or !isset($data['is_enable'])}}checked="true"{{/if}} />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -0,0 +1,2 @@
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}

View File

@ -0,0 +1,9 @@
<!-- 继承公共的 form -->
{{extend name="public/module/form" /}}
<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
<a href="{{:MyUrl('admin/quicknav/saveinfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> 新增</a>
<!-- 父级内容 -->
{__block__}
{{/block}}

View File

@ -0,0 +1,8 @@
<!-- 图标 -->
{{if !empty($module_data) and !empty($module_data['images_url'])}}
<div class="am-circle nav-icon-circle am-vertical-align" style="background-color:{{if empty($module_data['bg_color'])}}#d0d0d0{{else /}}{{$module_data.bg_color}}{{/if}};">
<a href="{{$module_data['images_url']}}" target="_blank">
<img src="{{$module_data['images_url']}}" class="am-radius am-vertical-align-middle" width="30" height="30" />
</a>
</div>
{{/if}}

View File

@ -0,0 +1,13 @@
<!-- 操作栏 -->
<button type="button" class="am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup" data-url="{{:MyUrl('admin/quicknav/detail', ['id'=>$module_data['id']])}}">
<i class="am-icon-eye"></i>
<span>详情</span>
</button>
<a class="am-btn am-btn-secondary am-btn-xs am-radius am-btn-block" href="{{:MyUrl('admin/quicknav/saveinfo', array('id'=>$module_data['id']))}}">
<i class="am-icon-edit"></i>
<span>编辑</span>
</a>
<button type="button" class="am-btn am-btn-danger am-btn-xs am-radius am-btn-block submit-delete" data-url="{{:MyUrl('admin/quicknav/delete')}}" data-id="{{$module_data.id}}" data-key="ids">
<i class="am-icon-trash-o"></i>
<span>删除</span>
</button>

View File

@ -0,0 +1,86 @@
{{include file="public/header" /}}
<!-- right content start -->
<div class="content-right">
<div class="content">
<!-- form start -->
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/quicknav/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/quicknav/index', $params)}}" enctype="multipart/form-data">
<legend>
<span class="am-text-default">快捷导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
<a href="{{:MyUrl('admin/quicknav/index', $params)}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
</legend>
<div class="am-form-group">
<label>名称</label>
<input type="text" name="name" placeholder="名称" minlength="2" maxlength="60" data-validation-message="名称格式 2~60 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.name}}"{{/if}} required />
</div>
<div class="am-form-group">
<label>所属平台</label>
<select name="platform" class="am-radius chosen-select" data-placeholder="可选择..." placeholder="所属平台有误" data-validation-message="请选择所属平台" required>
<option value="">可选择...</option>
{{foreach $common_platform_type as $v}}
<option value="{{$v.value}}" {{if isset($data['platform']) and $data['platform'] eq $v['value']}}selected{{else /}}{{if !isset($data['platform']) and isset($v['checked']) and $v['checked'] eq true}}selected{{/if}}{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>事件类型</label>
<select name="event_type" class="am-radius chosen-select" data-placeholder="可选择..." placeholder="事件值类型有误" data-validation-message="请选择事件类型" required>
<option value="">可选择...</option>
{{foreach $common_app_event_type as $v}}
{{if $v['value'] lt 3}}
<option value="{{$v.value}}" {{if isset($data['event_type']) and $data['event_type'] eq $v['value']}}selected{{else /}}{{if !isset($data['event_type']) and isset($v['checked']) and $v['checked'] eq true}}selected{{/if}}{{/if}}>{{$v.name}}</option>
{{/if}}
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>事件值</label>
<input type="text" name="event_value" placeholder="事件值" data-validation-message="事件值最多 255 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.event_value}}"{{/if}} />
<div class="am-alert am-alert-warning am-radius" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p class="am-text-xs">
WEB页面<br />&nbsp&nbsp&nbsp;1.以http开头<br />&nbsp&nbsp&nbsp;2.并在小程序后台加入白名单<br /><br /> 内部页面(小程序/APP内部地址)<br />&nbsp&nbsp&nbsp;1.小程序或APP内部地址<br />&nbsp&nbsp&nbsp;2.小程序以/pages开始<br />&nbsp&nbsp&nbsp;3.例如:/pages/user/user<br />&nbsp&nbsp&nbsp;4.支持带参数 ?x=xx
</p>
</div>
</div>
<div class="am-form-group am-form-file">
<label class="block">导航图标</label>
<ul class="plug-file-upload-view slide-images_url-images-view" data-form-name="images_url" data-max-number="1" data-delete="0" data-dialog-type="images">
<li>
<input type="text" name="images_url" value="{{if !empty($data['images_url'])}}{{$data.images_url}}{{/if}}" data-validation-message="请上传图片" required />
<img src="{{if !empty($data['images_url'])}}{{$data.images_url}}{{else /}}{{$attachment_host}}/static/admin/default/images/default-images.jpg{{/if}}" />
</li>
</ul>
<div class="plug-file-upload-submit" data-view-tag="ul.slide-images_url-images-view">+上传图片</div>
</div>
<div class="am-form-group">
<label>背景色</label>
<input type="hidden" name="bg_color" value="{{if !empty($data)}}{{$data.bg_color}}{{/if}}" />
<button class="am-btn am-btn-default am-btn-xs colorpicker-submit bg-color-tag am-btn-block bk-cr-white t-r" type="button" data-input-tag="button.bg-color-tag" data-color-tag="input[name='bg_color']" data-color-style="background-color" {{if !empty($data)}} style="background-color:{{$data.bg_color}};"{{/if}}>
<img src="{{$attachment_host}}/static/common/images/colorpicker.png" />
</button>
</div>
<div class="am-form-group">
<label>顺序</label>
<input type="number" placeholder="顺序" name="sort" min="0" max="255" data-validation-message="顺序 0~255 之间的数值" class="am-radius" value="{{if isset($data['sort'])}}{{$data.sort}}{{else /}}0{{/if}}" required />
</div>
<div class="am-form-group">
<label class="block">是否启用</label>
<input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if !empty($data) and $data['is_enable'] eq 1}} checked="true"{{/if}} />
</div>
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->

View File

@ -70,7 +70,7 @@
{{/if}}
<!-- 插件扩展数据 end -->
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}}value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -91,7 +91,7 @@
<label>{{$data.home_footer_info.name}}<span class="am-form-group-label-tips">{{$data.home_footer_info.describe}}</span></label>
<textarea rows="6" name="{{$data.home_footer_info.only_tag}}" class="am-radius" placeholder="{{$data.home_footer_info.name}}" data-validation-message="{{$data.home_footer_info.error_tips}}">{{if !empty($data)}}{{$data.home_footer_info.value}}{{/if}}</textarea>
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="nav_type" value="{{$nav_type}}" />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -69,7 +69,7 @@
<label class="block">是否启用</label>
<input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (!empty($data) and $data['is_enable'] eq 1) or empty($data)}}checked="true"{{/if}} />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -106,7 +106,7 @@
{{/if}}
<!-- 插件扩展数据 end -->
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>

View File

@ -11,6 +11,27 @@
// 应用公共文件
/**
* 当前应用平台
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-11
* @desc description
*/
function ApplicationClientType()
{
// 平台
$platform = APPLICATION_CLIENT_TYPE;
// web端手机访问
if($platform == 'pc' && IsMobile())
{
$platform = 'h5';
}
return $platform;
}
/**
* 是否微信环境
* @author Devil

View File

@ -14,6 +14,7 @@ use think\facade\Hook;
use think\Controller;
use app\module\FormHandleModule;
use app\service\SystemService;
use app\service\ResourcesService;
use app\service\GoodsService;
use app\service\NavigationService;
use app\service\BuyService;
@ -22,7 +23,7 @@ use app\service\SearchService;
use app\service\ConfigService;
use app\service\LinkService;
use app\service\UserService;
use app\service\ResourcesService;
use app\service\QuickNavService;
/**
* 前端公共控制器
@ -34,11 +35,10 @@ use app\service\ResourcesService;
*/
class Common extends Controller
{
// 顶部导航
// 顶部导航、底部导航、快捷导航
protected $nav_header;
// 底部导航
protected $nav_footer;
protected $nav_quick;
// 用户信息
protected $user;
@ -324,6 +324,7 @@ class Common extends Controller
// 导航
$this->assign('nav_header', $this->nav_header);
$this->assign('nav_footer', $this->nav_footer);
$this->assign('nav_quick', $this->nav_quick);
// 导航/底部默认显示
$this->assign('is_header', 1);
@ -443,9 +444,13 @@ class Common extends Controller
*/
private function NavInit()
{
$navigation = NavigationService::Nav();
$this->nav_header = $navigation['header'];
$this->nav_footer = $navigation['footer'];
// 主导航和底部导航
$nav = NavigationService::Nav();
$this->nav_header = $nav['header'];
$this->nav_footer = $nav['footer'];
// 快捷导航
$this->nav_quick = QuickNavService::QuickNav();
}
/**

View File

@ -196,7 +196,7 @@
</ul>
<!-- 地图 -->
<div class="extraction-address-map-container popup-not-title">
<span class="am-close am-close-alt am-icon-times am-close-spin"></span>
<span class="am-close am-close-alt am-icon-times"></span>
<div id="extraction-map"></div>
</div>
</div>

View File

@ -118,4 +118,30 @@
</p>
</div>
</footer>
{{/if}}
<!-- 快捷导航 -->
{{if !empty($nav_quick) and is_array($nav_quick)}}
<a href="javascript:;" class="am-icon-btn am-icon-sliders common-main-quick-menu" data-am-modal="{target: '#common-main-quick-popup'}"></a>
<div class="am-popup popup-not-title" id="common-main-quick-popup">
<div class="am-popup-inner">
<span data-am-modal-close class="am-close am-close-alt am-icon-times"></span>
<div class="am-popup-bd">
<ul class="am-avg-sm-3 am-avg-md-4 am-avg-lg-4 common-main-quick-content">
{{foreach $nav_quick as $nav}}
{{if !empty($nav['images_url']) and !empty($nav['name'])}}
<li class="am-text-center am-padding-sm {{if isset($nav['class_name'])}}{{$nav.class_name}}{{/if}}">
<a href="{{if !empty($nav['event_value'])}}{{$nav.event_value}}{{else /}}javascript:;{{/if}}">
<p class="nav-icon" style="{{if !empty($nav['bg_color'])}}background:{{$nav.bg_color}};{{/if}}">
<img src="{{$nav.images_url}}" alt="{{$nav.name}}" />
</p>
<p class="am-margin-top-xs am-text-truncate">{{$nav.name}}</p>
</a>
</li>
{{/if}}
{{/foreach}}
</ul>
</div>
</div>
</div>
{{/if}}

View File

@ -30,13 +30,13 @@
</div>
<div class="user-form-container">
<!-- form start -->
<form class="am-form form-validation" method="post" action="{{:MyUrl('index/user/forgetpwd')}}" request-type="ajax-url" request-value="{{:MyUrl('index/user/logininfo')}}">
<form class="am-form form-validation am-padding-bottom-sm" method="post" action="{{:MyUrl('index/user/forgetpwd')}}" request-type="ajax-url" request-value="{{:MyUrl('index/user/logininfo')}}">
<div class="am-form-group am-form-group-refreshing business-form-block">
<label>手机/邮箱</label>
<input type="text" name="accounts" class="am-radius" id="accounts" minlength="1" placeholder="手机/邮箱" data-validation-message="手机/邮箱格式有误" required />
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="number" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="验证码格式 4 位数字" required />
@ -46,7 +46,7 @@
</div>
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>设置登录密码</label>
<div class="am-input-group am-input-group-sm">
<input type="password" name="pwd" class="am-radius" placeholder="设置登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
@ -56,7 +56,7 @@
</div>
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-sm">
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-block am-btn-sm btn-loading-example" data-am-loading="{loadingText: '处理中...'}">确认</button>
</div>
</form>
@ -67,7 +67,7 @@
<div class="am-modal am-modal-no-btn" tabindex="-1" id="verify-win">
<div class="am-modal-dialog am-radius">
<div class="am-modal-hd">
<a href="javascript:;" class="am-close am-close-spin" data-am-modal-close>&times;</a>
<a href="javascript:;" class="am-close" data-am-modal-close>&times;</a>
</div>
<div class="am-modal-bd">
<div class="base">

View File

@ -45,19 +45,19 @@
</div>
<div class="user-form-container">
<!-- form start -->
<form class="am-form form-validation" method="post" action="{{:MyUrl('index/user/login')}}" request-type="ajax-fun" request-value="LoginSuccessBack">
<form class="am-form form-validation am-padding-bottom-sm" method="post" action="{{:MyUrl('index/user/login')}}" request-type="ajax-fun" request-value="LoginSuccessBack">
<div class="am-form-group am-form-group-refreshing">
<label>登录账号</label>
<input type="text" name="accounts" class="am-radius" minlength="1" placeholder="用户名/手机/邮箱" data-validation-message="请填写登录账号" required />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-xs">
<label>登录密码</label>
<input type="password" name="pwd" class="am-radius" placeholder="登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
</div>
{{if MyC('home_user_login_img_verify_state') eq 1}}
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="text" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="请输入图片验证码" required />
@ -71,7 +71,7 @@
</div>
{{/if}}
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-sm">
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-sm btn-loading-example" data-am-loading="{loadingText: '登录中...'}">登录</button>
<a href="{{:MyUrl('index/user/forgetpwdinfo')}}" class="am-fr">忘记密码?</a>
</div>

View File

@ -30,13 +30,13 @@
<input type="text" name="accounts" class="am-radius" minlength="1" placeholder="用户名/手机/邮箱" data-validation-message="请填写登录账号" required />
</div>
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-xs">
<label>登录密码</label>
<input type="password" name="pwd" class="am-radius" placeholder="登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
</div>
{{if MyC('home_user_login_img_verify_state') eq 1}}
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="text" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="请输入图片验证码" required />
@ -50,7 +50,7 @@
</div>
{{/if}}
<div class="am-form-group am-form-group-refreshing">
<div class="am-form-group am-form-group-refreshing am-margin-top-sm">
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-sm btn-loading-example" data-am-loading="{loadingText: '登录中...'}">登录</button>
<a href="{{:MyUrl('index/user/forgetpwdinfo')}}" target="_blank" class="am-fr">忘记密码?</a>
</div>

View File

@ -66,7 +66,7 @@
<li class="{{if !in_array('username', MyC('home_user_reg_state')) and !in_array('sms', MyC('home_user_reg_state'))}}am-active{{/if}}"><a href="[data-tab-panel-2]">邮箱注册</a></li>
{{/if}}
</ul>
<div class="am-tabs-bd">
<div class="am-tabs-bd am-padding-bottom-sm">
{{if in_array('username', MyC('home_user_reg_state'))}}
<div data-tab-panel-0 class="am-tab-panel am-active">
<!-- form start -->
@ -76,7 +76,7 @@
<input type="text" name="accounts" class="am-radius" placeholder="请使用字母、数字、下划线 2~18 个字符" pattern="{{:lang('common_regex_username')}}" data-validation-message="用户名格式由 字母数字下划线 2~18 个字符" required />
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>设置登录密码</label>
<div class="am-input-group am-input-group-sm">
<input type="password" name="pwd" class="am-radius" placeholder="设置登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
@ -87,7 +87,7 @@
</div>
{{if MyC('home_user_register_img_verify_state') eq 1}}
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="text" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="请输入图片验证码" required />
@ -127,7 +127,7 @@
<input type="text" name="accounts" class="am-radius" placeholder="请输入手机号码" pattern="{{:lang('common_regex_mobile')}}" data-validation-message="手机号码格式错误" required />
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="number" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="验证码格式 4 位数字" required />
@ -137,7 +137,7 @@
</div>
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>设置登录密码</label>
<div class="am-input-group am-input-group-sm">
<input type="password" name="pwd" class="am-radius" placeholder="设置登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
@ -173,7 +173,7 @@
<input type="email" name="accounts" class="am-radius" placeholder="请输入电子邮箱" data-validation-message="电子邮箱格式错误" required />
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>验证码</label>
<div class="am-input-group am-input-group-sm">
<input type="number" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="验证码格式 4 位数字" required />
@ -183,7 +183,7 @@
</div>
</div>
<div class="am-form-group am-form-group-refreshing business-form-block">
<div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
<label>设置登录密码</label>
<div class="am-input-group am-input-group-sm">
<input type="password" name="pwd" class="am-radius" placeholder="设置登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
@ -218,7 +218,7 @@
<div class="am-modal am-modal-no-btn" tabindex="-1" id="verify-win">
<div class="am-modal-dialog am-radius">
<div class="am-modal-hd">
<a href="javascript:;" class="am-close am-close-spin" data-am-modal-close>&times;</a>
<a href="javascript:;" class="am-close" data-am-modal-close>&times;</a>
</div>
<div class="am-modal-bd">
<div class="base">

View File

@ -11,6 +11,7 @@
namespace app\service;
use think\Db;
use think\facade\Hook;
use app\service\ResourcesService;
/**
@ -275,19 +276,39 @@ class AppCenterNavService
*/
public static function AppCenterNav($params = [])
{
$client_type = (APPLICATION_CLIENT_TYPE == 'pc') ? (IsMobile() ? 'h5' : 'pc') : APPLICATION_CLIENT_TYPE;
$field = 'id,name,images_url,event_value,event_type,desc';
$order_by = 'sort asc,id asc';
$data = Db::name('AppCenterNav')->field($field)->where(['platform'=>$client_type, 'is_enable'=>1])->order($order_by)->select();
if(!empty($data))
// 平台
$platform = ApplicationClientType();
// 缓存
$key = config('shopxo.cache_app_user_center_navigation_key').$platform;
$data = cache($key);
if(empty($data))
{
foreach($data as &$v)
$field = 'id,name,images_url,event_value,event_type,desc';
$order_by = 'sort asc,id asc';
$data = Db::name('AppCenterNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select();
if(!empty($data))
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
foreach($data as &$v)
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
}
}
// 存储缓存
cache($key, $data, 3600*24);
}
// 手机用户中心导航钩子
$hook_name = 'plugins_service_app_user_center_navigation_'.$platform;
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'data' => &$data,
]);
return $data;
}
}

View File

@ -11,6 +11,7 @@
namespace app\service;
use think\Db;
use think\facade\Hook;
use app\service\ResourcesService;
/**
@ -271,16 +272,10 @@ class AppHomeNavService
public static function AppHomeNav($params = [])
{
// 平台
$platform = APPLICATION_CLIENT_TYPE;
// web端手机访问
if($platform == 'pc' && IsMobile())
{
$platform = 'h5';
}
$platform = ApplicationClientType();
// 缓存
$key = config('shopxo.cache_navigation_key').$platform;
$key = config('shopxo.cache_app_home_navigation_key').$platform;
$data = cache($key);
if(empty($data))
@ -302,6 +297,15 @@ class AppHomeNavService
// 存储缓存
cache($key, $data, 3600*24);
}
// 手机首页导航钩子
$hook_name = 'plugins_service_app_home_navigation_'.$platform;
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'data' => &$data,
]);
return $data;
}
}

View File

@ -34,13 +34,7 @@ class BannerService
public static function Banner($params = [])
{
// 平台
$platform = APPLICATION_CLIENT_TYPE;
// web端手机访问
if($platform == 'pc' && IsMobile())
{
$platform = 'h5';
}
$platform = ApplicationClientType();
// 缓存
$key = config('shopxo.cache_banner_list_key').$platform;

View File

@ -1029,7 +1029,7 @@ class BuyService
$order_status = (intval(MyC('common_order_is_booking', 0)) == 1) ? 0 : 1;
// 订单来源
$client_type = (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE;
$client_type = ApplicationClientType();
// 开始事务
Db::startTrans();

View File

@ -250,28 +250,25 @@ class OrderService
}
// 微信中打开并且webopenid为空
if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
if(ApplicationClientType() == 'h5' && IsWeixinEnv() && empty($pay_data['user']['weixin_web_openid']))
{
if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($pay_data['user']['weixin_web_openid']))
// 授权成功后回调订单详情页面重新自动发起支付
// 单个订单进入详情,则进入列表
$weixin_params = [
'is_pay_auto' => 1,
'is_pay_submit' => 1,
'payment_id' => $payment['id'],
];
if(count($order_ids) == 1)
{
// 授权成功后回调订单详情页面重新自动发起支付
// 单个订单进入详情,则进入列表
$weixin_params = [
'is_pay_auto' => 1,
'is_pay_submit' => 1,
'payment_id' => $payment['id'],
];
if(count($order_ids) == 1)
{
$weixin_params['id'] = $order_ids[0];
$weixin_params['ids'] = $order_ids[0];
$url = MyUrl('index/order/detail', $weixin_params);
} else {
$weixin_params['ids'] = urldecode(implode(',', $order_ids));
$url = MyUrl('index/order/index', $weixin_params);
}
session('plugins_weixinwebauth_pay_callback_view_url', $url);
$weixin_params['id'] = $order_ids[0];
$weixin_params['ids'] = $order_ids[0];
$url = MyUrl('index/order/detail', $weixin_params);
} else {
$weixin_params['ids'] = urldecode(implode(',', $order_ids));
$url = MyUrl('index/order/index', $weixin_params);
}
session('plugins_weixinwebauth_pay_callback_view_url', $url);
}
// 发起支付

View File

@ -0,0 +1,312 @@
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\service;
use think\Db;
use think\facade\Hook;
use app\service\ResourcesService;
/**
* 快捷导航服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class QuickNavService
{
/**
* 首页导航列表
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public static function QuickNavList($params = [])
{
$where = empty($params['where']) ? [] : $params['where'];
$field = empty($params['field']) ? '*' : $params['field'];
$order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']);
$m = isset($params['m']) ? intval($params['m']) : 0;
$n = isset($params['n']) ? intval($params['n']) : 10;
// 获取品牌列表
$data = Db::name('QuickNav')->where($where)->order($order_by)->limit($m, $n)->select();
if(!empty($data))
{
$common_platform_type = lang('common_platform_type');
$common_app_event_type = lang('common_app_event_type');
foreach($data as &$v)
{
// 平台类型
if(isset($v['platform']))
{
$v['platform_text'] = $common_platform_type[$v['platform']]['name'];
}
// 事件类型
if(isset($v['event_type']) && $v['event_type'] != -1)
{
$v['event_type_text'] = $common_app_event_type[$v['event_type']]['name'];
}
// 图片地址
if(isset($v['images_url']))
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
}
// 时间
if(isset($v['add_time']))
{
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
}
if(isset($v['upd_time']))
{
$v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']);
}
}
}
return DataReturn('处理成功', 0, $data);
}
/**
* 首页导航总数
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-10T22:16:29+0800
* @param [array] $where [条件]
*/
public static function QuickNavTotal($where)
{
return (int) Db::name('QuickNav')->where($where)->count();
}
/**
* 首页导航数据保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-19
* @desc description
* @param [array] $params [输入参数]
*/
public static function QuickNavSave($params = [])
{
// 请求类型
$p = [
[
'checked_type' => 'length',
'key_name' => 'name',
'checked_data' => '2,60',
'error_msg' => '名称长度 2~60 个字符',
],
[
'checked_type' => 'in',
'key_name' => 'platform',
'checked_data' => array_column(lang('common_platform_type'), 'value'),
'error_msg' => '平台类型有误',
],
[
'checked_type' => 'in',
'key_name' => 'event_type',
'checked_data' => array_column(lang('common_app_event_type'), 'value'),
'is_checked' => 2,
'error_msg' => '事件值类型有误',
],
[
'checked_type' => 'length',
'key_name' => 'event_value',
'checked_data' => '255',
'error_msg' => '事件值最多 255 个字符',
],
[
'checked_type' => 'empty',
'key_name' => 'images_url',
'checked_data' => '255',
'error_msg' => '请上传图片',
],
[
'checked_type' => 'length',
'key_name' => 'sort',
'checked_data' => '3',
'error_msg' => '顺序 0~255 之间的数值',
],
];
$ret = ParamsChecked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
// 附件
$data_fields = ['images_url'];
$attachment = ResourcesService::AttachmentParams($params, $data_fields);
// 数据
$data = [
'name' => $params['name'],
'platform' => $params['platform'],
'event_type' => isset($params['event_type']) ? intval($params['event_type']) : -1,
'event_value' => $params['event_value'],
'images_url' => $attachment['data']['images_url'],
'bg_color' => isset($params['bg_color']) ? $params['bg_color'] : '',
'sort' => intval($params['sort']),
'is_enable' => isset($params['is_enable']) ? intval($params['is_enable']) : 0,
];
if(empty($params['id']))
{
$data['add_time'] = time();
if(Db::name('QuickNav')->insertGetId($data) > 0)
{
return DataReturn('添加成功', 0);
}
return DataReturn('添加失败', -100);
} else {
$data['upd_time'] = time();
if(Db::name('QuickNav')->where(['id'=>intval($params['id'])])->update($data))
{
return DataReturn('编辑成功', 0);
}
return DataReturn('编辑失败', -100);
}
}
/**
* 首页导航删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-18
* @desc description
* @param [array] $params [输入参数]
*/
public static function QuickNavDelete($params = [])
{
// 参数是否有误
if(empty($params['ids']))
{
return DataReturn('操作id有误', -1);
}
// 是否数组
if(!is_array($params['ids']))
{
$params['ids'] = explode(',', $params['ids']);
}
// 删除操作
if(Db::name('QuickNav')->where(['id'=>$params['ids']])->delete())
{
return DataReturn('删除成功');
}
return DataReturn('删除失败', -100);
}
/**
* 首页导航状态更新
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public static function QuickNavStatusUpdate($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'id',
'error_msg' => '操作id有误',
],
[
'checked_type' => 'empty',
'key_name' => 'field',
'error_msg' => '操作字段有误',
],
[
'checked_type' => 'in',
'key_name' => 'state',
'checked_data' => [0,1],
'error_msg' => '状态有误',
],
];
$ret = ParamsChecked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
// 数据更新
if(Db::name('QuickNav')->where(['id'=>intval($params['id'])])->update([$params['field']=>intval($params['state']), 'upd_time'=>time()]))
{
return DataReturn('操作成功');
}
return DataReturn('操作失败', -100);
}
/**
* APP获取首页导航
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-11-19
* @desc description
* @param array $params [description]
*/
public static function QuickNav($params = [])
{
// 平台
$platform = ApplicationClientType();
// 缓存
$key = config('shopxo.cache_quick_navigation_key').$platform;
$data = cache($key);
if(empty($data))
{
// 获取导航数据
$field = 'id,name,images_url,event_value,event_type,bg_color';
$order_by = 'sort asc,id asc';
$data = Db::name('QuickNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select();
if(!empty($data))
{
foreach($data as &$v)
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
}
}
// 存储缓存
cache($key, $data, 3600*24);
}
// 快捷导航钩子
// 数据参数可以自定义新增 class_name 名称、方便非url事件使用js控制点击事件
$hook_name = 'plugins_service_quick_navigation_'.$platform;
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'data' => &$data,
]);
return $data;
}
}
?>

View File

@ -35,14 +35,18 @@ return array (
'plugins_css' =>
array (
0 => 'app\\plugins\\share\\Hook',
1 => 'app\\plugins\\exchangerate\\Hook',
2 => 'app\\plugins\\freightfee\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\share\\Hook',
1 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_view_common_bottom' =>
array (
0 => 'app\\plugins\\share\\Hook',
1 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_common_page_bottom' =>
array (
@ -95,6 +99,14 @@ return array (
array (
0 => 'app\\plugins\\wallet\\Hook',
),
'plugins_service_quick_navigation_pc' =>
array (
0 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_service_quick_navigation_h5' =>
array (
0 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_service_currency_price_symbol' =>
array (
0 => 'app\\plugins\\exchangerate\\Hook',
@ -111,5 +123,13 @@ return array (
array (
0 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_service_buy_group_goods_handle' =>
array (
0 => 'app\\plugins\\freightfee\\Hook',
),
'plugins_view_goods_detail_title' =>
array (
0 => 'app\\plugins\\freightfee\\Hook',
),
);
?>

View File

@ -54,8 +54,14 @@ return [
// 轮播缓存信息
'cache_banner_list_key' => 'cache_banner_list_data_',
// 导航缓存信息
'cache_navigation_key' => 'cache_navigation_data_',
// 手机首页导航缓存信息
'cache_app_home_navigation_key' => 'cache_app_home_navigation_data_',
// 手机用户中心导航缓存信息
'cache_app_user_center_navigation_key' => 'cache_app_user_center_navigation_data_',
// 快捷导航缓存信息
'cache_quick_navigation_key' => 'cache_quick_navigation_data_',
// 附件host、最后不要带/斜杠结尾, 数据库图片地址以/static/...开头
'attachment_host' => defined('__MY_PUBLIC_URL__') ? substr(__MY_PUBLIC_URL__, 0, -1) : '',

View File

@ -217,7 +217,7 @@ class QQ
// 手机模式下直接返回微信的支付url地址打开支付缺点是支付后会直接关闭站点
// QQ支付本身没有提供H5支付方案这种方式也可以直接支付缺点是支付后不能回调到原来浏览器
// 公众号后续再采用公众号的方式支付,体验会更好一些,只是可以不关闭站点
if(APPLICATION_CLIENT_TYPE == 'h5' || IsMobile())
if(ApplicationClientType() == 'h5')
{
$result = DataReturn('success', 0, $data['code_url']);
} else {
@ -312,6 +312,10 @@ class QQ
*/
private function GetTradeType()
{
// 平台
$client_type = ApplicationClientType();
// 平台类型定义
$type_all = [
'pc' => 'NATIVE',
'h5' => 'NATIVE',
@ -321,7 +325,7 @@ class QQ
'android' => 'APP',
];
return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : '';
return isset($type_all[$client_type]) ? $type_all[$client_type] : '';
}
/**

View File

@ -162,12 +162,9 @@ class Weixin
}
// 微信中打开
if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
if(ApplicationClientType() == 'h5' && IsWeixinEnv())
{
if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($params['user']['weixin_web_openid']))
{
exit(header('location:'.PluginsHomeUrl('weixinwebauthorization', 'pay', 'index', input())));
}
exit(header('location:'.PluginsHomeUrl('weixinwebauthorization', 'pay', 'index', input())));
}
// 获取支付参数
@ -246,7 +243,7 @@ class Weixin
$pay_data['paySign'] = $this->GetSign($pay_data);
// 微信中
if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']) && !empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false)
if(ApplicationClientType() == 'h5' && IsWeixinEnv())
{
$this->PayHtml($pay_data, $redirect_url);
} else {
@ -383,6 +380,10 @@ class Weixin
*/
private function GetTradeType()
{
// 平台
$client_type = ApplicationClientType();
// 平台类型定义
$type_all = [
'pc' => 'NATIVE',
'weixin' => 'JSAPI',
@ -393,22 +394,13 @@ class Weixin
'android' => 'APP',
];
// 手机中打开pc版本
if(APPLICATION_CLIENT_TYPE == 'pc' && IsMobile())
{
$type_all['pc'] = $type_all['h5'];
}
// 微信中打开
if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
if($client_type == 'h5' && IsWeixinEnv())
{
if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false)
{
$type_all['pc'] = $type_all['weixin'];
}
$type_all['pc'] = $type_all['weixin'];
}
return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : '';
return isset($type_all[$client_type]) ? $type_all[$client_type] : '';
}
/**

View File

@ -0,0 +1,12 @@
/**
* 列表
*/
.nav-icon-circle {
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
}
table.am-table .nav-icon-circle {
margin: 0 auto;
}

View File

@ -150,7 +150,7 @@ dialog.popup = function(options) {
} else {
html.push('<div class="am-popup '+options.class+' popup-not-title">');
html.push('<div class="am-popup-inner">');
html.push('<span data-am-modal-close class="am-close am-close-alt am-icon-times am-close-spin"></span>');
html.push('<span data-am-modal-close class="am-close am-close-alt am-icon-times"></span>');
html.push(options.content);
}
html.push('</div> ');

View File

@ -4,7 +4,7 @@
.article-header .am-article-divider{margin: 10px 0 20px 0;}
.article-header .am-article-meta{margin-top: 5px;}
.article-header .am-article-meta span:not(:first-child){margin-left: 15px;}
.article-nav-button{position: fixed; z-index: 10; bottom: 70px; right: 10px;}
.article-nav-button{position: fixed; z-index: 10; bottom: 70px; right: 10px;-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);-moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);}
.am-offcanvas-bar:after{background: #eee;}
.article-sidebar ul li{margin-top: 0;}
.article-sidebar ul li a{font-size: 12px; padding: 5px;}

View File

@ -44,7 +44,7 @@ strong.total-price-content, .selected-tips strong, .nav-total-price { color: #d2
.nav-right { width: 68%; }
.cart-nav, .nav-left, .nav-right { overflow: hidden; }
.nav-right .nav-total-price { display: block;
width: calc(100% - 175px); height: 30px; -o-text-overflow: ellipsis; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
width: calc(100% - 182px); height: 30px; -o-text-overflow: ellipsis; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.cart-nav .separate-submit { float: right; }
.wap-base { padding-left: 20px; }

View File

@ -967,4 +967,52 @@ legend a.am-fr {
}
.items-value-empty {
color: #999;
}
/**
* 手机端快捷入口
*/
.common-main-quick-menu {
background: #d2354c;
color: #fff;
position: fixed;
left: 10px;
bottom:70px;
z-index: 1020;
-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}
.common-main-quick-menu:hover, .common-main-quick-menu:focus {
background: #ea304b;
color: #fff;
}
.common-main-quick-content li .nav-icon {
background: #e4e4e4;
border-radius: 50%;
width: 50px;
height: 50px;
line-height: 50px;
display: inline-block;
}
.common-main-quick-content li .nav-icon img {
width: 25px;
height: 25px;
-webkit-transition: transform .3s ease-in;
-moz-transition: transform .3s ease-in;
-ms-transition: transform .3s ease-in;
-o-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.common-main-quick-content li a {
text-decoration: none;
}
@media only screen and (min-width:641px){
.common-main-quick-content li:hover .nav-icon img {
transform: scale(1.2);
-moz-transform: scale(1.2);
-webkit-transform: scale(1.2);
-o-transform: scale(1.2);
-ms-transform: scale(1.2);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB