小程序开发

This commit is contained in:
devil_gong 2019-07-03 21:03:28 +08:00
parent d77989f7d2
commit 61016b063e
35 changed files with 1009 additions and 76 deletions

View File

@ -0,0 +1,206 @@
<?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\AppCenterNavService;
/**
* 手机管理-用户中心导航管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class AppCenterNav 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()
{
// 参数
$params = input();
// 分页
$number = MyC('admin_page_number', 10, true);
// 条件
$where = AppCenterNavService::AppCenterNavListWhere($params);
// 获取总数
$total = AppCenterNavService::AppCenterNavTotal($where);
// 分页
$page_params = array(
'number' => $number,
'total' => $total,
'where' => $params,
'page' => isset($params['page']) ? intval($params['page']) : 1,
'url' => MyUrl('admin/appcenternav/index'),
);
$page = new \base\Page($page_params);
$this->assign('page_html', $page->GetPageHtml());
// 获取列表
$data_params = array(
'm' => $page->GetPageStarNumber(),
'n' => $number,
'where' => $where,
'field' => '*',
);
$data = AppCenterNavService::AppCenterNavList($data_params);
$this->assign('data_list', $data['data']);
// 是否启用
$this->assign('common_is_enable_list', lang('common_is_enable_list'));
// 是否
$this->assign('common_is_text_list', lang('common_is_text_list'));
// 所属平台
$this->assign('common_platform_type', lang('common_platform_type'));
// app事件类型
$this->assign('common_app_event_type', lang('common_app_event_type'));
// 参数
$this->assign('params', $params);
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 = input();
// 数据
$data = [];
if(!empty($params['id']))
{
// 获取列表
$data_params = array(
'm' => 0,
'n' => 1,
'where' => ['id'=>intval($params['id'])],
'field' => '*',
);
$ret = AppCenterNavService::AppCenterNavList($data_params);
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
}
$this->assign('data', $data);
// 所属平台
$this->assign('common_platform_type', lang('common_platform_type'));
// app事件类型
$this->assign('common_app_event_type', lang('common_app_event_type'));
// 参数
$this->assign('params', $params);
// 编辑器文件存放地址
$this->assign('editor_path_type', 'app_center_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 = input();
return AppCenterNavService::AppCenterNavSave($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 = input();
$params['user_type'] = 'admin';
return AppCenterNavService::AppCenterNavDelete($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 = input();
return AppCenterNavService::AppCenterNavStatusUpdate($params);
}
}
?>

View File

@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\service\AppNavService;
use app\service\AppHomeNavService;
/**
* 手机管理-首页导航管理
@ -56,10 +56,10 @@ class AppHomeNav extends Common
$number = MyC('admin_page_number', 10, true);
// 条件
$where = AppNavService::AppHomeNavListWhere($params);
$where = AppHomeNavService::AppHomeNavListWhere($params);
// 获取总数
$total = AppNavService::AppHomeNavTotal($where);
$total = AppHomeNavService::AppHomeNavTotal($where);
// 分页
$page_params = array(
@ -79,7 +79,7 @@ class AppHomeNav extends Common
'where' => $where,
'field' => '*',
);
$data = AppNavService::AppHomeNavList($data_params);
$data = AppHomeNavService::AppHomeNavList($data_params);
$this->assign('data_list', $data['data']);
// 是否启用
@ -122,7 +122,7 @@ class AppHomeNav extends Common
'where' => ['id'=>intval($params['id'])],
'field' => '*',
);
$ret = AppNavService::AppHomeNavList($data_params);
$ret = AppHomeNavService::AppHomeNavList($data_params);
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
}
$this->assign('data', $data);
@ -159,7 +159,7 @@ class AppHomeNav extends Common
// 开始处理
$params = input();
return AppNavService::AppHomeNavSave($params);
return AppHomeNavService::AppHomeNavSave($params);
}
/**
@ -180,7 +180,7 @@ class AppHomeNav extends Common
// 开始处理
$params = input();
$params['user_type'] = 'admin';
return AppNavService::AppHomeNavDelete($params);
return AppHomeNavService::AppHomeNavDelete($params);
}
/**
@ -200,7 +200,7 @@ class AppHomeNav extends Common
// 开始处理
$params = input();
return AppNavService::AppHomeNavStatusUpdate($params);
return AppHomeNavService::AppHomeNavStatusUpdate($params);
}
}
?>

View File

@ -0,0 +1,206 @@
{{include file="public/header" /}}
<!-- right content start -->
<div class="content-right">
<div class="content">
<!-- form start -->
<form class="am-form form-validation form-search" method="post" action="{{:MyUrl('admin/appcenternav/index')}}" request-type="form">
<div class="thin">
<div class="am-input-group am-input-group-sm am-fl so">
<input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="名称" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
<span class="am-input-group-btn">
<button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
</span>
</div>
<label class="am-fl thin_sub more-submit">
更多筛选条件
{{if isset($params['is_more']) and $params['is_more'] eq 1}}
<input type="checkbox" name="is_more" value="1" id="is_more" checked />
<i class="am-icon-angle-up"></i>
{{else /}}
<input type="checkbox" name="is_more" value="1" id="is_more" />
<i class="am-icon-angle-down"></i>
{{/if}}
</label>
</div>
<table class="so-list more-where {{if !isset($params['is_more'])}}none{{/if}}">
<tbody>
<tr>
<td>
<span>平台:</span>
<select name="platform" class="chosen-select" data-placeholder="所属平台...">
<option value="">所属平台...</option>
{{foreach $common_platform_type as $v}}
{{if !in_array($v['value'], ['pc'])}}
<option value="{{$v.value}}" {{if isset($params['platform']) and $params['platform'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/if}}
{{/foreach}}
</select>
</td>
<td>
<span>类型:</span>
<select name="event_type" class="chosen-select" data-placeholder="事件类型...">
<option value="-1">事件类型...</option>
{{foreach $common_app_event_type as $v}}
<option value="{{$v.value}}" {{if isset($params['event_type']) and $params['event_type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td>
<span>启用:</span>
<select name="is_enable" class="chosen-select" data-placeholder="是否启用...">
<option value="-1">是否启用...</option>
{{foreach $common_is_enable_list as $v}}
<option value="{{$v.id}}" {{if isset($params['is_enable']) and $params['is_enable'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</td>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
<em class="text-grey">~</em>
<span>
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/appcenternav/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
</td>
</tr>
</tbody>
</table>
</form>
<!-- form end -->
<!-- operation start -->
<div class="am-g m-t-15">
<a href="{{:MyUrl('admin/appcenternav/saveinfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> 新增</a>
</div>
<!-- operation end -->
<!-- list start -->
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
<thead>
<tr>
<th>名称</th>
<th class="am-hide-sm-only">所属平台</th>
<th>导航图标</th>
<th class="am-hide-sm-only">事件值</th>
<th class="am-hide-sm-only">启用</th>
<th>更多</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{{if !empty($data_list)}}
{{foreach $data_list as $v}}
<tr id="data-list-{{$v.id}}" {{if $v['is_enable'] eq 0}}class="am-active"{{/if}}>
<td>{{$v.name}}</td>
<td class="am-hide-sm-only">{{$v.platform_text}}</td>
<td>
{{if !empty($v['images_url'])}}
<a href="{{$v['images_url']}}" target="_blank">
<img src="{{$v['images_url']}}" class="am-radius am-vertical-align-middle" width="30" height="30" />
</a>
{{else /}}
<span class="cr-ddd">暂无图片</span>
{{/if}}
</td>
<td class="am-hide-sm-only">
<div class="event-value">
{{$v.event_value}}
{{if !empty($v['event_value'])}}
<br /><span class="am-badge am-badge-warning am-radius">{{$v.event_type_text}}</span>
{{/if}}
</div>
</td>
<td class="am-hide-sm-only">
<a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/appcenternav/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}" data-field="is_enable" data-is-update-status="1"></a>
</td>
<td>
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> 查看更多</span>
<div class="am-popup am-radius" id="my-popup{{$v.id}}">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">详情内容</h4>
<span data-am-modal-close
class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<dl class="dl-content">
<dt>名称</dt>
<dd>{{$v.name}}</dd>
<dt>所属平台</dt>
<dd>{{$v.platform_text}}</dd>
<dt>导航图标</dt>
<dd>
{{if !empty($v['images_url'])}}
<a href="{{$v['images_url']}}" target="_blank">
<img src="{{$v['images_url']}}" class="am-radius am-vertical-align-middle" width="30" height="30" />
</a>
{{else /}}
<span class="cr-ddd">暂无图片</span>
{{/if}}
</dd>
<dt>事件值</dt>
<dd>
<div class="event-value">
{{$v.event_value}}
{{if !empty($v['event_value'])}}
<br /><span class="am-badge am-badge-warning am-radius">{{$v.event_type_text}}</span>
{{/if}}
</div>
</dd>
<dt>启用</dt>
<dd>{{$v.is_enable_text}}</dd>
<dt>创建时间</dt>
<dd>{{$v.add_time_time}}</dd>
<dt>更新时间</dt>
<dd>{{$v.upd_time_time}}</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="view-operation">
<a href="{{:MyUrl('admin/appcenternav/saveinfo', array_merge($params, ['id'=>$v['id']]))}}">
<button class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-edit"> 编辑</button>
</a>
<button class="am-btn am-btn-danger am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:MyUrl('admin/appcenternav/delete')}}" data-id="{{$v.id}}"> 删除</button>
</td>
</tr>
{{/foreach}}
{{/if}}
</tbody>
</table>
{{if empty($data_list)}}
<div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
{{/if}}
<!-- list end -->
<!-- page start -->
{{if !empty($data_list)}}
{{$page_html|raw}}
{{/if}}
<!-- page end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->

View File

@ -0,0 +1,91 @@
{{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/appcenternav/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/appcenternav/index', $params)}}" enctype="multipart/form-data">
<legend>
<span class="fs-16">
{{if empty($data['id'])}}
导航添加
{{else /}}
导航编辑
{{/if}}
</span>
<a href="{{:MyUrl('admin/appcenternav/index', $params)}}" class="fr fs-14 m-t-5 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}}
{{if !in_array($v['value'], ['pc'])}}
<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>
{{/if}}
{{/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}}
<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>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<div class="am-alert am-alert-warning am-radius" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p class="fs-12">
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">
<label>描述</label>
<input type="text" name="desc" placeholder="描述" data-validation-message="描述最多 18 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.desc}}"{{/if}} />
</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="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">
<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

@ -99,12 +99,12 @@
<thead>
<tr>
<th>名称</th>
<th>所属平台</th>
<th class="am-hide-sm-only">所属平台</th>
<th>导航图标</th>
<th>事件值</th>
<th>登录</th>
<th>启用</th>
<th>创建时间</th>
<th class="am-hide-sm-only">事件值</th>
<th class="am-hide-sm-only">登录</th>
<th class="am-hide-sm-only">启用</th>
<th>更多</th>
<th>操作</th>
</tr>
</thead>
@ -113,7 +113,7 @@
{{foreach $data_list as $v}}
<tr id="data-list-{{$v.id}}" {{if $v['is_enable'] eq 0}}class="am-active"{{/if}}>
<td>{{$v.name}}</td>
<td>{{$v.platform_text}}</td>
<td class="am-hide-sm-only">{{$v.platform_text}}</td>
<td>
<div class="am-circle nav-icon-circle am-vertical-align" {{if !empty($v['bg_color'])}}style="background-color:{{$v.bg_color}};"{{/if}}>
{{if !empty($v['images_url'])}}
@ -125,7 +125,7 @@
{{/if}}
</div>
</td>
<td>
<td class="am-hide-sm-only">
{{$v.event_value}}
{{if !empty($v['event_value'])}}
<br /><span class="am-badge am-badge-warning am-radius">{{$v.event_type_text}}</span>
@ -137,7 +137,60 @@
<td class="am-hide-sm-only">
<a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/apphomenav/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}" data-field="is_enable" data-is-update-status="1"></a>
</td>
<td>{{$v.add_time_time}}</td>
<td>
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> 查看更多</span>
<div class="am-popup am-radius" id="my-popup{{$v.id}}">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">详情内容</h4>
<span data-am-modal-close
class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<dl class="dl-content">
<dt>名称</dt>
<dd>{{$v.name}}</dd>
<dt>所属平台</dt>
<dd>{{$v.platform_text}}</dd>
<dt>导航图标</dt>
<dd>
<div class="am-circle nav-icon-circle am-vertical-align" {{if !empty($v['bg_color'])}}style="background-color:{{$v.bg_color}};"{{/if}}>
{{if !empty($v['images_url'])}}
<a href="{{$v['images_url']}}" target="_blank">
<img src="{{$v['images_url']}}" class="am-radius am-vertical-align-middle" width="30" height="30" />
</a>
{{else /}}
<span class="cr-ddd">暂无图片</span>
{{/if}}
</div>
</dd>
<dt>事件值</dt>
<dd>
{{$v.event_value}}
{{if !empty($v['event_value'])}}
<br /><span class="am-badge am-badge-warning am-radius">{{$v.event_type_text}}</span>
{{/if}}
</dd>
<dt>登录</dt>
<dd>{{$v.is_need_login_text}}</dd>
<dt>启用</dt>
<dd>{{$v.is_enable_text}}</dd>
<dt>创建时间</dt>
<dd>{{$v.add_time_time}}</dd>
<dt>更新时间</dt>
<dd>{{$v.upd_time_time}}</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="view-operation">
<a href="{{:MyUrl('admin/apphomenav/saveinfo', array_merge($params, ['id'=>$v['id']]))}}">
<button class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-edit"> 编辑</button>

View File

@ -12,7 +12,7 @@ namespace app\api\controller;
use app\service\GoodsService;
use app\service\BannerService;
use app\service\AppNavService;
use app\service\AppHomeNavService;
/**
* 首页
@ -46,7 +46,7 @@ class Index extends Common
public function Index()
{
$result = [
'navigation' => AppNavService::AppHomeNav(),
'navigation' => AppHomeNavService::AppHomeNav(),
'banner_list' => BannerService::Banner(),
'data_list' => GoodsService::HomeFloorList(),
'common_shop_notice' => MyC('common_shop_notice', null, true),

View File

@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\service\AppNavService;
use app\service\AppHomeNavService;
/**
* 导航
@ -44,7 +44,7 @@ class Navigation extends Common
public function Index()
{
// 获取轮播
$data = AppNavService::AppHomeNav();
$data = AppHomeNavService::AppHomeNav();
// 返回数据
return DataReturn('success', 0, $data);

View File

@ -14,6 +14,7 @@ use app\service\UserService;
use app\service\OrderService;
use app\service\GoodsService;
use app\service\MessageService;
use app\service\AppCenterNavService;
/**
* 用户
@ -282,7 +283,7 @@ class User extends Common
'user_goods_favor_count' => $user_goods_favor_count,
'user_goods_browse_count' => $user_goods_browse_count,
'common_message_total' => $common_message_total,
'common_app_is_enable_answer' => (int) MyC('common_app_is_enable_answer', 0),
'navigation' => AppCenterNavService::AppCenterNav(),
);
// 返回数据

View File

@ -15,7 +15,7 @@ use app\service\BannerService;
use app\service\GoodsService;
use app\service\ArticleService;
use app\service\OrderService;
use app\service\AppNavService;
use app\service\AppHomeNavService;
/**
* 首页
@ -52,7 +52,7 @@ class Index extends Common
$this->assign('banner_list', BannerService::Banner());
// H5导航
$this->assign('navigation', AppNavService::AppHomeNav());
$this->assign('navigation', AppHomeNavService::AppHomeNav());
// 楼层数据
$this->assign('goods_floor_list', GoodsService::HomeFloorList());

View File

@ -0,0 +1,353 @@
<?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 app\service\ResourcesService;
/**
* APP用户中心导航服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class AppCenterNavService
{
/**
* 用户中心导航列表
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public static function AppCenterNavList($params = [])
{
$where = empty($params['where']) ? [] : $params['where'];
$field = empty($params['field']) ? '*' : $params['field'];
$order_by = empty($params['order_by']) ? 'sort asc' : trim($params['order_by']);
$m = isset($params['m']) ? intval($params['m']) : 0;
$n = isset($params['n']) ? intval($params['n']) : 10;
// 获取品牌列表
$data = Db::name('AppCenterNav')->where($where)->order($order_by)->limit($m, $n)->select();
if(!empty($data))
{
$common_platform_type = lang('common_platform_type');
$common_is_enable_tips = lang('common_is_enable_tips');
$common_app_event_type = lang('common_app_event_type');
foreach($data as &$v)
{
// 是否启用
if(isset($v['is_enable']))
{
$v['is_enable_text'] = $common_is_enable_tips[$v['is_enable']]['name'];
}
// 平台类型
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_time'] = date('Y-m-d H:i:s', $v['add_time']);
$v['add_time_date'] = date('Y-m-d', $v['add_time']);
}
if(isset($v['upd_time']))
{
$v['upd_time_time'] = date('Y-m-d H:i:s', $v['upd_time']);
$v['upd_time_date'] = date('Y-m-d', $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 AppCenterNavTotal($where)
{
return (int) Db::name('AppCenterNav')->where($where)->count();
}
/**
* 用户中心导航列表条件
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function AppCenterNavListWhere($params = [])
{
$where = [];
if(!empty($params['keywords']))
{
$where[] = ['name', 'like', '%'.$params['keywords'].'%'];
}
// 是否更多条件
if(isset($params['is_more']) && $params['is_more'] == 1)
{
// 等值
if(isset($params['is_enable']) && $params['is_enable'] > -1)
{
$where[] = ['is_enable', '=', intval($params['is_enable'])];
}
if(isset($params['event_type']) && $params['event_type'] > -1)
{
$where[] = ['event_type', '=', intval($params['event_type'])];
}
if(!empty($params['platform']))
{
$where[]= ['platform', '=', $params['platform']];
}
if(!empty($params['time_start']))
{
$where[] = ['add_time', '>', strtotime($params['time_start'])];
}
if(!empty($params['time_end']))
{
$where[] = ['add_time', '<', strtotime($params['time_end'])];
}
}
return $where;
}
/**
* 用户中心导航数据保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-19
* @desc description
* @param [array] $params [输入参数]
*/
public static function AppCenterNavSave($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' => 'desc',
'checked_data' => '18',
'error_msg' => '描述最多 18 个字符',
],
[
'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'],
'desc' => empty($params['desc']) ? '' : $params['desc'],
'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('AppCenterNav')->insertGetId($data) > 0)
{
return DataReturn('添加成功', 0);
}
return DataReturn('添加失败', -100);
} else {
$data['upd_time'] = time();
if(Db::name('AppCenterNav')->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 AppCenterNavDelete($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'id',
'error_msg' => '操作id有误',
],
];
$ret = ParamsChecked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
// 删除操作
if(Db::name('AppCenterNav')->where(['id'=>$params['id']])->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 AppCenterNavStatusUpdate($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('AppCenterNav')->where(['id'=>intval($params['id'])])->update([$params['field']=>intval($params['state'])]))
{
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 AppCenterNav($params = [])
{
$client_type = (APPLICATION_CLIENT_TYPE == 'pc') ? (IsMobile() ? 'h5' : 'pc') : APPLICATION_CLIENT_TYPE;
$data = Db::name('AppCenterNav')->field('id,name,images_url,event_value,event_type,desc')->where(['platform'=>$client_type, 'is_enable'=>1])->order('sort asc')->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'];
}
}
return $data;
}
}
?>

View File

@ -14,13 +14,13 @@ use think\Db;
use app\service\ResourcesService;
/**
* APP导航服务层
* APP首页导航服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class AppNavService
class AppHomeNavService
{
/**
* 首页导航列表

View File

@ -61,7 +61,7 @@ App({
// 请求地址
request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'http://test.shopxo.net/',
//request_url: 'http://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

BIN
public/appmini/old/alipay/images/user-nav-cache-icon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

BIN
public/appmini/old/alipay/images/user-nav-order-icon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -49,6 +49,17 @@
</view>
</block>
<!-- 远程自定义导航 -->
<block a:for="{{navigation}}" a:key="ckey">
<view data-value="{{item.event_value}}" data-type="{{item.event_type}}" onTap="navigation_event" class="nav-item br-b" >
<view class="arrow-right">
<image src="{{item.images_url}}" class="item-icon" mode="widthFix" />
<text class="item-name">{{item.name}}</text>
<text a:if="{{(item.desc || null) != null}}" class="item-desc fr tr single-text cr-ccc">{{item.desc}}</text>
</view>
</view>
</block>
<view class="nav-item br-b" onTap="clear_storage">
<image src="/images/user-nav-cache-icon.png" class="item-icon" mode="widthFix" />
<text class="item-name">清除缓存</text>

View File

@ -24,26 +24,11 @@ Page({
icon: "user-nav-order-icon",
is_show: 1,
name: "我的订单",
},
{
url: "user-address",
icon: "user-nav-address-icon",
is_show: 1,
name: "我的地址"
},
{
url: "user-faovr",
icon: "user-nav-faovr-icon",
is_show: 1,
name: "我的收藏"
},
{
url: "user-answer-list",
icon: "user-nav-answer-icon",
is_show: 1,
name: "我的留言"
}
]
],
// 远程自定义导航
navigation: [],
},
onShow() {
@ -122,7 +107,7 @@ Page({
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,
'nav_lists[3].is_show': (data.common_app_is_enable_answer == 1) ? 1 : 0,
navigation: data.navigation || [],
});
} else {
my.showToast({
@ -183,4 +168,9 @@ Page({
user_avatar_error(e) {
this.setData({avatar: app.data.default_user_head_src});
},
// 远程自定义导航事件
navigation_event(e) {
app.operation_event(e);
},
});

View File

@ -61,7 +61,7 @@ App({
// 请求地址
// request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'https://test.shopxo.net/',
//request_url: 'https://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

BIN
public/appmini/old/weixin/images/user-nav-cache-icon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

BIN
public/appmini/old/weixin/images/user-nav-order-icon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -22,28 +22,12 @@ Page({
{
url: "user-order",
icon: "user-nav-order-icon",
is_show: 1,
name: "我的订单",
},
{
url: "user-address",
icon: "user-nav-address-icon",
is_show: 1,
name: "我的地址"
},
{
url: "user-faovr",
icon: "user-nav-faovr-icon",
is_show: 1,
name: "我的收藏"
},
{
url: "user-answer-list",
icon: "user-nav-answer-icon",
is_show: 1,
name: "我的留言"
}
]
],
// 远程自定义导航
navigation: [],
},
onShow() {
@ -121,7 +105,7 @@ Page({
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,
'nav_lists[3].is_show': (data.common_app_is_enable_answer == 1) ? 1 : 0,
navigation: data.navigation || [],
});
} else {
app.showToast(res.data.msg);
@ -170,4 +154,9 @@ Page({
user_avatar_error(e) {
this.setData({avatar: app.data.default_user_head_src});
},
// 远程自定义导航事件
navigation_event(e) {
app.operation_event(e);
},
});

View File

@ -28,14 +28,12 @@
<!-- 导航 -->
<view class="nav-box bg-white">
<block wx:for="{{nav_lists}}" wx:key="key">
<view wx:if="{{item.is_show == 1}}">
<navigator url="/pages/{{item.url}}/{{item.url}}" class="nav-item br-b" hover-class="none">
<view class="arrow-right">
<image src="/images/{{item.icon}}.png" class="item-icon" mode="widthFix" />
<text class="item-name">{{item.name}}</text>
</view>
</navigator>
</view>
<navigator url="/pages/{{item.url}}/{{item.url}}" class="nav-item br-b" hover-class="none">
<view class="arrow-right">
<image src="/images/{{item.icon}}.png" class="item-icon" mode="widthFix" />
<text class="item-name">{{item.name}}</text>
</view>
</navigator>
<view wx:if="{{item.url == 'user-order' && user_order_status_list.length > 0}}" class="items-list br-b oh">
<block wx:for="{{user_order_status_list}}" wx:key="key" wx:for-item="items">
<navigator url="/pages/{{item.url}}/{{item.url}}?status={{items.status}}" hover-class="none">
@ -51,6 +49,17 @@
</view>
</block>
<!-- 远程自定义导航 -->
<block wx:for="{{navigation}}" wx:key="ckey">
<view data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="navigation_event" class="nav-item br-b" >
<view class="arrow-right">
<image src="{{item.images_url}}" class="item-icon" mode="widthFix" />
<text class="item-name">{{item.name}}</text>
<text wx:if="{{(item.desc || null) != null}}" class="item-desc fr tr single-text cr-ccc">{{item.desc}}</text>
</view>
</view>
</block>
<view class="nav-item br-b" bindtap="clear_storage">
<image src="/images/user-nav-cache-icon.png" class="item-icon" mode="widthFix" />
<text class="item-name">清除缓存</text>

View File

@ -63,6 +63,11 @@
margin-left: 20rpx;
vertical-align: middle;
}
.nav-box .nav-item .item-desc {
margin-right: 50rpx;
margin-top: 2rpx;
width: calc(100% - 300rpx);
}
.nav-box .nav-item .item-arrow {
width: 25rpx;
}

View File

@ -0,0 +1,19 @@
/**
* 列表
*/
.form-keyword { width: 55% !important; display: initial !important; }
.more-submit input { display: none; }
.param-where, .param-date input { display: initial !important; }
@media only screen and (max-width: 641px) {
.param-where { width: 100% !important; margin-left: 0px !important; }
.param-date input { width: 47% !important; }
}
@media only screen and (min-width: 641px) {
.param-where { width: 32% !important; float: left; }
.param-date input { width: 45% !important; }
.param-where:nth-child(1), .param-where:nth-child(4) { margin-left: 0px !important; }
}
@media only screen and (max-width: 321px) {
.view-operation button { margin: 2px 0px; }
}
.event-value { max-width: 260px; word-wrap: break-word; word-break: break-all; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB