Browse Source

增加一次上传多张图片,上传进度条。 优化vuex。

master
wen 2 years ago
parent
commit
0a7f63e878
  1. 13
      src/api/user.js
  2. 15
      src/layout/components/Sidebar/index.vue
  3. 18
      src/store/modules/settings.js
  4. 2
      src/views/filemange/index.vue
  5. 87
      src/views/subfile/index.vue

13
src/api/user.js

@ -26,6 +26,13 @@ export function requesterr(thiss, err) { @@ -26,6 +26,13 @@ export function requesterr(thiss, err) {
}
}
// 系统配置接口
export function config() {
return request({
url: '/api/config',
method: 'get'
})
}
// 登入接口
export function login(datas) {
@ -55,11 +62,13 @@ export function mkdir(datas) { @@ -55,11 +62,13 @@ export function mkdir(datas) {
}
// 上传文件
export function uploadrequest(datas) {
export function uploadrequest(datas, Progress) {
return request({
url: '/api/uploadbase64',
method: 'post',
data: datas
data: datas,
onUploadProgress: Progress
})
}

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

@ -32,7 +32,7 @@ import EventBus from '@/utils/EventBus.js' @@ -32,7 +32,7 @@ import EventBus from '@/utils/EventBus.js'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import menusdata from './leftMenusData.js'
import { mirlist } from '@/api/user'
import {requesterr, mirlist } from '@/api/user'
//console.log(menusdata);
export default {
@ -150,18 +150,7 @@ export default { @@ -150,18 +150,7 @@ export default {
}).catch(function (error) {
if (error.response) {
if (error.response.status == 401) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
thiss.$router.push({path: '/login'});
return;
}
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'});
}
requesterr(this, error);
});
},

18
src/store/modules/settings.js

@ -9,18 +9,18 @@ const state = { @@ -9,18 +9,18 @@ const state = {
}
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
// eslint-disable-next-line no-prototype-builtins
if (state.hasOwnProperty(key)) {
state[key] = value
}
}
// CHANGE_SETTING: (state, { key, value }) => {
// // eslint-disable-next-line no-prototype-builtins
// if (state.hasOwnProperty(key)) {
// state[key] = value
// }
// }
}
const actions = {
changeSetting({ commit }, data) {
commit('CHANGE_SETTING', data)
}
// changeSetting({ commit }, data) {
// commit('CHANGE_SETTING', data)
// }
}
export default {

2
src/views/filemange/index.vue

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<template>
<div class="filemange_container" v-loading="subloading" element-loading-text="数据加载中...">
<div class="filemange_container" v-loading="subloading" element-loading-text="文件夹获取中...">
<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="rmdirm">删除目录</el-button>

87
src/views/subfile/index.vue

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save