Feat: Video preview

pull/141/head
HFO4 7 years ago
parent 3d82929a3b
commit da4f152438

@ -35,7 +35,7 @@ class Home extends Controller{
'extLimit' => $extLimit,
'policyData' => $policyData,
'groupData' => $groupData,
'path' => input("?get.path")?input("get.path"):"",
'path' => empty(input("get.path"))?"/":input("get.path"),
]);
}
@ -49,38 +49,4 @@ class Home extends Controller{
]);
}
public function Album(){
$userInfo = $this->userObj->getInfo();
$list = Db::name("files")->where("upload_user",$this->userObj->uid)
->where(function ($query) {
$query->where('orign_name', "like","%jpg")
->whereor('orign_name', "like","%png")
->whereor('orign_name', "like","%gif")
->whereor('orign_name', "like","%bmp");
})
->order('id DESC')
->paginate(9);
$pageCount = ceil(Db::name("files")->where("upload_user",$this->userObj->uid)
->where(function ($query) {
$query->where('orign_name', "like","%jpg")
->whereor('orign_name', "like","%png")
->whereor('orign_name', "like","%gif")
->whereor('orign_name', "like","%bmp");
})
->order('id DESC')->count()/9);
$listData = $list->all();
$pageNow = input("?get.page")?input("get.page"):1;
if($pageNow>$pageCount){
$this->error('您当前没有上传任何图片',404,Option::getValues(['basic','group_sell']));
}
return view('album', [
'options' => Option::getValues(['basic','group_sell']),
'userInfo' => $userInfo,
'list' => $listData,
'listOrigin' => $list,
'pageCount' => $pageCount,
'page' => $pageNow,
]);
}
}

@ -0,0 +1,39 @@
<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use \app\index\model\Option;
use \app\index\model\User;
use think\Session;
use \app\index\model\FileManage;
class Viewer extends Controller{
public $userObj;
public function _initialize(){
// $this->userObj = new User(cookie('user_id'),cookie('login_key'));
// if(!$this->userObj->loginStatus){
// $this->redirect(url('/Login','',''));
// exit();
// }
$this->userObj = new User(cookie('user_id'),cookie('login_key'));
}
public function Video(){
$path = input("get.path");
$pathSplit = explode("/",urldecode($path));
$userInfo = $this->userObj->getInfo();
$groupData = $this->userObj->getGroupData();
return view('video', [
'options' => Option::getValues(['basic']),
'userInfo' => $userInfo,
'groupData' => $groupData,
'url' => "/File/Preview?action=preview&path=".$path,
'fileName' => end($pathSplit),
]);
}
}

@ -20,6 +20,7 @@
-->
<title>我的文件 - {$options.siteName}</title>
<script type="text/javascript">
isHomePage=true;
uploadConfig={
saveType : "{$policyData.policy_type}",
maxSize : "{$policyData.max_size}mb",
@ -46,8 +47,12 @@
groupId:{$userInfo.groupData.id},
groupColor:"{$userInfo.groupData.color}",
};
siteInfo = {
mainTitle:"{$options.siteName}",
};
path = "{$path}";
mediaType = {}
mediaType = {},
isMobile = window.innerWidth<600;
</script>
</head>
<body>
@ -67,5 +72,7 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script src="http://localhost:3000/static/js/bundle.js"></script><script src="http://localhost:3000/static/js/0.chunk.js"></script><script src="http://localhost:3000/static/js/1.chunk.js"></script><script src="http://localhost:3000/static/js/main.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/runtime~index.bundle.js"></script><script src="http://192.168.123.19:3000/static/js/0.chunk.js"></script><script src="http://192.168.123.19:3000/static/js/1.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/3.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/index.chunk.js"></script>
</html>

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>我的文件 - {$options.siteName}</title>
<script type="text/javascript">
isHomePage = false,
apiURL={
imgThumb:"/File/Thumb",
preview:"/File/Preview",
download:"/File/Download",
docPreiview:'/File/DocPreview',
};
userInfo={
uid:{$userInfo.uid},
nick:"{$userInfo.userNick}",
email:"{$userInfo.userMail}",
group:"{$userInfo.groupData.group_name}",
groupId:{$userInfo.groupData.id},
groupColor:"{$userInfo.groupData.color}",
};
siteInfo = {
mainTitle:"{$fileName}",
};
videoInfo={
url:"{$url}",
name:"{$fileName}"
};
mediaType = {},
isMobile = window.innerWidth<600;
</script>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script src="http://192.168.123.19:3000/static/js/runtime~video.bundle.js"></script><script src="http://192.168.123.19:3000/static/js/5.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/0.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/4.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/9.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/1.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/video.chunk.js"></script>
</html>
Loading…
Cancel
Save