正在显示
6 个修改的文件
包含
16 行增加
和
9 行删除
@@ -4,8 +4,9 @@ return [ | @@ -4,8 +4,9 @@ return [ | ||
4 | 'Name' => '图片上文字', | 4 | 'Name' => '图片上文字', |
5 | 'Title' => '标题', | 5 | 'Title' => '标题', |
6 | 'Type' => '跳转类型', | 6 | 'Type' => '跳转类型', |
7 | - 'Type 1' => '商品', | 7 | + 'Type 1' => '无跳转', |
8 | 'Type 2' => '外链', | 8 | 'Type 2' => '外链', |
9 | + 'Type 3' => '商品', | ||
9 | 'Href' => '链接', | 10 | 'Href' => '链接', |
10 | 'Goods_id' => '商品id', | 11 | 'Goods_id' => '商品id', |
11 | 'Image' => '图片', | 12 | 'Image' => '图片', |
@@ -31,7 +31,7 @@ class Litestorenews extends Model | @@ -31,7 +31,7 @@ class Litestorenews extends Model | ||
31 | 31 | ||
32 | public function getTypeList() | 32 | public function getTypeList() |
33 | { | 33 | { |
34 | - return [1 => __('Type 1'),2 => __('Type 2')]; | 34 | + return [1 => __('Type 1'),2 => __('Type 2'),3 => __('Type 3')]; |
35 | } | 35 | } |
36 | 36 | ||
37 | 37 |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | <input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value=""> | 23 | <input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value=""> |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | - <div class="form-group" id="goods_id"> | 26 | + <div class="form-group" id="goods_id" style="display: none;"> |
27 | <label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label> | 27 | <label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label> |
28 | <div class="col-xs-12 col-sm-8"> | 28 | <div class="col-xs-12 col-sm-8"> |
29 | <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=""> | 29 | <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 @@ | @@ -18,13 +18,13 @@ | ||
18 | 18 | ||
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | - <div class="form-group"> | 21 | + <div class="form-group" id="href"> |
22 | <label class="control-label col-xs-12 col-sm-2">{:__('Href')}:</label> | 22 | <label class="control-label col-xs-12 col-sm-2">{:__('Href')}:</label> |
23 | <div class="col-xs-12 col-sm-8"> | 23 | <div class="col-xs-12 col-sm-8"> |
24 | <input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value="{$row.href}"> | 24 | <input id="c-href" data-rule="" class="form-control form-control" name="row[href]" type="text" value="{$row.href}"> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | - <div class="form-group"> | 27 | + <div class="form-group" id="goods_id"> |
28 | <label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label> | 28 | <label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label> |
29 | <div class="col-xs-12 col-sm-8"> | 29 | <div class="col-xs-12 col-sm-8"> |
30 | <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}"> | 30 | <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 | @@ -75,7 +75,7 @@ class Goods extends Api | ||
75 | "list": [ | 75 | "list": [ |
76 | { | 76 | { |
77 | "id": 1, | 77 | "id": 1, |
78 | - "type": 类型1=商品2=外链, | 78 | + "type": 跳转类型:1=无跳转,2=外链,3=商品, |
79 | "href": "链接", | 79 | "href": "链接", |
80 | "goods_id": 商品id, | 80 | "goods_id": 商品id, |
81 | "image": "/uploads/20200830/85a473e047c77e7501889d1b19a9f794.jpg", | 81 | "image": "/uploads/20200830/85a473e047c77e7501889d1b19a9f794.jpg", |
@@ -64,6 +64,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -64,6 +64,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
64 | edit: function () { | 64 | edit: function () { |
65 | Controller.api.change(); | 65 | Controller.api.change(); |
66 | Controller.api.bindevent(); | 66 | Controller.api.bindevent(); |
67 | + setTimeout(function () { | ||
68 | + $('input[name="row[type]"]').trigger("change"); | ||
69 | + }, 100); | ||
67 | }, | 70 | }, |
68 | api: { | 71 | api: { |
69 | bindevent: function () { | 72 | bindevent: function () { |
@@ -74,12 +77,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -74,12 +77,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
74 | var type = $('input[name="row[type]"]:checked').val(); | 77 | var type = $('input[name="row[type]"]:checked').val(); |
75 | console.log(type); | 78 | console.log(type); |
76 | if(type == 1) { | 79 | if(type == 1) { |
77 | - $('#goods_id').show(); | 80 | + $('#goods_id').hide(); |
78 | $('#href').hide(); | 81 | $('#href').hide(); |
79 | - } else { | 82 | + } else if(type == 2) { |
80 | $('#goods_id').hide(); | 83 | $('#goods_id').hide(); |
81 | $('#href').show(); | 84 | $('#href').show(); |
82 | - } | 85 | + } else { |
86 | + $('#goods_id').show(); | ||
87 | + $('#href').hide(); | ||
88 | + } | ||
83 | }) | 89 | }) |
84 | } | 90 | } |
85 | } | 91 | } |
-
请 注册 或 登录 后发表评论