mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改规则
This commit is contained in:
parent
3ee39c6a46
commit
603104a64c
@ -17,10 +17,10 @@ class Slider extends Controller
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'#' => '不跳转',
|
'#' => ['name' => '不跳转'],
|
||||||
'LK' => '自定义链接',
|
'LK' => ['name' => '自定义链接'],
|
||||||
'NL' => '新闻资讯列表',
|
'NL' => ['name' => '新闻资讯列表'],
|
||||||
'NS' => '新闻资讯详情',
|
'NS' => ['name' => '新闻资讯详情', 'node' => 'data/news.item/select'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,8 +54,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="inline-block margin-left-5">
|
<div class="inline-block margin-left-5">
|
||||||
<select class="layui-select" name="type[]" lay-filter="TypeSelect" data-item-rule lay-ignore>
|
<select class="layui-select" name="type[]" lay-filter="TypeSelect" data-item-rule lay-ignore>
|
||||||
{foreach $rules as $k=>$v}
|
{foreach $rules as $key=>$rule}
|
||||||
<option value="{$k}">{$k} - {$v}</option>
|
<option value="{$key}" data-node="{$rule.node|default=''}">{$key} - {$rule.name}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -78,15 +78,17 @@
|
|||||||
/*! 跳转规则选择器 */
|
/*! 跳转规则选择器 */
|
||||||
layui.form.on('select(TypeSelect)', function (data) {
|
layui.form.on('select(TypeSelect)', function (data) {
|
||||||
var input = $(data.elem).parent().prev('label').find('input');
|
var input = $(data.elem).parent().prev('label').find('input');
|
||||||
var title = data.elem.options[data.elem.selectedIndex].innerText.split(' - ').pop();
|
var option = data.elem.options[data.elem.options.selectedIndex];
|
||||||
|
var title = option.innerText.split(' - ').pop(), node = option.dataset.node;
|
||||||
window.setItemValue = function (id, name) {
|
window.setItemValue = function (id, name) {
|
||||||
input.val(data.value + '#' + (id || '0') + '#' + (name || title));
|
input.val(data.value + '#' + (id || '0') + '#' + (name || title));
|
||||||
}, this.openModel = function (url) {
|
}, this.openModel = function (url) {
|
||||||
return $.form.modal(url, {}, title, null, true, null, '840px', '5%');
|
return $.form.modal(url, {}, title, null, true, null, '840px', '5%');
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data.value === '#') return input.val('#');
|
if (data.value === '#') return input.val('#');
|
||||||
if (data.value === 'LK') return /^https?:\/\//.test(input.val()) || input.val('#').focus();
|
if (data.value === 'LK') return /^https?:\/\//.test(input.val()) || input.val('#').focus();
|
||||||
if (data.value === 'NS') return this.openModel('{:url("data/news.item/select")}');
|
if (node.length > 0) return this.openModel('{:url("@URLTEMP")}'.replace('URLTEMP', node));
|
||||||
return window.setItemValue();
|
return window.setItemValue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user