提交 ef636bc2 编写于 作者: H HFO4

Feat: My share

上级 3a491208
......@@ -222,36 +222,39 @@ class Share extends Controller{
$shareId = input('post.id');
$shareObj = new ShareHandler($shareId,false);
if(!$shareObj->querryStatus){
return array(
return json(array(
"error" => 1,
"msg" => "分享不存在"
);
));
}
return $shareObj->deleteShare($this->userObj->uid);
return json($shareObj->deleteShare($this->userObj->uid));
}
public function ChangePromission(){
$shareId = input('post.id');
$shareObj = new ShareHandler($shareId,false);
if(!$shareObj->querryStatus){
return array(
return json(array(
"error" => 1,
"msg" => "分享不存在"
);
));
}
return $shareObj->changePromission($this->userObj->uid);
return json($shareObj->changePromission($this->userObj->uid));
}
public function My(){
public function ListMyShare(){
if(!$this->userObj->loginStatus){
$this->redirect(url('/Login','',''));
exit();
}
$userInfo = $this->userObj->getInfo();
$groupData = $this->userObj->getGroupData();
$list = Db::name('shares')->where('owner',$this->userObj->uid)->order('share_time DESC')->paginate(30);
$listData = $list->all();
$list = Db::name('shares')
->where('owner',$this->userObj->uid)
->order('share_time DESC')
->page(input("post.page").",18")
->select();
$listData = $list;
foreach ($listData as $key => $value) {
unset($listData[$key]["source_name"]);
if($value["source_type"]=="file"){
$listData[$key]["fileData"] = Db::name('files')->where('id',$value["source_name"])->find()["orign_name"];
......@@ -259,12 +262,20 @@ class Share extends Controller{
$listData[$key]["fileData"] = $value["source_name"];
}
}
return json($listData);
}
public function My(){
if(!$this->userObj->loginStatus){
$this->redirect(url('/Login','',''));
exit();
}
$userInfo = $this->userObj->getInfo();
$groupData = $this->userObj->getGroupData();
return view('share_home', [
'options' => Option::getValues(['basic','share']),
'userInfo' => $userInfo,
'options' => Option::getValues(['basic','share'],$this->userObj->userSQLData),
'userData' => $userInfo,
'groupData' => $groupData,
'list' => $listData,
'listOrigin' => $list
]);
}
......
......@@ -57,13 +57,15 @@ class ShareHandler extends Model{
"msg" => "无权操作"
);
}
$newPwd = self::getRandomKey(6);
Db::name('shares')->where('share_key',$this->shareData["share_key"])->update([
'type' => $this->shareData["type"] == "public"?"private":"public",
'share_pwd' => self::getRandomKey(6)
'share_pwd' => $newPwd
]);
return array(
"error" =>0,
"msg" => "更改成功"
"msg" => "更改成功",
"newPwd" => $newPwd,
);
}
......
......@@ -84,10 +84,11 @@
<script src="http://192.168.123.19:3000/static/js/3.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/5.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/7.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/6.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/11.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/10.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/8.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/12.chunk.js"></script>
<script src="http://192.168.123.19:3000/static/js/index.chunk.js"></script>
</html>
\ No newline at end of file
{extend name="header_home" /}
{block name="title"}我的分享- {$options.siteName}{/block}
{block name="content"}
<script src="/static/js/share_home.js"></script>
</head>
<body >
<!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">
<meta name="theme-color" content="{$options.themeColor}" />
<!--
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="/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.
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" id="deleteConfirm">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">确认</h4>
</div>
<div class="modal-body">
您确定要取消此分享吗?
</div>
<div class="modal-footer">
<button type="button" class="btn pro-btn" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary pro-btn" onclick="deleteConfirm();">确定</button>
</div>
</div>
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">
colorTheme = {:json_encode($options["themeConfig"])};
isHomePage = false;
isSharePage = false;
pageId="shareLock";
userInfo = {
uid: {$userData.uid},
nick: "{$userData.userNick}",
email: "{$userData.userMail}",
group: "{$userData.groupData.group_name}",
groupId: {$userData.groupData.id},
groupColor: "{$userData.groupData.color}",
};
siteInfo = {
mainTitle: "{$options.siteName}",
};
uploadConfig = {
allowSource: false,
allowShare: false,
allowRemoteDownload: "0",
allowTorrentDownload: "0",
};
isMobile = window.innerWidth < 600;
</script>
</head>
</div>
</div>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" id="changeConfirm">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">确认</h4>
</div>
<div class="modal-body">
您确定要将此分享改为<span id="shareType"></span>
</div>
<div class="modal-footer">
<button type="button" class="btn pro-btn" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary pro-btn" onclick="changeConfirm();">确定</button>
</div>
</div>
<body>
</div>
</div>
<div id="container">
{include file="navbar_home" /}
<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.
<div class="col-md-10 share-content">
<h1>我的分享</h1>
<br>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="50%">文件名</th>
<th class="table_center">分享日期</th>
<th class="table_center">分享类型</th>
<th class="table_center">下载次数</th>
<th class="table_center">浏览次数</th>
<th class="table_center">操作</th>
</tr>
</thead>
<tbody>
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
{volist name='list' id='shares'}
<tr id="{$shares.share_key}">
<td >{switch $shares.source_type}
{case file}<i class="fa fa-file" aria-hidden="true"></i> {/case}
{case dir}<i class="fa fa-folder-open blue" aria-hidden="true"></i> {/case}
{/switch} {$shares.fileData}</td>
<td align="center">{$shares.share_time}</td>
<td align="center">{switch $shares.type}
{case private}<button class="btn btn-default small-btn" data-toggle="tooltip" data-placement="top" title="密码:{$shares.share_pwd},点击变更公开类型" onclick="changeType('{$shares.share_key}','private')"><i class="fa fa-lock" aria-hidden="true"></i></button> {/case}
{case public}<button class="btn btn-default small-btn" data-toggle="tooltip" data-placement="top" title="变更公开类型" onclick="changeType('{$shares.share_key}','public')"><i class="fa fa-eye" aria-hidden="true"></i></button> {/case}
{/switch} </td>
<td align="center">{$shares.download_num}</td>
<td align="center">{$shares.view_num}</td>
<td align="center"><button class="btn btn-info small-btn-border" data-toggle="tooltip" data-placement="top" title="查看分享" onclick="openShare('{$shares.share_key}')"><i class="fa fa-share-square" aria-hidden="true"></i></button>
<button class="btn btn-danger small-btn-border" data-toggle="tooltip" data-placement="top" title="删除分享" onclick="deleteShare('{$shares.share_key}')"><i class="fa fa-times" aria-hidden="true"></i></button>
<button class="btn btn-success small-btn-border" data-toggle="tooltip" data-placement="top" title="变更公开类型" onclick="changeType('{$shares.share_key}','{$shares.type}')"><i class="fa fa-unlock-alt" aria-hidden="true"></i></button>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
{$listOrigin->render()}
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="/static/js/material.js"></script>
<script type="text/javascript">
upload_load=0;
<script src="http://192.168.123.19:3000/static/js/runtime~myShare.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/2.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/7.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/myShare.chunk.js"></script>
</script>
{$options.js_code}
</html>
{/block}
\ No newline at end of file
</html>
\ No newline at end of file
{extend name="header_home" /}
{block name="title"}我的分享- {$options.siteName}{/block}
{block name="content"}
<script src="/static/js/share_home.js"></script>
</head>
<body >
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" id="deleteConfirm">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">确认</h4>
</div>
<div class="modal-body">
您确定要取消此分享吗?
</div>
<div class="modal-footer">
<button type="button" class="btn pro-btn" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary pro-btn" onclick="deleteConfirm();">确定</button>
</div>
</div>
</div>
</div>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" id="changeConfirm">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">确认</h4>
</div>
<div class="modal-body">
您确定要将此分享改为<span id="shareType"></span>
</div>
<div class="modal-footer">
<button type="button" class="btn pro-btn" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary pro-btn" onclick="changeConfirm();">确定</button>
</div>
</div>
</div>
</div>
<div id="container">
{include file="navbar_home" /}
<div class="col-md-10 share-content">
<h1>我的分享</h1>
<br>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="50%">文件名</th>
<th class="table_center">分享日期</th>
<th class="table_center">分享类型</th>
<th class="table_center">下载次数</th>
<th class="table_center">浏览次数</th>
<th class="table_center">操作</th>
</tr>
</thead>
<tbody>
{volist name='list' id='shares'}
<tr id="{$shares.share_key}">
<td >{switch $shares.source_type}
{case file}<i class="fa fa-file" aria-hidden="true"></i> {/case}
{case dir}<i class="fa fa-folder-open blue" aria-hidden="true"></i> {/case}
{/switch} {$shares.fileData}</td>
<td align="center">{$shares.share_time}</td>
<td align="center">{switch $shares.type}
{case private}<button class="btn btn-default small-btn" data-toggle="tooltip" data-placement="top" title="密码:{$shares.share_pwd},点击变更公开类型" onclick="changeType('{$shares.share_key}','private')"><i class="fa fa-lock" aria-hidden="true"></i></button> {/case}
{case public}<button class="btn btn-default small-btn" data-toggle="tooltip" data-placement="top" title="变更公开类型" onclick="changeType('{$shares.share_key}','public')"><i class="fa fa-eye" aria-hidden="true"></i></button> {/case}
{/switch} </td>
<td align="center">{$shares.download_num}</td>
<td align="center">{$shares.view_num}</td>
<td align="center"><button class="btn btn-info small-btn-border" data-toggle="tooltip" data-placement="top" title="查看分享" onclick="openShare('{$shares.share_key}')"><i class="fa fa-share-square" aria-hidden="true"></i></button>
<button class="btn btn-danger small-btn-border" data-toggle="tooltip" data-placement="top" title="删除分享" onclick="deleteShare('{$shares.share_key}')"><i class="fa fa-times" aria-hidden="true"></i></button>
<button class="btn btn-success small-btn-border" data-toggle="tooltip" data-placement="top" title="变更公开类型" onclick="changeType('{$shares.share_key}','{$shares.type}')"><i class="fa fa-unlock-alt" aria-hidden="true"></i></button>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
{$listOrigin->render()}
</body>
<script src="/static/js/material.js"></script>
<script type="text/javascript">
upload_load=0;
</script>
{$options.js_code}
</html>
{/block}
\ No newline at end of file
{extend name="header_public" /}
{block name="title"}私密分享 - {$options.siteName}{/block}
{block name="content"}
<link rel="stylesheet" href="/static/css/share.css" />
<link rel="stylesheet" href="/static/css/lock.css" />
<script src="/static/js/jquery.color.js"></script>
</head>
<body data-ma-header="teal">
<nav class="navbar navbar-inverse" >
<div class="container-fluid">
<div class="container" >
{include file="navbar_public" loginStatus=$loginStatus userData=$userData /}
<div class="header-panel shadow-z-2">
<div class="container-fluid">
<div class="row">
</div>
</div>
</div>
<div class="container main" >
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="jumbotron" >
<div class="card_top">
<div class="row top-color">
<div class="card-top-row">
加密分享
</div>
</div>
</div>
<div class="card_botom">
<div class="row bottom-width" align="right">
<input type="password" class="form-control" id="inputPassword" placeholder="请输入分享密码" value="{$pwd}">
<button href="javascript:void(0)" id="submit_pwd" class="btn btn-raised active"><i class="fa fa-arrow-right" aria-hidden="true"></i></button>
</div>
</div>
</div>
<div class="col-md-4"></div>
</div>
</div>
</body>
<script src="/static/js/jquery.liMarquee.js"></script>
<script type="text/javascript">
shareInfo={
shareId : "{$shareData.share_key}",
};
</script>
<script src="/static/js/lock.js"> </script>
{$options.js_code}
{/block}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册