Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
d416ef99
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d416ef99
编写于
7月 01, 2021
作者:
D
Devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
拖拽优化
上级
c5ec7a5c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
443 addition
and
91 deletion
+443
-91
application/layout/service/BaseLayout.php
application/layout/service/BaseLayout.php
+298
-38
application/layout/view/public/modal/modal_module_pages_select.html
...n/layout/view/public/modal/modal_module_pages_select.html
+35
-0
application/service/LayoutService.php
application/service/LayoutService.php
+1
-1
public/static/common/css/layout.admin.css
public/static/common/css/layout.admin.css
+10
-0
public/static/common/js/layout.admin.js
public/static/common/js/layout.admin.js
+99
-52
未找到文件。
application/layout/service/BaseLayout.php
浏览文件 @
d416ef99
...
...
@@ -46,6 +46,75 @@ class BaseLayout
'list'
=>
'列表模式'
,
];
/**
* 配置处理-保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-06-17
* @desc description
* @param [array] $config [配置信息]
* @param [array] $params [输入参数]
*/
public
static
function
ConfigSaveHandle
(
$config
,
$params
=
[])
{
$config
=
empty
(
$config
)
?
[]
:
(
is_array
(
$config
)
?
$config
:
json_decode
(
htmlspecialchars_decode
(
$config
),
true
));
if
(
!
empty
(
$config
)
&&
is_array
(
$config
))
{
foreach
(
$config
as
&
$v
)
{
// 布局
if
(
!
empty
(
$v
[
'children'
])
&&
is_array
(
$v
[
'children'
]))
{
foreach
(
$v
[
'children'
]
as
&
$vs
)
{
// 容器
if
(
!
empty
(
$vs
[
'children'
])
&&
is_array
(
$vs
[
'children'
]))
{
// 模块
foreach
(
$vs
[
'children'
]
as
&
$vss
)
{
if
(
!
empty
(
$vss
[
'value'
])
&&
!
empty
(
$vss
[
'config'
]))
{
// 根据模块类型处理
switch
(
$vss
[
'value'
])
{
// 视频 video
case
'video'
:
$vss
[
'config'
][
'content_video'
]
=
ResourcesService
::
AttachmentPathHandle
(
$vss
[
'config'
][
'content_video'
]);
break
;
// 单图 images
case
'images'
:
$vss
[
'config'
][
'content_images'
]
=
ResourcesService
::
AttachmentPathHandle
(
$vss
[
'config'
][
'content_images'
]);
break
;
// 多图 many-images
case
'many-images'
:
foreach
(
$vss
[
'config'
][
'data_list'
]
as
&
$mil
)
{
$mil
[
'images'
]
=
ResourcesService
::
AttachmentPathHandle
(
$mil
[
'images'
]);
}
$key
=
'content_images_'
;
foreach
(
$vss
[
'config'
]
as
$mik
=>
$miv
)
{
if
(
substr
(
$mik
,
0
,
strlen
(
$key
))
==
$key
)
{
$vss
[
'config'
][
$mik
]
=
ResourcesService
::
AttachmentPathHandle
(
$miv
);
}
}
break
;
}
}
}
}
}
}
}
}
return
empty
(
$config
)
?
''
:
json_encode
(
$config
,
JSON_UNESCAPED_UNICODE
);
}
/**
* 配置处理-管理
* @author Devil
...
...
@@ -167,8 +236,6 @@ class BaseLayout
}
}
}
//print_r($config);die;
return
$config
;
}
...
...
@@ -316,8 +383,6 @@ class BaseLayout
}
}
}
//print_r($config);die;
return
$config
;
}
...
...
@@ -381,6 +446,12 @@ class BaseLayout
*/
public
static
function
LayoutUrlValueHandle
(
$type
,
$value
)
{
// 扩展参数处理
if
(
!
empty
(
$value
)
&&
!
is_array
(
$value
))
{
$value
=
json_decode
(
urldecode
(
$value
),
true
);
}
// 当前客户端类型
$client_type
=
APPLICATION_CLIENT_TYPE
;
...
...
@@ -401,6 +472,38 @@ class BaseLayout
'user_integral_list'
=>
MyUrl
(
'index/userintegral/index'
),
'user_answer_list'
=>
MyUrl
(
'index/answer/index'
),
'user_message_list'
=>
MyUrl
(
'index/message/index'
),
// 多商户
'plugins-shop-home'
=>
PluginsHomeUrl
(
'shop'
,
'index'
,
'index'
),
// 品牌
'plugins-brand-home'
=>
PluginsHomeUrl
(
'brand'
,
'index'
,
'index'
),
// 优惠券
'plugins-coupon-home'
=>
PluginsHomeUrl
(
'coupon'
,
'index'
,
'index'
),
'plugins-coupon-user'
=>
PluginsHomeUrl
(
'coupon'
,
'coupon'
,
'index'
),
// 会员等级
'plugins-membershiplevelvip-home'
=>
PluginsHomeUrl
(
'membershiplevelvip'
,
'index'
,
'index'
),
'plugins-membershiplevelvip-user-center'
=>
PluginsHomeUrl
(
'membershiplevelvip'
,
'vip'
,
'index'
),
'plugins-membershiplevelvip-user-poster'
=>
PluginsHomeUrl
(
'membershiplevelvip'
,
'poster'
,
'index'
),
// 分销
'plugins-distribution-user-center'
=>
PluginsHomeUrl
(
'distribution'
,
'index'
,
'index'
),
'plugins-distribution-user-poster'
=>
PluginsHomeUrl
(
'distribution'
,
'poster'
,
'index'
),
// 发票
'plugins-invoice-user'
=>
PluginsHomeUrl
(
'invoice'
,
'user'
,
'index'
),
'plugins-invoice-order'
=>
PluginsHomeUrl
(
'invoice'
,
'order'
,
'index'
),
// 积分商城
'plugins-points-home'
=>
PluginsHomeUrl
(
'points'
,
'index'
,
'index'
),
// 钱包
'plugins-wallet-user'
=>
PluginsHomeUrl
(
'wallet'
,
'wallet'
,
'index'
),
// 签到
'plugins-signin-user'
=>
PluginsHomeUrl
(
'signin'
,
'userqrcode'
,
'index'
),
];
// 静态地址定义-手机端
...
...
@@ -417,6 +520,38 @@ class BaseLayout
'user_integral_list'
=>
'/pages/user-integral/user-integral'
,
'user_answer_list'
=>
'/pages/user-answer-list/user-answer-list'
,
'user_message_list'
=>
'/pages/message/message'
,
// 多商户
'plugins-shop-home'
=>
'/pages/plugins/shop/index/index'
,
// 品牌
'plugins-brand-home'
=>
'/pages/plugins/brand/index/index'
,
// 优惠券
'plugins-coupon-home'
=>
'/pages/plugins/coupon/index/index'
,
'plugins-coupon-user'
=>
'/pages/plugins/coupon/user/user'
,
// 会员等级
'plugins-membershiplevelvip-home'
=>
'/pages/plugins/membershiplevelvip/index/index'
,
'plugins-membershiplevelvip-user-center'
=>
'/pages/plugins/membershiplevelvip/user/user'
,
'plugins-membershiplevelvip-user-poster'
=>
'/pages/plugins/membershiplevelvip/poster/poster'
,
// 分销
'plugins-distribution-user-center'
=>
'/pages/plugins/distribution/user/user'
,
'plugins-distribution-user-poster'
=>
'/pages/plugins/distribution/poster/poster'
,
// 发票
'plugins-invoice-user'
=>
'/pages/plugins/invoice/user/user'
,
'plugins-invoice-order'
=>
'/pages/plugins/invoice/order/order'
,
// 积分商城
'plugins-points-home'
=>
'/pages/plugins/points/index/index'
,
// 钱包
'plugins-wallet-user'
=>
'/pages/plugins/wallet/user/user'
,
// 签到
'plugins-signin-user'
=>
'/pages/plugins/signin/user/user'
,
];
// 静态地址
...
...
@@ -425,11 +560,6 @@ class BaseLayout
{
$url
=
$static_url_arr
[
$type
];
}
else
{
// 扩展参数处理
if
(
!
empty
(
$value
)
&&
!
is_array
(
$value
))
{
$value
=
json_decode
(
urldecode
(
$value
),
true
);
}
switch
(
$type
)
{
// 商品
...
...
@@ -467,8 +597,30 @@ class BaseLayout
// 默认搜索页面、无条件
$url
=
(
$client_type
==
'pc'
)
?
MyUrl
(
'index/search/index'
,
$gsp
)
:
'/pages/goods-search/goods-search'
.
(
empty
(
$gsp
)
?
''
:
$gsp
);
break
;
// 自定义链接
case
'pages-custom-url'
:
$key
=
'pages_custom_url_'
.
$client_type
;
if
(
!
empty
(
$value
)
&&
is_array
(
$value
)
&&
array_key_exists
(
$key
,
$value
)
&&
!
empty
(
$value
[
$key
]))
{
$url
=
$value
[
$key
];
}
break
;
}
}
// url值处理钩子
$hook_name
=
'plugins_layout_service_url_value_handle'
;
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'type'
=>
$type
,
'value'
=>
$value
,
'client_type'
=>
$client_type
,
'url'
=>
&
$url
,
]);
// 返回url
return
$url
;
}
...
...
@@ -705,7 +857,8 @@ class BaseLayout
*/
public
static
function
PagesList
(
$params
=
[])
{
return
[
// 返回页面数据定义
$data
=
[
// 公共
'common'
=>
[
'name'
=>
'系统页面'
,
...
...
@@ -777,21 +930,128 @@ class BaseLayout
[
'name'
=>
'多商户'
,
'value'
=>
'shop'
,
'tips'
=>
'暂时不支持小程序'
,
'data'
=>
[
[
'value'
=>
'home'
,
'name'
=>
'店铺首页'
,
'name'
=>
'首页'
,
],
],
],
[
'value'
=>
'goods_category'
,
'name'
=>
'商品分类'
,
'name'
=>
'品牌'
,
'value'
=>
'brand'
,
'data'
=>
[
[
'value'
=>
'home'
,
'name'
=>
'首页'
,
],
],
],
[
'name'
=>
'优惠券'
,
'value'
=>
'coupon'
,
'data'
=>
[
[
'value'
=>
'home'
,
'name'
=>
'首页'
,
],
[
'value'
=>
'user'
,
'name'
=>
'我的优惠券'
,
],
],
],
[
'name'
=>
'会员等级增强版'
,
'value'
=>
'membershiplevelvip'
,
'data'
=>
[
[
'value'
=>
'home'
,
'name'
=>
'会员首页'
,
],
[
'value'
=>
'user-center'
,
'name'
=>
'会员中心'
,
],
[
'value'
=>
'user-poster'
,
'name'
=>
'推广返利'
,
],
],
],
[
'name'
=>
'分销'
,
'value'
=>
'distribution'
,
'data'
=>
[
[
'value'
=>
'user-center'
,
'name'
=>
'分销中心'
,
],
[
'value'
=>
'user-poster'
,
'name'
=>
'推广返利'
,
],
],
],
[
'name'
=>
'发票'
,
'value'
=>
'invoice'
,
'data'
=>
[
[
'value'
=>
'user'
,
'name'
=>
'我的发票'
,
],
[
'value'
=>
'order'
,
'name'
=>
'订单开票'
,
],
],
],
[
'name'
=>
'积分商城'
,
'value'
=>
'points'
,
'data'
=>
[
[
'value'
=>
'home'
,
'name'
=>
'首页'
,
],
],
],
[
'name'
=>
'钱包'
,
'value'
=>
'wallet'
,
'data'
=>
[
[
'value'
=>
'user'
,
'name'
=>
'我的钱包'
,
],
],
],
[
'name'
=>
'签到'
,
'value'
=>
'signin'
,
'data'
=>
[
[
'value'
=>
'user'
,
'name'
=>
'我的签到'
,
],
],
],
],
],
];
// 页面列表钩子
$hook_name
=
'plugins_layout_service_pages_list'
;
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
$params
,
'data'
=>
&
$data
,
]);
// 返回页面数据
return
$data
;
}
}
?>
\ No newline at end of file
application/layout/view/public/modal/modal_module_pages_select.html
浏览文件 @
d416ef99
...
...
@@ -8,6 +8,7 @@
<ul
class=
"am-tabs-nav am-cf"
>
<li
class=
"am-active"
><a
href=
"[data-tab-panel-0]"
>
系统页面
</a></li>
<li><a
href=
"[data-tab-panel-1]"
>
扩展模块
</a></li>
<li><a
href=
"[data-tab-panel-2]"
>
自定义链接
</a></li>
</ul>
<div
class=
"am-tabs-bd"
>
<div
data-tab-panel-0
class=
"am-tab-panel am-padding-0 am-active"
>
...
...
@@ -47,6 +48,40 @@
{{/foreach}}
</div>
</div>
<div
data-tab-panel-2
class=
"am-tab-panel am-padding-0"
>
<div
class=
"am-scrollable-vertical"
>
<div
class=
"am-alert am-radius am-margin-top-0 am-text-left am-margin-bottom-0"
>
<div>
<p><strong>
WEB端
</strong></p>
<div
class=
"am-padding-left-lg"
>
<p>
1. 以http开头
</p>
</div>
</div>
<div
class=
"am-margin-top-xs"
>
<p><strong>
小程序/APP
</strong></p>
<div
class=
"am-padding-left-lg"
>
<p>
1. 小程序或APP内部地址
</p>
<p>
2. 小程序以/pages开始
</p>
<p>
3. 例如:/pages/user/user
</p>
<p>
4. 支持带参数 ?x=xx
</p>
<p>
<a
href=
"{{if empty($layout_pages_custom_doc_url)}}https://ask.shopxo.net/article/106{{else /}}{{$layout_pages_custom_doc_url}}{{/if}}"
target=
"_blank"
>
小程序页面地址配置说明
<i
class=
"am-icon-external-link"
></i></a>
</p>
</div>
</div>
</div>
<div
class=
"pages-custom-url-container am-padding-sm"
>
{{foreach :lang('common_platform_type') as $v}}
<div
class=
"am-input-group am-input-group-sm"
>
<span
class=
"am-input-group-btn"
>
<button
type=
"button"
class=
"am-btn am-btn-default am-radius"
>
{{$v.name}}
</button>
</span>
<input
type=
"text"
name=
"pages_custom_url_{{$v.value}}"
placeholder=
"{{$v.name}}"
class=
"am-form-field am-radius"
value=
""
/>
</div>
{{/foreach}}
</div>
</div>
</div>
</div>
</div>
<div
class=
"am-padding-sm"
>
...
...
application/service/LayoutService.php
浏览文件 @
d416ef99
...
...
@@ -47,7 +47,7 @@ class LayoutService
}
// 保存数据
$config
=
empty
(
$params
[
'config'
])
?
''
:
(
is_array
(
$params
[
'config'
])
?
json_encode
(
$params
[
'config'
],
JSON_UNESCAPED_UNICODE
)
:
htmlspecialchars_decode
(
$params
[
'config'
]))
;
$config
=
empty
(
$params
[
'config'
])
?
''
:
BaseLayout
::
ConfigSaveHandle
(
$params
[
'config'
])
;
$ret
=
ConfigService
::
ConfigSave
([
self
::
$layout_key
[
$key
]
=>
$config
]);
if
(
$ret
[
'code'
]
==
0
)
{
...
...
public/static/common/css/layout.admin.css
浏览文件 @
d416ef99
...
...
@@ -35,6 +35,16 @@
padding
:
5px
;
}
/**
* 页面选择自定义url
*/
.pages-custom-url-container
>
.am-input-group
:not
(
:first-child
)
{
margin-top
:
5px
;
}
.pages-custom-url-container
>
.am-input-group
button
{
width
:
100px
;
}
/**
* 拖放模块
*/
...
...
public/static/common/js/layout.admin.js
浏览文件 @
d416ef99
...
...
@@ -1630,18 +1630,36 @@ function OffcanvasConfigPagesChoice(obj, event)
$modal_pages_select
.
find
(
'
.am-tabs-bd ul li
'
).
removeClass
(
'
active
'
);
$modal_pages_select
.
find
(
'
.am-tabs-bd ul li a
'
).
attr
(
'
data-json
'
,
''
);
// 自定义链接地址
if
(
to_type
==
'
pages-custom-url
'
)
{
var
form_doc
=
'
.pages-custom-url-container
'
;
if
((
to_value
||
null
)
==
null
)
{
to_value
=
GetFormVal
(
form_doc
,
true
);
}
else
{
to_value
=
JSON
.
parse
(
decodeURIComponent
(
to_value
));
}
FormDataFill
(
to_value
,
form_doc
);
var
index
=
2
;
// 常规页面选择
}
else
{
// 当前选中的数据
var
$active_obj
=
$modal_pages_select
.
find
(
'
.am-tabs-bd ul li.page-
'
+
to_type
);
$active_obj
.
addClass
(
'
active
'
);
$active_obj
.
find
(
'
a span
'
).
text
(
to_name
);
$active_obj
.
find
(
'
a
'
).
attr
(
'
data-json
'
,
to_value
);
// tab切换
// 当前选中的索引值
var
index
=
$active_obj
.
parents
(
'
.am-tab-panel
'
).
index
();
if
(
index
==
-
1
)
{
index
=
0
;
}
}
// tab切换
$modal_pages_select
.
find
(
'
.am-tabs-nav li
'
).
removeClass
(
'
am-active
'
);
$modal_pages_select
.
find
(
'
.am-tabs-nav li
'
).
eq
(
index
).
addClass
(
'
am-active
'
);
$modal_pages_select
.
find
(
'
.am-tabs-bd .am-tab-panel
'
).
removeClass
(
'
am-active
'
);
...
...
@@ -2286,13 +2304,18 @@ $(function()
$o
.
attr
(
'
data-json
'
,
''
);
$o
.
find
(
'
span
'
).
text
(
$o
.
data
(
'
name
'
));
});
// 自定义链接清空
$
(
'
.pages-custom-url-container input
'
).
val
(
''
);
});
// 页面选择切换
$modal_pages_select
.
on
(
'
click
'
,
'
.am-tabs-bd ul li a
'
,
function
()
{
// 选中状态
$
(
this
).
parent
().
addClass
(
'
active
'
).
siblings
().
removeClass
(
'
active
'
);
var
$parent
=
$
(
this
).
parents
(
'
.am-tab-panel
'
);
$parent
.
find
(
'
li
'
).
removeClass
(
'
active
'
);
$
(
this
).
parent
().
addClass
(
'
active
'
);
// 参数值
var
value
=
$
(
this
).
data
(
'
value
'
)
||
null
;
...
...
@@ -2400,7 +2423,30 @@ $(function()
// 页面选择确认事件
$modal_pages_select
.
on
(
'
click
'
,
'
.pages-confirm-submit
'
,
function
()
{
// 参数值
// 选中tab
var
index
=
$modal_pages_select
.
find
(
'
.am-tabs-nav li.am-active
'
).
index
();
// 参数值、自定义链接、常规页面选择
if
(
index
==
2
)
{
var
to_type
=
'
pages-custom-url
'
;
var
to_name
=
'
自定义链接
'
;
var
to_value
=
GetFormVal
(
'
.pages-custom-url-container
'
,
true
);
var
count
=
0
;
for
(
var
i
in
to_value
)
{
if
((
to_value
[
i
]
||
null
)
==
null
)
{
count
++
;
}
}
if
(
count
>=
Object
.
keys
(
to_value
).
length
)
{
Prompt
(
'
请至少填写一个地址
'
);
return
false
;
}
to_value
=
encodeURIComponent
(
JSON
.
stringify
(
to_value
));
}
else
{
var
$obj
=
$modal_pages_select
.
find
(
'
.am-tab-panel.am-active ul li.active a
'
);
var
to_type
=
$obj
.
data
(
'
value
'
)
||
''
;
var
to_name
=
$obj
.
data
(
'
name
'
)
||
''
;
...
...
@@ -2450,6 +2496,7 @@ $(function()
to_name
+=
ModuleConfigGoodsSearchPageShowName
(
json
);
break
;
}
}
// 设置数据
var
$parent
=
$page_parent_obj
.
parents
(
'
.form-view-choice-container
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录