Showing
4 changed files
with
90 additions
and
41 deletions
| ... | @@ -87,38 +87,48 @@ class VideoTempController extends AdminController | ... | @@ -87,38 +87,48 @@ class VideoTempController extends AdminController |
| 87 | $form->showFooter(); | 87 | $form->showFooter(); |
| 88 | // 设置字段宽度 | 88 | // 设置字段宽度 |
| 89 | $form->width(8, 3); | 89 | $form->width(8, 3); |
| 90 | - $form->column(12, function (Form\BlockForm $form) { | ||
| 91 | - $form->text('title'); | ||
| 92 | - $form->radio('type')->options(['视频', '图文音频'])->default(0); | ||
| 93 | - $form->radio('bg_type') | ||
| 94 | - ->options([1=>'视频', 2=>'图片']) | ||
| 95 | - ->when(1,function (Form\BlockForm $form){ | ||
| 96 | - $form->file('bg_url') | ||
| 97 | - ->accept('mp4') | ||
| 98 | - ->autoUpload() | ||
| 99 | - ->uniqueName() | ||
| 100 | - ->addElementClass('bg_url'); | ||
| 101 | - }) | ||
| 102 | - ->when(2,function (Form\BlockForm $form){ | ||
| 103 | - $form->multipleImage('bg_url') | ||
| 104 | - ->limit(5) | ||
| 105 | - ->uniqueName() | ||
| 106 | - ->addElementClass('multi_bg_url'); | ||
| 107 | - }) | ||
| 108 | - ->default(1); | ||
| 109 | - $form->radio('bg_music') | ||
| 110 | - ->options(['无', '有']) | ||
| 111 | - ->when(1,function (Form\BlockForm $form){ | ||
| 112 | - $form->text('bgm_url'); | ||
| 113 | - }) | ||
| 114 | - ->default(0); | ||
| 115 | - $form->number('top'); | ||
| 116 | - $form->number('left'); | ||
| 117 | - $form->number('font_size'); | ||
| 118 | - $form->number('sn'); | ||
| 119 | - $form->radio('state')->options(['不显示', '显示'])->default(0); | ||
| 120 | 90 | ||
| 121 | - }); | 91 | + $form->text('title'); |
| 92 | + $form->radio('type')->addElementClass('type') | ||
| 93 | + ->options([1=>'图文音频',2=>'视频'])->default(1); | ||
| 94 | + $form->radio('bg_type') | ||
| 95 | + ->options([1=>'视频', 2=>'图片']) | ||
| 96 | + ->when(1,function (Form\BlockForm $form){ | ||
| 97 | + $form->file('bg_url') | ||
| 98 | + ->accept('mp4') | ||
| 99 | + ->autoUpload() | ||
| 100 | + ->uniqueName() | ||
| 101 | + ->addElementClass('bg_video_url'); | ||
| 102 | + }) | ||
| 103 | + ->when(2,function (Form\BlockForm $form){ | ||
| 104 | + $form->multipleImage('bg_url') | ||
| 105 | + ->limit(5) | ||
| 106 | + ->uniqueName() | ||
| 107 | + ->addElementClass('bg_img_url'); | ||
| 108 | + }) | ||
| 109 | + ->default(1); | ||
| 110 | + $form->radio('bg_music') | ||
| 111 | + ->options(['无', '有']) | ||
| 112 | + ->when(1,function (Form\BlockForm $form){ | ||
| 113 | + $form->file('bgm_url') | ||
| 114 | + ->accept('mp3,aac,wav') | ||
| 115 | + ->autoUpload() | ||
| 116 | + ->uniqueName() | ||
| 117 | + ->addElementClass('bgm_url'); | ||
| 118 | + }) | ||
| 119 | + ->default(0); | ||
| 120 | + $form->number('top'); | ||
| 121 | + $form->number('left'); | ||
| 122 | + $form->number('font_size'); | ||
| 123 | + $form->color('text_color')->addElementClass('text_color'); | ||
| 124 | + $form->color('text_bg_color')->addElementClass('text_bg_color'); | ||
| 125 | + $form->number('opacity')->min(0)->max(100) | ||
| 126 | + ->addElementClass('opacity')->default(90) | ||
| 127 | + ->help('范围为0-100,100表示不透明,0表示完全透明'); | ||
| 128 | + | ||
| 129 | + $form->number('sn'); | ||
| 130 | + $form->radio('state')->options(['不显示', '显示'])->default(0); | ||
| 131 | + | ||
| 122 | }); | 132 | }); |
| 123 | 133 | ||
| 124 | $form->block(4, function (Form\BlockForm $form) { | 134 | $form->block(4, function (Form\BlockForm $form) { | ... | ... |
| ... | @@ -21,6 +21,11 @@ class CreateVideoTempTable extends Migration | ... | @@ -21,6 +21,11 @@ class CreateVideoTempTable extends Migration |
| 21 | $table->string('bg_url')->nullable()->comment('背景动画化地址'); | 21 | $table->string('bg_url')->nullable()->comment('背景动画化地址'); |
| 22 | $table->unsignedTinyInteger('bg_music')->comment('0=没有,1=有'); | 22 | $table->unsignedTinyInteger('bg_music')->comment('0=没有,1=有'); |
| 23 | $table->string('bgm_url')->nullable()->comment('背景音乐地址'); | 23 | $table->string('bgm_url')->nullable()->comment('背景音乐地址'); |
| 24 | + | ||
| 25 | + $table->string('text_color')->nullable()->comment('文字颜色'); | ||
| 26 | + $table->string('text_bg_color')->nullable()->comment('文字背景色'); | ||
| 27 | + $table->double('opacity')->nullable()->comment('透明度'); | ||
| 28 | + | ||
| 24 | $table->unsignedTinyInteger('sn')->default('99')->comment('序号'); | 29 | $table->unsignedTinyInteger('sn')->default('99')->comment('序号'); |
| 25 | $table->unsignedSmallInteger('top')->default('0')->comment('距离容器上边距'); | 30 | $table->unsignedSmallInteger('top')->default('0')->comment('距离容器上边距'); |
| 26 | $table->unsignedSmallInteger('left')->default('0')->comment('距离容器左边距'); | 31 | $table->unsignedSmallInteger('left')->default('0')->comment('距离容器左边距'); | ... | ... |
| ... | @@ -16,6 +16,9 @@ return [ | ... | @@ -16,6 +16,9 @@ return [ |
| 16 | 'top' => '距离容器上边距', | 16 | 'top' => '距离容器上边距', |
| 17 | 'left' => '距离容器左边距', | 17 | 'left' => '距离容器左边距', |
| 18 | 'font_size' => '字号', | 18 | 'font_size' => '字号', |
| 19 | + 'text_color' => '文字颜色', | ||
| 20 | + 'text_bg_color' => '文字背景色', | ||
| 21 | + 'opacity' => '透明度', | ||
| 19 | ], | 22 | ], |
| 20 | 'options' => [ | 23 | 'options' => [ |
| 21 | ], | 24 | ], | ... | ... |
| ... | @@ -5,12 +5,12 @@ | ... | @@ -5,12 +5,12 @@ |
| 5 | border-radius: 40px; | 5 | border-radius: 40px; |
| 6 | margin-right: 24px; | 6 | margin-right: 24px; |
| 7 | padding: 37px 20px; | 7 | padding: 37px 20px; |
| 8 | - min-height: 679px; | 8 | + min-height: 779px; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | .phone-content { | 11 | .phone-content { |
| 12 | border: 1px solid rgb(220, 223, 230); | 12 | border: 1px solid rgb(220, 223, 230); |
| 13 | - height: 605px; | 13 | + height: 705px; |
| 14 | overflow: hidden; | 14 | overflow: hidden; |
| 15 | position: relative; | 15 | position: relative; |
| 16 | background: rgb(245, 245, 245); | 16 | background: rgb(245, 245, 245); |
| ... | @@ -54,12 +54,20 @@ | ... | @@ -54,12 +54,20 @@ |
| 54 | font-size: 12px; | 54 | font-size: 12px; |
| 55 | margin: 0; | 55 | margin: 0; |
| 56 | } | 56 | } |
| 57 | + | ||
| 58 | + .bg-box { | ||
| 59 | + height: 625px; | ||
| 60 | + } | ||
| 57 | </style> | 61 | </style> |
| 58 | <div class="box-card"> | 62 | <div class="box-card"> |
| 59 | <div class="phone-content"> | 63 | <div class="phone-content"> |
| 60 | <div class="text">模板</div> | 64 | <div class="text">模板</div> |
| 61 | <img src="{{asset('storage/image/mobile-head.png')}}" alt="" width="338" height="80"> | 65 | <img src="{{asset('storage/image/mobile-head.png')}}" alt="" width="338" height="80"> |
| 62 | - | 66 | + <div class="bg-box"> |
| 67 | + <img width="338" height="625" class="bg_img" style="display: none"> | ||
| 68 | + <video width="338" height="625" id="bg_video" style="display: none"></video> | ||
| 69 | + <audio id="bg_audio" ></audio> | ||
| 70 | + </div> | ||
| 63 | <div class="poem-block"> | 71 | <div class="poem-block"> |
| 64 | <p class="poem-title">题破山寺后禅院</p> | 72 | <p class="poem-title">题破山寺后禅院</p> |
| 65 | <p class="poem-author">-- 常建</p> | 73 | <p class="poem-author">-- 常建</p> |
| ... | @@ -74,22 +82,45 @@ | ... | @@ -74,22 +82,45 @@ |
| 74 | <button type="button" class="btn btn-primary sync"><i class="feather icon-repeat"></i> 同步基本设置</button> | 82 | <button type="button" class="btn btn-primary sync"><i class="feather icon-repeat"></i> 同步基本设置</button> |
| 75 | <script> | 83 | <script> |
| 76 | Dcat.ready(function () { | 84 | Dcat.ready(function () { |
| 77 | - $(document).off('click', '.sync').on('click', '.sync', function () { | 85 | + var asset = "{{asset('/storage/')}}"; |
| 78 | 86 | ||
| 87 | + $(document).off('click', '.sync').on('click', '.sync', function () { | ||
| 79 | let ori_top = 80; | 88 | let ori_top = 80; |
| 80 | let top = parseInt($('.field_top').val()) + ori_top; | 89 | let top = parseInt($('.field_top').val()) + ori_top; |
| 81 | let left = $('.field_left').val(); | 90 | let left = $('.field_left').val(); |
| 82 | let font = $('.field_font_size').val(); | 91 | let font = $('.field_font_size').val(); |
| 83 | let content_size = 12 + parseInt(font); | 92 | let content_size = 12 + parseInt(font); |
| 84 | let title_size = 14 + parseInt(font); | 93 | let title_size = 14 + parseInt(font); |
| 94 | + let text_color = $('.text_color').val() || 'whitesmoke'; | ||
| 95 | + let text_bg_color = $('.text_bg_color').val() || '#5c6bc6'; | ||
| 96 | + let opacity = parseInt($('.opacity').val()) / 100; | ||
| 97 | + | ||
| 98 | + $('.poem-block').css('top', top + 'px').css('left', left + 'px') | ||
| 99 | + .css('background-color', text_bg_color).css('opacity', opacity); | ||
| 100 | + $('.poem-title').css('font-size', title_size + 'px').css('color', text_color); | ||
| 101 | + $('.poem-content').css('font-size', content_size + 'px').css('color', text_color); | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + let bg_img_url = $('.bg_img_url').find("input[type='hidden'][name='bg_url']").val(); | ||
| 105 | + if (bg_img_url !== '') { | ||
| 106 | + $('.bg_img').attr('src', asset + '/' + bg_img_url).css('display', 'block'); | ||
| 107 | + } | ||
| 85 | 108 | ||
| 86 | - $('.poem-block').css('top', top + 'px').css('left', left + 'px'); | 109 | + let bg_video_url = $('.bg_video_url').find("input[type='hidden'][name='bg_url']").val(); |
| 87 | - $('.poem-title').css('font-size', title_size + 'px'); | 110 | + if (bg_video_url !== ''){ |
| 88 | - $('.poem-content').css('font-size', content_size + 'px'); | 111 | + $('#bg_video').attr('src', asset + '/' + bg_video_url).css('display', 'block'); |
| 112 | + let bg_video = document.getElementById('bg_video'); | ||
| 113 | + bg_video.autoplay = true; | ||
| 114 | + bg_video.loop = true; | ||
| 115 | + } | ||
| 89 | 116 | ||
| 90 | - console.log(top) | 117 | + let bgm_url = $('.bgm_url').find("input[type='hidden'][name='bgm_url']").val(); |
| 91 | - console.log(left) | 118 | + if (bgm_url !== ''){ |
| 92 | - console.log(font) | 119 | + $('#bg_audio').attr('src', asset + '/' + bgm_url); |
| 120 | + let bg_audio = document.getElementById('bg_audio'); | ||
| 121 | + bg_audio.autoplay = true; | ||
| 122 | + bg_audio.loop = true; | ||
| 123 | + } | ||
| 93 | }) | 124 | }) |
| 94 | 125 | ||
| 95 | }) | 126 | }) | ... | ... |
-
Please register or login to post a comment