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. 156
      src/views/subfile/index.vue

9
src/api/user.js

@ -33,3 +33,12 @@ export function mkdir(datas) { @@ -33,3 +33,12 @@ export function mkdir(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 { @@ -110,7 +110,7 @@ export default {
getmunusdata() {
let thiss = this;
console.log(1);
//console.log(1);
// console.log(this.$store);
mirlist().then(response => {

156
src/views/subfile/index.vue

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<template>
<div class="subfile_main" v-loading="subloading">
<div class="block">
<!-- <div class="block">
<el-date-picker
v-model="value2"
type="daterange"
@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
:picker-options="pickerOptions">
</el-date-picker>
<el-button class="sou_bottom" type="primary" icon="el-icon-search">搜索</el-button>
</div>
</div> -->
<div>
<!-- 目录数据列表 -->
<div class="folder_bottom">
@ -24,7 +24,7 @@ @@ -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="rmdirm">删除目录</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>
<!-- 文件数据列表 -->
@ -81,13 +81,41 @@ @@ -81,13 +81,41 @@
</div>
</el-dialog>
</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>
</template>
<script>
import EventBus from '@/utils/EventBus.js'
import { mirlist, mkdir } from '@/api/user'
import { mirlist, mkdir, uploadrequest} from '@/api/user'
import defaultSettings from '@/settings.js'
export default {
@ -114,34 +142,35 @@ export default { @@ -114,34 +142,35 @@ export default {
},
data() {
return {
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
},
value2: '',
//
// pickerOptions: {
// shortcuts: [{
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
// picker.$emit('pick', [start, end]);
// }
// }]
// },
// value2: '',
tableData: [],
@ -157,10 +186,61 @@ export default { @@ -157,10 +186,61 @@ export default {
dirdata: [],
subloading: false, //loading
mkdirloadings: false
mkdirloadings: false,
//
drawer: false,
direction: 'ttb',
//
dialogImageUrl: '',
dialogVisible: false,
disabled: false
};
},
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() {
let can = {};
const menusindex = window.location.href
@ -191,7 +271,6 @@ export default { @@ -191,7 +271,6 @@ export default {
this.subloading = false;
}
}).catch(function (error) {
thiss.$message({
showClose: true,
@ -270,13 +349,18 @@ export default { @@ -270,13 +349,18 @@ export default {
<style lang="scss">
.subfile_main{
padding:26px 5% 12px 5%;
padding:26px 5% 47px 5%;
.block{margin:0 0 28px 0;}
.sou_bottom{margin-left:10px;}
.use_button{margin:15px 0 16px 0;}
// .use_button>button{margin:0 10px 10px 0;}
.file_caozuo2{margin:6px 0 0 0;}
.el-table td{padding:9px 0}
.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>

Loading…
Cancel
Save