dever 4 years ago
parent
commit
2777c254c5
3 changed files with 44 additions and 11 deletions
  1. 29 3
      app/content/database/news.php
  2. 11 6
      main/src/Content.php
  3. 4 2
      main/template/xuniren/article.php

+ 29 - 3
app/content/database/news.php

@@ -138,11 +138,11 @@ return array
         'video'     => array
         (
             'type'      => 'varchar-800',
-            'name'      => '上传视频-视频格式mp4,上传大小不能超过4G,如果上传了视频,上述封面图将作为视频封面',
+            'name'      => '上传视频-视频格式mp4,上传大小不能超过4G,上述封面图将作为视频封面',
             'default'   => '',
             'desc'      => '上传推荐视频',
-            'match'     => 'option',
-            'update'    => 'upload',
+            'match'     => $type_value == 3 ? 'is_string' : 'option',
+            'update'    => $type_value == 3 ? 'upload' : 'hidden',
             'key'       => '3',
             'place'     => '150',
             'upload'    => 'yun',
@@ -219,6 +219,32 @@ return array
             'key'       => '1',
         ),
 
+        'content_video'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '上传内容视频-视频格式mp4,上传大小不能超过4G,如果上传了视频',
+            'default'   => '',
+            'desc'      => '上传推荐视频',
+            'match'     => $type_value != 3 ? 'option' : 'option',
+            'update'    => $type_value != 3 ? 'upload' : 'hidden',
+            'key'       => '3',
+            'place'     => '150',
+            'upload'    => 'yun',
+            'large'     => true,
+        ),
+
+        'content_video_pic'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '内容视频封面图-图片尺寸1200*500px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => '封面图',
+            'match'     => $type_value != 3 ? 'option' : 'option',
+            'update'    => $type_value != 3 ? 'image' : 'hidden',
+            'key'       => '1',
+            'place'     => '1200*500',
+        ),
+
         'beizhu'      => array
         (
             'type'      => 'varchar-500',

+ 11 - 6
main/src/Content.php

@@ -267,7 +267,7 @@ class Content
     {
         $data = Dever::load('main/content.view');
         $result = array();
-        if ($data['type'] != 3 && $data['video']) {
+        if ($data['type'] != 3 && $data['content_video']) {
             return true;
         }
 
@@ -514,11 +514,16 @@ class Content
 
         $data = Dever::db('content/news')->one($id);
 
-        if ($data && isset($data['video']) && $data['video']) {
-            $info['video'] = $data['video'];
-            if (strstr($data['video'], '.qq.com')) {
-                $video_info = Dever::qqvideo($data['video']);
-                $info['video'] = isset($video_info[0]) ? $video_info[0] : '';
+        $video = '';
+        if ($data && $data['type'] == 3) {
+            $video = $data['video'];
+        } elseif ($data && $data['type'] != 3) {
+            $video = $data['content_video'];
+        }
+        if ($data && $video) {
+            $info['video'] = $video;
+            if (strstr($info['video'], '.qq.com')) {
+                $info['video'] = Dever::qqvideo($info['video']);
             }
 
             return $info;

+ 4 - 2
main/template/xuniren/article.php

@@ -17,15 +17,17 @@ $view
 
 ->fetch(array('.article-content .article', 0), 'main/content.view#content')
 
+# 页面上部视频 仅限视频模板
 ->fetch(array('.video-module@style', 0), 'main/content.view_video_1', 'none')
 ->fetch(array('.article-wrapper img@src', 0), 'main/content.view#pic')
 ->fetch(array('.article-wrapper img@src', 1), 'main/content.view#pic')
 ->fetch(array('.icon-play@data-url', 0), 'main/content.view#video_link')
 
 
+# 页面下部视频 仅限除视频之外的模板
 ->fetch(array('.article-video@style', 0), 'main/content.view_video_2', 'none')
-->fetch(array('.article-wrapper img@src', 0), 'main/content.view#pic')
-->fetch(array('.article-wrapper img@src', 1), 'main/content.view#pic')
+->fetch(array('.article-wrapper img@src', 0), 'main/content.view#content_video_pic')
+->fetch(array('.article-wrapper img@src', 1), 'main/content.view#content_video_pic')
 ->fetch(array('.icon-play@data-url', 1), 'main/content.view#video_link')