123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <link rel="stylesheet" type="text/css" href="../Js/layui/font/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="../Js/layui/css/layui.css" />
- <meta charset="utf-8" />
- <title>首页</title>
- <style>
- body {
- font-family: 'Microsoft YaHei';
- background-color: #F0F8FF;
- }
- ul .layui-icon {
- font-size: 18px !important;
- }
- tbody .layui-icon {
- font-size: 15px !important;
- }
- ul .iconfont {
- font-size: 18px !important;
- }
- tbody .iconfont {
- font-size: 15px !important;
- }
-
- th .headSpan {
- font-size: 18px;
- }
- .layui-breadcrumb {
- font-size: 12px;
- }
- /*.layui-table {
- box-shadow: 5px 5px 10px 5px rgba(0,0,0,0.1), -5px 5px 5px 5px rgba(0,0,0,0.1);
- }*/
- .webuploader-element-invisible label {
- background: unset;
- visibility: hidden;
- display: inherit;
- }
- .hidden {
- display:none;
- }
- .layui-nav {
- height:40px;
- }
- .layui-nav-item {
- line-height: 40px!important;
- }
- table tr td {
- margin: 5px;
- }
- table tr td a {
- margin:5px;
- }
- </style>
- </head>
- <body>
- <script src="../Js/layui/layui.all.js"></script>
- <script src="../Js/Common.js"></script>
- <div id="navigation"></div>
- <div style="padding: 50px;padding-top:10px;">
- <div id="breadcrumb"></div>
- <table class="layui-table">
- <colgroup>
- <col width="350">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th><span class="headSpan" id="nameHead">Name</span></th>
- <th><span class="headSpan" id="fileSizeHead">Size</span></th>
- <th><span class="headSpan" id="createrHead">Creater</span></th>
- <th><span class="headSpan" id="createTimeHead">CreateTime</span></th>
- <th><span class="headSpan" id="operationsHead">Operations</span></th>
- </tr>
- </thead>
- <tbody id="foldersAndFiles">
- </tbody>
- </table>
- <div class="hidden" id="haveNoRight">
- <p style="color:coral">You have no permission, please contact the administrator</p>
- </div>
- </div>
- <script>
- var param = layui.getParams();
- var currUser = param.currUser;
- var currId = parseInt(param.currId);
- var lang = param.lang;
- if (!layui.isEmpty(lang)) {
- layui.setCurrentLan(lang);
- }
- var currRole = 0;
- upgradBread(currId);
- loadPage();
- layui.$("#haveNoRight>p").text(layui.translater("NoPermission"));
- layui.$("#nameHead").text(layui.translater("Name"));
- layui.$("#operationsHead").text(layui.translater("Operations"));
- layui.$("#fileSizeHead").text(layui.translater("FileSize"));
- layui.$("#createrHead").text(layui.translater("Creater"));
- layui.$("#createTimeHead").text(layui.translater("CreateTime"));
- function loadPage() {
- layui.doGet("/CloudDisk/User/GetUserByName", { name: currUser }, function (result) {
- if (layui.isEmpty(result)) {
- layui.$("#haveNoRight").removeClass("hidden");
- }
- else {
- layui.$("#haveNoRight").addClass("hidden");
- }
- currRole = result.role;
- layui.showTPL("#navigation", "/Views/navigationTPL.html", { role: currRole }, function () {
- layui.$("#refresh").click(function () {
- layui.clearLanguage();
- layui.initLanguage();
- location.href = "/Views/Index.html?currId=" + currId + "&currUser=" + currUser + "&lang=" + lang + "&time=" + new Date().getTime();
- });
- layui.$("#upload").click(function () {
- layer.open({
- type: 2
- , offset: 'auto'
- , title: ' '
- , shade: 0
- , area: ['316px', '290px']
- , id: 'uploadFileForm' //设定一个id,防止重复弹出
- , moveType: 0 //拖拽模式,0或者1
- , content: '/Views/upload.html?currId=' + currId + '&currUser=' + currUser
- , done: function () {
- loadPage();
- }
- });
- });
- layui.$("#add").click(function () {
- layer.open({
- type: 2
- , offset: 'auto'
- , title: ' '
- , shade: 0
- , area: ['530px', '221px']
- , id: 'addFolderForm' //设定一个id,防止重复弹出
- , moveType: 0 //拖拽模式,0或者1
- , content: '/Views/addFolder.html?currId=' + currId + '&currUser=' + currUser
- , done: function () {
- loadPage();
- }
- });
- });
- layui.$("#return").click(function () {
- var endBreadcrumb = 0;
- var breadcrumbList = localStorage.getItem("breadcrumbList");
- if (!layui.isEmpty(breadcrumbList)) {
- var start = breadcrumbList.lastIndexOf(',');
- endBreadcrumb = breadcrumbList.substring(start + 1);
- if (endBreadcrumb != "0") {
- var newBreadcrumb = breadcrumbList.substring(0, start);
- var endBreadcrumbIndex = newBreadcrumb.lastIndexOf(',');
- endBreadcrumb = newBreadcrumb.substring(endBreadcrumbIndex + 1);
- if (!layui.isEmpty(endBreadcrumb)) {
- localStorage.setItem("breadcrumbList", newBreadcrumb);
- }
- else {
- localStorage.setItem("breadcrumbList", "0");
- }
- }
- }
- currId = endBreadcrumb;
- loadPage();
- });
- });
- layui.doGet("/CloudDisk/FoldersAndFiles/GetFoldersAndFilesByFatherId", { fatherId: currId }, function (result) {
- var data = {
- items: result,
- currId: currId,
- role: currRole
- };
- layui.showTPL("#foldersAndFiles", "/Views/foldersAndFilesTPL.html", data);
- });
- var breadcrumbList = localStorage.getItem("breadcrumbList");
- layui.doPost("/CloudDisk/FoldersAndFiles/GetKeyValues", { breadcrumbList }, function (result) {
- var data = {
- items: result,
- currId: currId
- };
- layui.showTPL("#breadcrumb", "/Views/breadcrumbListTPL.html", data);
- });
- });
- }
- function enterFolder(refobj) {
- var data_id = layui.$(refobj).attr("data_id");
- var data_pass = layui.$(refobj).attr("data_pass");
- if (!layui.isEmpty(data_pass) && currRole<1) {
- layer.open({
- type: 2
- , offset: 'auto'
- , title: ' '
- , shade: 0
- , area: ['345px', '184px']
- , id: 'entryPassword' //设定一个id,防止重复弹出
- , moveType: 0 //拖拽模式,0或者1
- , content: '/Views/entryPassword.html?password=' + encodeURIComponent(data_pass) + "&data_id=" + data_id + "&type=1"
- , done: function () {
- loadPage();
- }
- });
- }
- else {
- upgradBread(data_id);
- }
- }
- function upgradBread(data_id) {
- currId = data_id;
- if (data_id!=null) {
- var breadcrumbList = localStorage.getItem("breadcrumbList");
- if (layui.isEmpty(breadcrumbList)) {
- if (data_id != "0") {
- data_id = "0," + data_id;
- }
- localStorage.setItem("breadcrumbList", data_id);
- }
- else {
- var currBread = breadcrumbList.split(',').find(function (f) { return parseInt(f) == parseInt(data_id); });
- if (layui.isEmpty(currBread)) {
- localStorage.setItem("breadcrumbList", (breadcrumbList + "," + data_id).trim(','));
- }
- else {
- var newBreadcrumbList = breadcrumbList.substring(0, ("," + breadcrumbList + ",").indexOf("," + data_id + ",") + data_id.toString().length);
- localStorage.setItem("breadcrumbList", newBreadcrumbList.trim(','));
- }
- }
- }
- loadPage();
- }
- function deleteFolderAndFiles(refobj) {
- var data_id = layui.$(refobj).attr("data_id");
- layer.confirm(layui.translater("DeleteConfirm"), { btn: [layui.translater("Confirm"), layui.translater("Cancel")], title: layui.translater("Reminder") }, function (index) {
- layui.doGet("/CloudDisk/FoldersAndFiles/DeleteFoldersAndFiles", { id: data_id }, function (back) {
- if (back.success) {
- loadPage();
- layer.close(index);
- }
- });
- });
- }
- function editFolderAndFiles(refobj) {
- var data_id = layui.$(refobj).attr("data_id");
- layer.open({
- type: 2
- , offset: 'auto'
- , title: ' '
- , shade: 0
- , area: ['530px', '221px']
- , id: 'EditFoldersAndFiles' //设定一个id,防止重复弹出
- , moveType: 0 //拖拽模式,0或者1
- , content: '/Views/editFoldersAndFiles.html?id=' + data_id + '&currUser=' + currUser
- , done: function () {
- loadPage();
- }
- });
- }
- var downloadUrl, fileName;
- function downloadFile(refobj) {
- downloadUrl = layui.$(refobj).attr("data_url");
- fileName = layui.$(refobj).attr("data_name");
- var data_pass = layui.$(refobj).attr("data_pass");
- if (!layui.isEmpty(data_pass) && currRole < 1) {
- layer.open({
- type: 2
- , offset: 'auto'
- , title: ' '
- , shade: 0
- , area: ['345px', '184px']
- , id: 'entryPassword' //设定一个id,防止重复弹出
- , moveType: 0 //拖拽模式,0或者1
- , content: '/Views/entryPassword.html?password=' + data_pass + "&type=0"
- , done: function () {
- loadPage();
- }
- });
- }
- else {
- doDownload();
- }
- }
- function doDownload() {
- layui.$("#tempDownload").remove();
- layui.$("body").append("<area id='tempDownload' target='_blank' style='display:none;' href='" + decodeURIComponent(downloadUrl) + "?fileName=" + decodeURIComponent(fileName) + "' download='" + decodeURIComponent(fileName) + "'></area>");
- layui.$("#tempDownload").click();
- }
- function dateFormat(time) {
- return layui.util.toDateString(time, "yyyy-MM-dd HH:mm");
- }
- function translater(key) {
- return layui.translater(key);
- }
- </script>
- </body>
- </html>
|