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

13
src/api/user.js

@ -26,6 +26,13 @@ export function requesterr(thiss, err) {
} }
} }
// 系统配置接口
export function config() {
return request({
url: '/api/config',
method: 'get'
})
}
// 登入接口 // 登入接口
export function login(datas) { export function login(datas) {
@ -55,11 +62,13 @@ export function mkdir(datas) {
} }
// 上传文件 // 上传文件
export function uploadrequest(datas) { export function uploadrequest(datas, Progress) {
return request({ return request({
url: '/api/uploadbase64', url: '/api/uploadbase64',
method: 'post', 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'
import SidebarItem from './SidebarItem' import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss' import variables from '@/styles/variables.scss'
import menusdata from './leftMenusData.js' import menusdata from './leftMenusData.js'
import { mirlist } from '@/api/user' import {requesterr, mirlist } from '@/api/user'
//console.log(menusdata); //console.log(menusdata);
export default { export default {
@ -150,18 +150,7 @@ export default {
}).catch(function (error) { }).catch(function (error) {
if (error.response) { requesterr(this, error);
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'});
}
}); });
}, },

18
src/store/modules/settings.js

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

2
src/views/filemange/index.vue

@ -1,5 +1,5 @@
<template> <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"> <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" icon="el-icon-edit" @click="rmdirm">删除目录</el-button> <!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button>

113
src/views/subfile/index.vue

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