作者 何书鹏
1 个管道 的构建 通过 耗费 6 秒

好物抢购banner可以不跳转

... ... @@ -4,8 +4,9 @@ return [
'Name' => '图片上文字',
'Title' => '标题',
'Type' => '跳转类型',
'Type 1' => '商品',
'Type 1' => '无跳转',
'Type 2' => '外链',
'Type 3' => '商品',
'Href' => '链接',
'Goods_id' => '商品id',
'Image' => '图片',
... ...
... ... @@ -31,7 +31,7 @@ class Litestorenews extends Model
public function getTypeList()
{
return [1 => __('Type 1'),2 => __('Type 2')];
return [1 => __('Type 1'),2 => __('Type 2'),3 => __('Type 3')];
}
... ...
... ... @@ -23,7 +23,7 @@
<input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value="">
</div>
</div>
<div class="form-group" id="goods_id">
<div class="form-group" id="goods_id" style="display: none;">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_id" data-rule="" data-field="goods_name" data-primary-key="goods_id" data-source="litestoregoods/selectpage" class="form-control selectpage form-control" name="row[goods_id]" type="text" value="">
... ...
... ... @@ -18,13 +18,13 @@
</div>
</div>
<div class="form-group">
<div class="form-group" id="href">
<label class="control-label col-xs-12 col-sm-2">{:__('Href')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value="{$row.href}">
</div>
</div>
<div class="form-group">
<div class="form-group" id="goods_id">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_id" data-rule="" data-source="litestoregoods/selectpage" class="form-control selectpage form-control" name="row[goods_id]" type="text" value="{$row.goods_id}">
... ...
... ... @@ -75,7 +75,7 @@ class Goods extends Api
"list": [
{
"id": 1,
"type": 类型1=商品2=外链,
"type": 跳转类型:1=无跳转,2=外链,3=商品,
"href": "链接",
"goods_id": 商品id,
"image": "/uploads/20200830/85a473e047c77e7501889d1b19a9f794.jpg",
... ...
... ... @@ -64,6 +64,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
edit: function () {
Controller.api.change();
Controller.api.bindevent();
setTimeout(function () {
$('input[name="row[type]"]').trigger("change");
}, 100);
},
api: {
bindevent: function () {
... ... @@ -74,12 +77,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var type = $('input[name="row[type]"]:checked').val();
console.log(type);
if(type == 1) {
$('#goods_id').show();
$('#goods_id').hide();
$('#href').hide();
} else {
} else if(type == 2) {
$('#goods_id').hide();
$('#href').show();
}
} else {
$('#goods_id').show();
$('#href').hide();
}
})
}
}
... ...