Browse Source

优化,修改

master
wen 2 years ago
parent
commit
3b0484d5d9
  1. 2
      public/index.html
  2. BIN
      public/jialuoma2.ico
  3. 2
      src/api/user.js
  4. BIN
      src/common/img/jialuoma2.png
  5. 2
      src/layout/index.vue
  6. 6
      src/permission.js
  7. 2
      src/settings.js
  8. 2
      src/store/modules/settings.js
  9. 1
      src/styles/index.scss
  10. 2
      src/styles/sidebar.scss
  11. 47
      src/views/filemange/index.vue
  12. 42
      src/views/subfile/index.vue

2
public/index.html

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>jialuoma2.ico"> <link rel="icon" href="<%= BASE_URL %>jialuoma2.ico">
<!-- <title><%= webpackConfig.name %></title> --> <!-- <title><%= webpackConfig.name %></title> -->
<title>嘉洛马 — 文件后台管理系统</title> <title>嘉洛马 - 文件管理后台</title>
<!-- <link rel="stylesheet" type="text/css" href="loadhead.css"> --> <!-- <link rel="stylesheet" type="text/css" href="loadhead.css"> -->
</head> </head>
<body> <body>

BIN
public/jialuoma2.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

2
src/api/user.js

@ -12,7 +12,9 @@ export function captcha(datas) {
// 请求出错处理 // 请求出错处理
export function requesterr(thiss, err) { export function requesterr(thiss, err) {
console.log(err);
console.log(err.toJSON());
if (err.response) { if (err.response) {
thiss.$message({ showClose: true, message: err.response.data.err, type: 'error' }); thiss.$message({ showClose: true, message: err.response.data.err, type: 'error' });
} else if (err.request) { } else if (err.request) {

BIN
src/common/img/jialuoma2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

2
src/layout/index.vue

@ -4,7 +4,7 @@
<a class="leftk" href="javascript:;"> <a class="leftk" href="javascript:;">
<img src="../common/img/jialuoma.png" alt="图片"> <img src="../common/img/jialuoma.png" alt="图片">
<em class="erectline"></em> <em class="erectline"></em>
<span>文件后台管理系统</span> <span>嘉洛马 - 文件管理后台</span>
</a> </a>
<div class="rightk tpriht"> <div class="rightk tpriht">
<!-- <a class="avatark" href="javascript:;" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <!-- <a class="avatark" href="javascript:;" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">

6
src/permission.js

@ -1,10 +1,10 @@
import router from './router' import router from './router'
import store from './store' import store from './store'
import { Message } from 'element-ui' //import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie import { getToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title' //import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration NProgress.configure({ showSpinner: false }) // NProgress Configuration
@ -16,7 +16,7 @@ router.beforeEach(async(to, from, next) => {
NProgress.start() NProgress.start()
//console.log(0) //console.log(0)
// set page title // set page title
document.title = getPageTitle(to.meta.title) //document.title = getPageTitle(to.meta.title)
//console.log(hasToken); //console.log(hasToken);
//next() //next()
// determine whether the user has logged in // determine whether the user has logged in

2
src/settings.js

@ -1,7 +1,7 @@
module.exports = { module.exports = {
title: '嘉洛马', title: '嘉洛马',
address: 'http://192.168.0.100', address: 'https://demo.jialuoma.com',
/** /**
* @type {boolean} true | false * @type {boolean} true | false

2
src/store/modules/settings.js

@ -12,7 +12,7 @@ const state = {
version:'', version:'',
supportedThemes: '', supportedThemes: '',
admin_supportedFileTypes: '.jpg, .jpeg, .png, .gif, .webp', admin_supportedFileTypes: '.jpg, .jpeg, .png, .gif, .webp',
admin_maxUploadFileSize: 5242870, admin_maxUploadFileSize: 20971520,
admin_maxUploadFileNumber: 5 admin_maxUploadFileNumber: 5
} }
} }

1
src/styles/index.scss

@ -63,6 +63,7 @@ div:focus {
} }
} }
// .fileicon>{color:#000;}
// main-container global css // main-container global css
.app-container { .app-container {

2
src/styles/sidebar.scss

@ -30,7 +30,7 @@
.current_thme_main span{font-weight:bold;} .current_thme_main span{font-weight:bold;}
// 当前版本 // 当前版本
.current_version{position:absolute;bottom:129px;left:0;right:0;background-color:#2b3245;font-size:14px;color:#cacdcb;padding:6px 0 36px 48px;text-shadow:1px 1px 0 rgb(255 255 255 / 30%),1px 1px 5px rgb(0 0 0 / 10%);} .current_version{position:absolute;bottom:129px;left:0;right:0;background-color:#2b3245;font-size:14px;color:#cacdcb;padding:10px 0 28px 48px;text-shadow:1px 1px 0 rgb(255 255 255 / 30%),1px 1px 5px rgb(0 0 0 / 10%);}
// reset element-ui css // reset element-ui css
.horizontal-collapse-transition { .horizontal-collapse-transition {

47
src/views/filemange/index.vue

@ -1,7 +1,8 @@
<template> <template>
<div class="filemange_container" v-loading="subloading" element-loading-text="文件夹获取中..."> <div class="filemange_container" v-loading="subloading" :element-loading-text="loadingText">
<div class="use_button"> <div class="use_button">
<el-button type="primary" icon="el-icon-edit" @click="dirbox = true">创建目录</el-button> <el-button type="primary" icon="el-icon-edit" @click="dirbox = true">创建目录</el-button>
<el-button type="primary" @click="getFileData" icon="el-icon-refresh-right">刷新</el-button>
<!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button> <!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button>
<el-button type="primary" icon="el-icon-edit">重命名</el-button> --> <el-button type="primary" icon="el-icon-edit">重命名</el-button> -->
</div> </div>
@ -32,7 +33,8 @@
<el-tooltip content="点击进入子文件夹" placement="bottom-start" effect="light"> <el-tooltip content="点击进入子文件夹" placement="bottom-start" effect="light">
<a :href="'#/filemange/subfile?id='+scope.row.id"> <a :href="'#/filemange/subfile?id='+scope.row.id">
<!-- <el-button type="warning" icon="el-icon-notebook-1">{{scope.row.name}}</el-button> --> <!-- <el-button type="warning" icon="el-icon-notebook-1">{{scope.row.name}}</el-button> -->
<img src="../../common/img/file.png" alt="图片"/> <!-- <img src="../../common/img/file.png" alt="图片"/> -->
<svg class="fileicon" style="width: 5.15234375em;height: 5em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1180 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4701"><path d="M1099.433546 289.842983h-1.08787v-99.462424a128.679511 128.679511 0 0 0-93.246023-126.65918v-3.263611A60.454505 60.454505 0 0 0 944.023508 0.003264H729.246837A60.454505 60.454505 0 0 0 668.326102 59.836128H122.526051A126.65918 126.65918 0 0 0 0.062941 190.380559V890.502778a12.277393 12.277393 0 0 0 2.331151 6.216401v1.243281c0 72.110257 46.623011 126.03754 113.760147 126.03754H969.821575c67.603366 0 105.212595-68.225006 122.463109-130.544431L1174.652004 419.610365c18.182974-75.063048-7.459682-129.767381-75.218458-129.767382z m-897.337556 0a160.072339 160.072339 0 0 0-132.253942 78.637479v-124.32803a73.198128 73.198128 0 0 1 46.623011-54.859743H668.326102a60.609915 60.609915 0 0 1 60.454505-59.988274h215.242901a60.609915 60.609915 0 0 1 60.454505 60.609914v3.108201a126.50377 126.50377 0 0 1 90.604052 97.908324z" fill="#FFE680" p-id="4702"></path></svg>
</a> </a>
</el-tooltip> </el-tooltip>
@ -126,6 +128,8 @@ data() {
// //
dirdata: [], dirdata: [],
loadingText: '文件夹获取中...', //
subloading: false, //loading subloading: false, //loading
mkdirloadings: false, //loading mkdirloadings: false, //loading
// //
@ -165,11 +169,13 @@ methods: {
getFileData() { getFileData() {
let thiss = this; let thiss = this;
this.dirdata = []
this.loadingText = '获取文件夹中...'
this.subloading = true; this.subloading = true;
mirlist().then(response => { mirlist().then(response => {
let datamain = response.data; let datamain = response.data;
//console.log(maindata); //console.log(maindata);
this.dirdata = []
if (datamain.code == 1) { if (datamain.code == 1) {
let maindata = datamain.data.menus; let maindata = datamain.data.menus;
//console.log(maindata.directories.length); //console.log(maindata.directories.length);
@ -183,7 +189,10 @@ methods: {
// this.movefileform.from = maindata.realpath; // // this.movefileform.from = maindata.realpath; //
//console.log(this.movefileform.from); //console.log(this.movefileform.from);
} }
this.subloading = false; this.$nextTick(function () {
//console.log(this.$el.textContent) // => ''
this.subloading = false;
})
}).catch(error => { }).catch(error => {
requesterr(this, error); requesterr(this, error);
this.subloading = false; this.subloading = false;
@ -221,6 +230,7 @@ methods: {
return; return;
} }
//console.log(this.dirform); //console.log(this.dirform);
this.loadingText = '创建文件夹中...'
this.mkdirloadings = true; this.mkdirloadings = true;
mkdir(this.dirform).then(response => { mkdir(this.dirform).then(response => {
let datamain = response.data; let datamain = response.data;
@ -249,6 +259,7 @@ methods: {
// //
rmdirm() { rmdirm() {
let thiss = this; let thiss = this;
this.loadingText = '删除文件夹中...'
this.subloading = true; this.subloading = true;
//console.log(this.rmdirform); //console.log(this.rmdirform);
rmdirs(this.rmdirform).then(response => { rmdirs(this.rmdirform).then(response => {
@ -263,7 +274,7 @@ methods: {
} else { } else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'}); thiss.$message({showClose: true,message: datamain.err,type: 'error'});
} }
this.subloading = false; //this.subloading = false;
//this.dirbox = false; //this.dirbox = false;
}).catch(error => { }).catch(error => {
requesterr(this, error); requesterr(this, error);
@ -278,12 +289,13 @@ methods: {
return; return;
} }
let thiss = this; let thiss = this;
this.loadingText = '移动文件夹中...'
this.subloading = true; this.subloading = true;
//console.log(this.rmfileform); //console.log(this.rmfileform);
movefiledir(this.movefileform).then(response => { movefiledir(this.movefileform).then(response => {
let datamain = response.data; let datamain = response.data;
if (datamain.code == 1) { if (datamain.code == 1) {
console.log(66666); //console.log(66666);
EventBus.$emit('mkdirSuccess'); // EventBus.$emit('mkdirSuccess'); //
this.getFileData(); this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'}); thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
@ -292,7 +304,7 @@ methods: {
thiss.$message({showClose: true,message: datamain.err,type: 'error'}); thiss.$message({showClose: true,message: datamain.err,type: 'error'});
} }
this.subloading = false; //this.subloading = false;
this.movebox = false; this.movebox = false;
}).catch(error => { }).catch(error => {
@ -312,7 +324,9 @@ methods: {
this.renamefileform.to += this.filesuffix; this.renamefileform.to += this.filesuffix;
} }
let thiss = this; let thiss = this;
this.subloading = true; this.loadingText = '文件夹重命名中...'
this.mkdirloadings = true;
//this.subloading = true;
//console.log(this.rmfileform); //console.log(this.rmfileform);
renamefile(this.renamefileform).then(response => { renamefile(this.renamefileform).then(response => {
let datamain = response.data; let datamain = response.data;
@ -326,7 +340,7 @@ methods: {
thiss.$message({showClose: true,message: datamain.err,type: 'error'}); thiss.$message({showClose: true,message: datamain.err,type: 'error'});
} }
this.subloading = false; //this.subloading = false;
this.renamebox = false; this.renamebox = false;
}).catch(error => { }).catch(error => {
@ -346,10 +360,23 @@ methods: {
objmark = getbutton.getAttribute('mark'); objmark = getbutton.getAttribute('mark');
//
// //
if (objmark == 'dirdelete') { if (objmark == 'dirdelete') {
this.rmdirform.dir = getbutton.getAttribute('filenames'); this.rmdirform.dir = getbutton.getAttribute('filenames');
this.rmdirm(); this.$confirm('此操作将删除该文件夹, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.rmdirm();
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
return; return;
} }

42
src/views/subfile/index.vue

@ -12,13 +12,14 @@
<!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button> <!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button>
<el-button type="primary" icon="el-icon-edit">重命名</el-button> --> <el-button type="primary" icon="el-icon-edit">重命名</el-button> -->
<el-button type="primary" @click="uploadDrawer = true">上传<i class="el-icon-upload el-icon--right"></i></el-button> <el-button type="primary" @click="uploadDrawer = true">上传<i class="el-icon-upload el-icon--right"></i></el-button>
<el-button type="primary" @click="getFileData" icon="el-icon-refresh-right">刷新</el-button>
</div> </div>
<div v-on:click.stop="fileTableMClick"> <div v-on:click.stop="fileTableMClick">
<!-- 子目录数据列表 如果不需要显示空数据提示可以用css隐藏--> <!-- 子目录数据列表 如果不需要显示空数据提示可以用css隐藏-->
<el-table <el-table
:data="dirdata" :data="dirdata"
empty-text="无文件夹数据" empty-text="无文件夹数据"
:row-style="{'background-color':'#fffdfa'}" :row-style="{'background-color':'#fffdfa'}"
style="width:100%;" class="filesmd"> style="width:100%;" class="filesmd">
<!-- <el-table-column <!-- <el-table-column
@ -40,7 +41,8 @@
<div class="type_file_click"> <div class="type_file_click">
<a title="点击进入子文件夹" :href="'#/filemange/subfile?id='+scope.row.id"> <a title="点击进入子文件夹" :href="'#/filemange/subfile?id='+scope.row.id">
<!-- <el-button type="warning" icon="el-icon-notebook-1">{{scope.row.name}}</el-button> --> <!-- <el-button type="warning" icon="el-icon-notebook-1">{{scope.row.name}}</el-button> -->
<img src="../../common/img/file.png" alt="图片"/> <!-- <img src="../../common/img/file.png" alt="图片"/> -->
<svg class="fileicon" style="width: 5.15234375em;height: 5em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1180 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4701"><path d="M1099.433546 289.842983h-1.08787v-99.462424a128.679511 128.679511 0 0 0-93.246023-126.65918v-3.263611A60.454505 60.454505 0 0 0 944.023508 0.003264H729.246837A60.454505 60.454505 0 0 0 668.326102 59.836128H122.526051A126.65918 126.65918 0 0 0 0.062941 190.380559V890.502778a12.277393 12.277393 0 0 0 2.331151 6.216401v1.243281c0 72.110257 46.623011 126.03754 113.760147 126.03754H969.821575c67.603366 0 105.212595-68.225006 122.463109-130.544431L1174.652004 419.610365c18.182974-75.063048-7.459682-129.767381-75.218458-129.767382z m-897.337556 0a160.072339 160.072339 0 0 0-132.253942 78.637479v-124.32803a73.198128 73.198128 0 0 1 46.623011-54.859743H668.326102a60.609915 60.609915 0 0 1 60.454505-59.988274h215.242901a60.609915 60.609915 0 0 1 60.454505 60.609914v3.108201a126.50377 126.50377 0 0 1 90.604052 97.908324z" fill="#FFE680" p-id="4702"></path></svg>
</a> </a>
</div> </div>
</template> </template>
@ -67,7 +69,7 @@
<!-- 文件数据列表 --> <!-- 文件数据列表 -->
<el-table <el-table
:show-header="false" :show-header="false"
empty-text="无文件数据" empty-text="无文件数据"
:data="tableData" :data="tableData"
style="width:100%;"> style="width:100%;">
@ -198,7 +200,7 @@
<div class="request_main"> <div class="request_main">
<el-button type="success" :loading="uploadLoad" @click="handleRequest()">开始上传<i class="el-icon-upload el-icon--right"></i></el-button> <el-button type="success" :loading="uploadLoad" @click="handleRequest()">开始上传<i class="el-icon-upload el-icon--right"></i></el-button>
</div> </div>
<div class="el-upload__tip">目前只能上传{{supportedFileTypes}}文件且不超过{{maxUploadFileSize/1024/1024}}MB</div> <div class="el-upload__tip">目前只能上传{{supportedFileTypes}}文件单个文件不超过{{maxUploadFileSize/1024/1024}}MB</div>
<el-dialog :modal="false" :visible.sync="dialogVisible"> <el-dialog :modal="false" :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="图片"> <img width="100%" :src="dialogImageUrl" alt="图片">
</el-dialog> </el-dialog>
@ -244,7 +246,8 @@ export default {
data() { data() {
return { return {
// //
imgurl:process.env.VUE_APP_IMG_URL, //imgurl:process.env.VUE_APP_IMG_URL,
imgurl:'https://demo.jialuoma.com',
loadingText: '文件获取中...', loadingText: '文件获取中...',
@ -456,7 +459,8 @@ export default {
let Progress = progressEvent => { let Progress = progressEvent => {
//progressEvent.loaded: //progressEvent.loaded:
//progressEvent.total: //progressEvent.total:
let num = progressEvent.loaded / progressEvent.total * 100 | 0; // //let num = progressEvent.loaded / progressEvent.total * 100 | 0; //
let num = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
//console.log(num); //console.log(num);
files.onProgress({percent: num}) // files.onProgress({percent: num}) //
} }
@ -466,20 +470,23 @@ export default {
let datamain = response.data; let datamain = response.data;
if (datamain.code == 1) { if (datamain.code == 1) {
//console.log(datamain); //console.log(datamain);
this.$message({showClose: true,message: datamain.msg, type:'success'}); //this.$message({showClose: true,message: datamain.msg, type:'success'});
files.onSuccess(); //() files.onSuccess(); //()
this.uploadCount++; // this.uploadCount++; //
//console.log(this.uploadCount); console.log(this.uploadCount);
if (this.uploadCount == this.uploadFilelist.length) { if (this.uploadCount == this.uploadFilelist.length) {
this.uploadDrawer = false; this.uploadDrawer = false;
this.uploadFilelist = []; this.uploadFilelist = [];
this.uploadCount = 0; this.uploadCount = 0;
this.getFileData(); this.getFileData();
this.loadingText = '新增上传文件中...'
this.uploadLoad = false;
} }
} }
this.uploadLoad = false;
}).catch(error => { }).catch(error => {
requesterr(this, error); requesterr(this, error);
this.uploadLoad = false; this.uploadLoad = false;
@ -502,14 +509,17 @@ export default {
can.id = menusindex.split('?id=')[1] can.id = menusindex.split('?id=')[1]
} }
let thiss = this; let thiss = this;
this.subloading = true;
this.dirdata = []
this.tableData = []
this.loadingText = '获取文件中...'
this.subloading = true
mirlist(can).then(response => { mirlist(can).then(response => {
let datamain = response.data; let datamain = response.data;
let maindata = datamain.data.dirTree; let maindata = datamain.data.dirTree;
if (datamain.code == 1) { if (datamain.code == 1) {
//console.log(maindata.directories.length); //console.log(maindata.directories.length);
this.dirdata = []
this.tableData = []
if (maindata.directories) { if (maindata.directories) {
this.dirdata = this.forObjectData(maindata.directories); this.dirdata = this.forObjectData(maindata.directories);
} }
@ -602,6 +612,7 @@ export default {
rmdirm() { rmdirm() {
let thiss = this; let thiss = this;
this.subloading = true; this.subloading = true;
this.loadingText = '删除文件夹中...'
//console.log(this.rmdirform); //console.log(this.rmdirform);
rmdirs(this.rmdirform).then(response => { rmdirs(this.rmdirform).then(response => {
let datamain = response.data; let datamain = response.data;
@ -609,7 +620,6 @@ export default {
if (datamain.code == 1) { if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); // EventBus.$emit('mkdirSuccess'); //
this.loadingText = '删除文件夹中...'
this.getFileData(); this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'}); thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false; //this.subloading = false;
@ -627,13 +637,13 @@ export default {
// //
rmfile() { rmfile() {
let thiss = this; let thiss = this;
this.loadingText = '文件删除中...'
this.subloading = true; this.subloading = true;
//console.log(this.rmfileform); //console.log(this.rmfileform);
deletefile(this.rmfileform).then(response => { deletefile(this.rmfileform).then(response => {
let datamain = response.data; let datamain = response.data;
if (datamain.code == 1) { if (datamain.code == 1) {
this.loadingText = '文件删除中...'
this.getFileData(); this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'}); thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false; //this.subloading = false;
@ -641,7 +651,7 @@ export default {
thiss.$message({showClose: true,message: datamain.err,type: 'error'}); thiss.$message({showClose: true,message: datamain.err,type: 'error'});
} }
this.subloading = false; //this.subloading = false;
//this.dirbox = false; //this.dirbox = false;
}).catch(error => { }).catch(error => {
@ -691,13 +701,13 @@ export default {
return; return;
} }
let thiss = this; let thiss = this;
this.loadingText = '文件移动中...'
this.subloading = true; this.subloading = true;
//console.log(this.rmfileform); //console.log(this.rmfileform);
movefiledir(this.movefileform).then(response => { movefiledir(this.movefileform).then(response => {
let datamain = response.data; let datamain = response.data;
if (datamain.code == 1) { if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); // EventBus.$emit('mkdirSuccess'); //
this.loadingText = '文件移动中...'
this.getFileData(); this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'}); thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false; //this.subloading = false;

Loading…
Cancel
Save