lizhen_gitee 7 months ago
parent
commit
ffe22e49d4

+ 2 - 1
application/admin/lang/zh-cn/caozuoguifan.php

@@ -9,6 +9,7 @@ return [
     'Content'             => '简介',
     'Createtime'          => '创建时间',
     'Updatetime'          => '更新时间',
+    'Videofile'           => '视频',
     'Company.companyname' => '公司名',
-    'Type.name'           => '标题'
+    'Type.name'           => '分类标题'
 ];

+ 15 - 0
application/admin/view/caozuoguifan/add.html

@@ -35,11 +35,26 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Videofile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-videofile" class="form-control" size="50" name="row[videofile]" type="text" value="">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-videofile" class="btn btn-danger faupload" data-input-id="c-videofile" data-multiple="false" data-preview-id="p-videofile"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-videofile" class="btn btn-primary fachoose" data-input-id="c-videofile" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-videofile"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-videofile"></ul>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
         <div class="col-xs-12 col-sm-8">
             <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
         </div>
     </div>
+
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 15 - 0
application/admin/view/caozuoguifan/edit.html

@@ -35,11 +35,26 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Videofile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-videofile" class="form-control" size="50" name="row[videofile]" type="text" value="{$row.videofile|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-videofile" class="btn btn-danger faupload" data-input-id="c-videofile" data-multiple="false" data-preview-id="p-videofile"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-videofile" class="btn btn-primary fachoose" data-input-id="c-videofile" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-videofile"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-videofile"></ul>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
         <div class="col-xs-12 col-sm-8">
             <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
         </div>
     </div>
+
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 4 - 12
public/assets/js/backend/caozuoguifan.js

@@ -27,13 +27,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'company_id', title: __('Company_id')},
-                        {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'company.companyname', title: __('Company.companyname'), operate: 'LIKE'},
                         {field: 'type_id', title: __('Type_id')},
+                        {field: 'type.name', title: __('Type.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {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: 'videofile', title: __('Videofile'), operate: false, formatter: Table.api.formatter.video},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'company.companyname', title: __('Company.companyname'), operate: 'LIKE'},
-                        {field: 'type.name', title: __('Type.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
@@ -56,12 +57,3 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
     };
     return Controller;
 });
-
-$("#c-type_id").data("params", function (obj) {
-    return {
-        custom: {company_id: $("#c-company_id").val()}
-    };
-});
-$(document).on("change","#c-company_id",function(){
-    $("#c-type_id").selectPageClear();
-})

+ 18 - 0
public/assets/js/require-table.js

@@ -732,6 +732,24 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                     //渲染fontawesome图标
                     return '<i class="' + value + '"></i> ' + value;
                 },
+                audio: function (value, row, index) {
+                    value = value == null || value.length === 0 ? '' : value.toString();
+
+                    if(!value){
+                        return '';
+                    }
+
+                    return '<audio controls="controls" src="' + value + '" /></audio>';
+                },
+                video: function (value, row, index) {
+                    value = value == null || value.length === 0 ? '' : value.toString();
+
+                    if(!value){
+                        return '';
+                    }
+
+                    return '<video width="100" height="100" controls><source src="'+ Fast.api.cdnurl(value) +'" type="video/ogg"></video>';
+                },
                 image: function (value, row, index) {
                     return Table.api.formatter.images.call(this, value, row, index);
                 },