Forráskód Böngészése

轮播图和其他跳转

lizhen 2 napja
szülő
commit
ff4cb1a51d

+ 1 - 0
application/admin/controller/Banner.php

@@ -22,6 +22,7 @@ class Banner extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\Banner;
+        $this->view->assign("typeList", $this->model->getTypeList());
         $this->view->assign("statusList", $this->model->getStatusList());
     }
 

+ 15 - 8
application/admin/lang/zh-cn/banner.php

@@ -1,14 +1,21 @@
 <?php
 
 return [
-    'Id'       => 'ID',
-    'Title'    => '标题',
-    'Image'    => '图片',
-    'Url'      => '链接地址',
-    'Status'   => '状态',
-    'Status 1' => '上架',
+    'Id'           => 'ID',
+    'Title'        => '标题',
+    'Image'        => '图片',
+    'Url'          => '链接地址',
+    'Type'         => '跳转方式',
+    'Type 0'       => '本小程序',
+    'Type 1'       => '外部小程序',
+    'Type 2'       => '提示语',
+    'Type 3'       => 'H5',
+    'Remark'       => '提示语',
+    'Remark_image' => '提示图片',
+    'Status'       => '状态',
+    'Status 1'     => '上架',
     'Set status to 1'=> '设为上架',
-    'Status 0' => '下架',
+    'Status 0'     => '下架',
     'Set status to 0'=> '设为下架',
-    'Weigh'    => '权重排序'
+    'Weigh'        => '权重排序'
 ];

+ 1 - 0
application/admin/lang/zh-cn/bianmin.php

@@ -9,6 +9,7 @@ return [
     'Type 0'        => '本小程序',
     'Type 1'        => '外部小程序',
     'Type 2'        => '提示语',
+    'Type 3'        => 'H5',
     'Url'           => '链接地址',
     'Remark'        => '提示语',
     'Remark_image'  => '提示图片',

+ 1 - 0
application/admin/lang/zh-cn/home.php

@@ -11,6 +11,7 @@ return [
     'Type 0'       => '本小程序',
     'Type 1'       => '外部小程序',
     'Type 2'       => '提示语',
+    'Type 3'       => 'H5',
     'Url'          => '链接地址',
     'Remark'       => '提示语',
     'Remark_image' => '提示图片'

+ 14 - 0
application/admin/model/Banner.php

@@ -25,6 +25,7 @@ class Banner extends Model
 
     // 追加属性
     protected $append = [
+        'type_text',
         'status_text'
     ];
     
@@ -38,12 +39,25 @@ class Banner extends Model
     }
 
     
+    public function getTypeList()
+    {
+        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3')];
+    }
+
     public function getStatusList()
     {
         return ['1' => __('Status 1'), '0' => __('Status 0')];
     }
 
 
+    public function getTypeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
+        $list = $this->getTypeList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
     public function getStatusTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');

+ 1 - 1
application/admin/model/Bianmin.php

@@ -32,7 +32,7 @@ class Bianmin extends Model
     
     public function getTypeList()
     {
-        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2')];
+        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3')];
     }
 
 

+ 1 - 1
application/admin/model/Home.php

@@ -38,7 +38,7 @@ class Home extends Model
 
     public function getTypeList()
     {
-        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2')];
+        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3')];
     }
 
 

+ 32 - 0
application/admin/view/banner/add.html

@@ -27,6 +27,38 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
+                {foreach name="typeList" item="vo"}
+                    <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark_image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-remark_image" class="form-control" size="50" name="row[remark_image]" type="text" value="">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-remark_image" class="btn btn-danger faupload" data-input-id="c-remark_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-remark_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-remark_image" class="btn btn-primary fachoose" data-input-id="c-remark_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-remark_image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-remark_image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
         <div class="col-xs-12 col-sm-8">
             

+ 32 - 0
application/admin/view/banner/edit.html

@@ -27,6 +27,38 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
+                {foreach name="typeList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark_image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-remark_image" class="form-control" size="50" name="row[remark_image]" type="text" value="{$row.remark_image|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-remark_image" class="btn btn-danger faupload" data-input-id="c-remark_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-remark_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-remark_image" class="btn btn-primary fachoose" data-input-id="c-remark_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-remark_image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-remark_image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
         <div class="col-xs-12 col-sm-8">
             

+ 2 - 2
application/admin/view/banner/index.html

@@ -22,7 +22,7 @@
                         <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('banner/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
                         
 
-                        <!--<div class="dropdown btn-group {:$auth->check('banner/multi')?'':'hide'}">
+                        <div class="dropdown btn-group {:$auth->check('banner/multi')?'':'hide'}">
                             <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
                             <ul class="dropdown-menu text-left" role="menu">
                                 {foreach name="statusList" item="vo"}
@@ -30,7 +30,7 @@
                                 {/foreach}
                             </ul>
                         </div>
--->
+
                         
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"

+ 4 - 1
public/assets/js/backend/banner.js

@@ -28,7 +28,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'id', title: __('Id')},
                         {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'url', title: __('Url')},
+                        {field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
+                        {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
+                        {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'remark_image', title: __('Remark_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
                         {field: 'weigh', title: __('Weigh'), operate: false},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}

+ 1 - 1
public/assets/js/backend/bianmin.js

@@ -33,7 +33,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
                         {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
+                        {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
                         {field: 'url', title: __('Url'), operate: 'LIKE'},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'remark_image', title: __('Remark_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},

+ 1 - 1
public/assets/js/backend/home.js

@@ -31,7 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'category', title: __('Category'), searchList: {"1":__('Category 1'),"2":__('Category 2')}, formatter: Table.api.formatter.normal},
                         {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
+                        {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
                         {field: 'url', title: __('Url'), operate: 'LIKE'},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'remark_image', title: __('Remark_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},