Browse Source

修改

master
wen 2 years ago
parent
commit
6259692bd6
  1. 9
      src/api/user.js
  2. 2
      src/layout/components/Sidebar/index.vue
  3. 158
      src/views/subfile/index.vue

9
src/api/user.js

@ -32,4 +32,13 @@ export function mkdir(datas) {
method: 'post', method: 'post',
data: datas data: datas
}) })
}
// 上传文件
export function uploadrequest(datas) {
return request({
url: '/api/uploadbase64',
method: 'post',
data: datas
})
} }

2
src/layout/components/Sidebar/index.vue

@ -110,7 +110,7 @@ export default {
getmunusdata() { getmunusdata() {
let thiss = this; let thiss = this;
console.log(1); //console.log(1);
// console.log(this.$store); // console.log(this.$store);
mirlist().then(response => { mirlist().then(response => {

158
src/views/subfile/index.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="subfile_main" v-loading="subloading"> <div class="subfile_main" v-loading="subloading">
<div class="block"> <!-- <div class="block">
<el-date-picker <el-date-picker
v-model="value2" v-model="value2"
type="daterange" type="daterange"
@ -12,7 +12,7 @@
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
<el-button class="sou_bottom" type="primary" icon="el-icon-search">搜索</el-button> <el-button class="sou_bottom" type="primary" icon="el-icon-search">搜索</el-button>
</div> </div> -->
<div> <div>
<!-- 目录数据列表 --> <!-- 目录数据列表 -->
<div class="folder_bottom"> <div class="folder_bottom">
@ -24,7 +24,7 @@
<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" 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">上传<i class="el-icon-upload el-icon--right"></i></el-button> <el-button type="primary" @click="drawer = true">上传<i class="el-icon-upload el-icon--right"></i></el-button>
</div> </div>
<!-- 文件数据列表 --> <!-- 文件数据列表 -->
@ -81,13 +81,41 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
<el-drawer
title="上传图片"
:visible.sync="drawer"
:direction="direction"
size="100%"
>
<el-upload
action=""
:limit="1"
list-type="picture-card"
:on-remove="handleRemove"
:on-exceed="fileexceed"
:multiple="false"
:on-change="filechange"
:on-preview="handlePictureCardPreview"
accept=".jpg, .jpeg, .png, .gif"
:auto-upload="false">
<i slot="default" class="el-icon-plus"></i>
<span class="addimgtext">添加照片</span>
</el-upload>
<div class="request_main">
<el-button type="success" @click="UploadRequest(file)">开始上传<i class="el-icon-upload el-icon--right"></i></el-button>
</div>
<div class="el-upload__tip">只能上传.jpg, .jpeg, .png, .gif文件且不超过500kb</div>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="图片">
</el-dialog>
</el-drawer>
</div> </div>
</template> </template>
<script> <script>
import EventBus from '@/utils/EventBus.js' import EventBus from '@/utils/EventBus.js'
import { mirlist, mkdir } from '@/api/user' import { mirlist, mkdir, uploadrequest} from '@/api/user'
import defaultSettings from '@/settings.js' import defaultSettings from '@/settings.js'
export default { export default {
@ -114,34 +142,35 @@ export default {
}, },
data() { data() {
return { return {
pickerOptions: { //
shortcuts: [{ // pickerOptions: {
text: '最近一周', // shortcuts: [{
onClick(picker) { // text: '',
const end = new Date(); // onClick(picker) {
const start = new Date(); // const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); // const start = new Date();
picker.$emit('pick', [start, end]); // start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
} // picker.$emit('pick', [start, end]);
}, { // }
text: '最近一个月', // }, {
onClick(picker) { // text: '',
const end = new Date(); // onClick(picker) {
const start = new Date(); // const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); // const start = new Date();
picker.$emit('pick', [start, end]); // start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
} // picker.$emit('pick', [start, end]);
}, { // }
text: '最近三个月', // }, {
onClick(picker) { // text: '',
const end = new Date(); // onClick(picker) {
const start = new Date(); // const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); // const start = new Date();
picker.$emit('pick', [start, end]); // start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
} // picker.$emit('pick', [start, end]);
}] // }
}, // }]
value2: '', // },
// value2: '',
tableData: [], tableData: [],
@ -157,10 +186,61 @@ export default {
dirdata: [], dirdata: [],
subloading: false, //loading subloading: false, //loading
mkdirloadings: false mkdirloadings: false,
//
drawer: false,
direction: 'ttb',
//
dialogImageUrl: '',
dialogVisible: false,
disabled: false
}; };
}, },
methods: { methods: {
//
handleRemove(file, fileList) {
//this.$refs.upload.clearFiles;
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
this.$message({
showClose: true,
message: '右键点击或者长按图片自行下载'
});
},
//
fileexceed(files, fileList) {
this.$message({showClose:true, message:'一次只能上传一个文件', type:'warning'});
},
filechange(files, fileList) {
console.log(files);
console.log(fileList);
},
UploadRequest(file) {
let thiss = this;
console.log(file);
uploadrequest().then(response => {
let datamain = response.data;
}).catch(function (error) {
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
getFileData() { getFileData() {
let can = {}; let can = {};
const menusindex = window.location.href const menusindex = window.location.href
@ -191,7 +271,6 @@ export default {
this.subloading = false; this.subloading = false;
} }
}).catch(function (error) { }).catch(function (error) {
thiss.$message({ thiss.$message({
showClose: true, showClose: true,
@ -270,13 +349,18 @@ export default {
<style lang="scss"> <style lang="scss">
.subfile_main{ .subfile_main{
padding:26px 5% 12px 5%; padding:26px 5% 47px 5%;
.block{margin:0 0 28px 0;} .block{margin:0 0 28px 0;}
.sou_bottom{margin-left:10px;} .sou_bottom{margin-left:10px;}
.use_button{margin:15px 0 16px 0;} .use_button{margin:15px 0 16px 0;}
// .use_button>button{margin:0 10px 10px 0;}
.file_caozuo2{margin:6px 0 0 0;} .file_caozuo2{margin:6px 0 0 0;}
.el-table td{padding:9px 0} .el-table td{padding:9px 0}
.folder_bottom a{margin:0 6px;} .folder_bottom a{margin:0 6px;}
.el-table__body-wrapper img{width:100px;} .el-table__body-wrapper img{width:100px;height:71px;}
} .el-drawer__body{text-align:center;padding:0 10% 20px 10%;}
.request_main{text-align:center;margin:12px 0;}
.addimgtext{line-height:25px;display:inline-block;color:#8c939d;vertical-align: middle;}
.el-upload--picture-card i{vertical-align:middle;}
}
</style> </style>

Loading…
Cancel
Save