Skip to content

Commit

Permalink
完善系统图片展示
Browse files Browse the repository at this point in the history
  • Loading branch information
fengsam6 committed May 9, 2019
1 parent e5c3476 commit 002ddbc
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 105 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### 介绍
毕业论文项目,使用Spring Boot社团管理系统,系统功能如下图所示。![](系统说明/系统功能.png)

#### 软件架构
软件架构说明

Expand Down Expand Up @@ -52,11 +52,6 @@



#### 使用说明

1. 安装git、idea等开发工具
2. mysql、tomcat等运行环境
3. 克隆项目,导入idea部署、运行



1 change: 1 addition & 0 deletions club-admin/src/components/activity/ActivityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</el-select>
</el-form-item>
<el-form-item><el-button type="primary" @click="find" icon="el-icon-search">查询</el-button></el-form-item>
<el-button type="success" icon="el-icon-plus" @click="addPage()" >添加</el-button>
</el-form>
<el-table :data="activityData" stripe style="width:100%" border>
<el-table-column prop="id" label="id" width="80"></el-table-column>
Expand Down
55 changes: 42 additions & 13 deletions club-admin/src/components/activity/AddActivity.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<template>
<el-form class="" :model="activity" label-width="100px">
<el-form-item label="活动名称"><el-input v-model="activity.activityName"></el-input></el-form-item>
<el-form-item label="活动举行时间"><el-date-picker format="yyyy 年 MM 月 dd 日" value-format="yyyy 年 MM 月 dd 日" type="date" placeholder="选择日期" v-model="activity.holdTime"></el-date-picker></el-form-item>
<el-form-item label="活动举行时间">
<el-date-picker format="yyyy 年 MM 月 dd 日" value-format="yyyy 年 MM 月 dd 日" type="date" placeholder="选择日期" v-model="activity.holdTime"></el-date-picker>
</el-form-item>
<el-form-item label="活动地点"><el-input v-model="activity.site"></el-input></el-form-item>
<quill-editor v-model="activity.introduce" :options="editorOption"></quill-editor>
<el-form-item>
<el-upload ref="upload" class="upload-demo" action="/api/files/upload" :on-change="handleChange" :file-list="fileList" :on-remove="beforeRemove" :auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">选择要上传的文件,且不超过2M</div>
<el-upload ref="upload" class="upload-demo" :action="'/api/files/uploadImg?relativePath='+relativePath" :on-change="handleChange" :file-list="fileList" :on-remove="beforeRemove" :auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取图片</el-button>
<div slot="tip" class="el-upload__tip">选择要上传的图片,且不超过1M</div>
</el-upload>
</el-form-item>
<el-form-item label="活动类型" prop="activityTypeId">
Expand Down Expand Up @@ -37,12 +39,13 @@ export default {
},
imageUrl: '',
fileList: [],
file: { id: 0 }
file: {activityId:0},
relativePath:"/images/activity/"
};
},
methods: {
add:function () {
this.$refs.upload.submit();
add: function() {
this.addActivitie();
},
addActivitie: function() {
console.log(this.activity);
Expand All @@ -55,7 +58,9 @@ export default {
message: '添加文章成功',
type: 'success'
});
this.$router.push({name:"ActivityList"})
console.log(res.data.data);
this.file.activityId = res.data.data;
this.$refs.upload.submit();
} else {
this.$message({
message: res.data.message,
Expand All @@ -77,11 +82,13 @@ export default {
var response = file.response;
if (response != null && response.code == OK) {
console.log(response.data);
this.file = response.data;
this.activity.fileId = this.file.id;
this.file.id = 0;
this.file.filePath = response.data;
this.file.fileName =this.getFileName(this.file.filePath);
console.log(this.file.fileName);
console.log(this.activity.fileId);
this.addActivitie();
this.$message.success('上传文件成功');
this.saveFile();
}
this.fileList = fileList.slice(-3);
},
Expand All @@ -94,12 +101,34 @@ export default {
handlePreview: function(file) {
console.log(file);
},
saveFile: function() {
this.$axios.post('/api/files/activity', this.file).then(res => {
if (res.data.code == OK) {
this.$message.success('添加活动成功');
this.$router.push({ name: 'ActivityList' });
} else {
this.$message({
message: res.data.message,
type: 'error'
});
}
});
},
handleExceed: function(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove: function(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
}
},
getFileName: function(filePath) {
var fileName = null;
if(filePath!=null){
if(filePath.indexOf("/") != -1){
fileName = filePath.substring(filePath.lastIndexOf("/")+1);
}
}
return fileName;
},
},
created() {
this.getActivityTypeList();
Expand Down
1 change: 1 addition & 0 deletions club-admin/src/components/club/ClubList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</el-select>
</el-form-item>
<el-form-item><el-button type="primary" @click="find" icon="el-icon-search">查询</el-button></el-form-item>
<el-button type="success" icon="el-icon-plus" @click="addPage()">添加</el-button>
</el-form>
<el-table :data="clubData" stripe style="width:100%" border>
<el-table-column prop="num" label="num" width="180"></el-table-column>
Expand Down
6 changes: 4 additions & 2 deletions club-admin/src/components/common/LeftNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
</el-submenu>
<el-submenu index="5">
<template slot="title">
文件管理
资源管理
</template>
<el-menu-item index="5-1"><router-link :to="{ name: 'FileList' }">文件列表</router-link></el-menu-item>
<el-menu-item index="5-1"><router-link :to="{ name: 'FileList',query:{fileTypeId:3} }">文件下载</router-link></el-menu-item>
<el-menu-item index="5-1"><router-link :to="{ name: 'CarouselList',query:{fileTypeId:4} }">首页轮播图</router-link></el-menu-item>
<el-menu-item index="5-1"><router-link :to="{ name: 'HotActivities',query:{fileTypeId:6} }">热门活动</router-link></el-menu-item>
</el-submenu>
<el-submenu index="5">
<template slot="title">
Expand Down
2 changes: 2 additions & 0 deletions club-admin/src/components/file/AddFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {
this.$axios.get('/api/fileTypes').then(res => {
if (res.data.code == OK) {
this.newsTypeList = res.data.data;
} else {
this.$message.error(res.data.data);
}
Expand All @@ -56,6 +57,7 @@ export default {
if (response != null && response.code == OK) {
console.log(response.data);
this.$message.success("上传文件成功");
this.$router.push({name:"FileList"})
}
this.fileList = fileList.slice(-3);
},
Expand Down
113 changes: 113 additions & 0 deletions club-admin/src/components/file/CarouselList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<template>
<div v-if="filePage != null">
<!-- <el-form :inline="true">
<el-form-item label="文件名称">
<el-input placeholder="请输入文件名称" prefix-icon="el-icon-search" v-model="fileName" class="input-with-select" width="120px"></el-input>
</el-form-item>
<el-form-item><el-button type="primary" @click="find" icon="el-icon-search">查询</el-button></el-form-item>
</el-form> -->
<el-button type="success" icon="el-icon-plus" @click="addPage()" size="mini">添加</el-button>
<el-table :data="fileData" stripe style="width:100%" border>
<el-table-column prop="id" label="num" width="100"></el-table-column>
<el-table-column prop="fileName" label="图片名称" width="340"></el-table-column>
<el-table-column prop="filePath" label="图片路径" width="340"></el-table-column>
<el-table-column prop="passageId" label="图片关联文章id" width="340"></el-table-column>
<el-table-column fixed="right" label="操作" width="300">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" @click="editPage(scope.row)" size="mini">编辑</el-button>
<el-button type="success" icon="el-icon-plus" @click="addPage()" size="mini">添加</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteFile(scope.row)" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :current-page.sync="currentPage" :total="filePage.total" @current-change="refreshFilePage" :page-size="filePage.pageSize"></el-pagination>
</div>
</template>

<script>
const OK = 200;
export default {
data() {
return {
filePage: {},
fileData:[],
fileName:null,
fileTypeList:[],
currentPage:1
};
},
methods: {
getFilePage: function(typeId, pageNum, pageSize) {
this.$axios
.get('/api/files', {
params: {
fileTypeId: typeId,
pageNum: pageNum,
pageSize: pageSize
}
})
.then(res => {
if (res.data.code == OK) {
this.filePage = res.data.data;
this.fileData = this.filePage.list;
this.pages = this.filePage.pages;
} else {
this.$message.error(res.data.data);
}
});
},
getFileTypeList: function() {
this.$axios.get('/api/fileTypes').then(res => {
if (res.data.code == OK) {
this.fileTypeList = res.data.data;
} else {
this.$message.error(res.data.data);
}
});
},
editPage: function(row) {
var passageId = row.passageId;
console.log(passageId);
this.$router.push({ name: 'EditPassage', query: {id: passageId} });
},
addPage: function() {
this.$router.push({ name: 'AddPassage' });
},
deleteDao: function(fileId) {
this.$axios.delete('/api/files/' + fileId).then(res => {
if (res.data.code == OK) {
this.$message.success('删除成功');
} else {
this.$message.error(res.data.data);
}
});
},
deleteFile: function(row) {
var fileId = row.id;
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.deleteDao(fileId);
this.getFilePage(4,this.currentPage, 8);
});
},
find: function() {
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(fileTypeId,this.currentPage, 8);
},
refreshFilePage: function() {
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(fileTypeId,this.currentPage, 8);
},
},
created() {
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(4,this.currentPage, 8);
this.getFileTypeList();
}
};
</script>

<style scoped="scoped"></style>
12 changes: 8 additions & 4 deletions club-admin/src/components/file/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</el-select>
</el-form-item> -->
<el-form-item><el-button type="primary" @click="find" icon="el-icon-search">查询</el-button></el-form-item>
<el-button type="success" icon="el-icon-plus" @click="addPage()">添加</el-button>
</el-form>
<el-table :data="fileData" stripe style="width:100%" border>
<el-table-column prop="id" label="num" width="100"></el-table-column>
Expand Down Expand Up @@ -99,15 +100,18 @@ export default {
});
},
find: function() {
this.getFilePage(this.currentPage, 8);
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(fileTypeId,this.currentPage, 8);
},
refreshFilePage: function() {
this.getFilePage(this.currentPage, 8);
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(fileTypeId,this.currentPage, 8);
},
},
created() {
var typeId = this.$route.params.typeId;
this.getFilePage(typeId,this.currentPage, 8);
var fileTypeId = this.$route.query.fileTypeId;
this.getFilePage(fileTypeId,this.currentPage, 8);
this.getFileTypeList();
}
};
Expand Down
Loading

0 comments on commit 002ddbc

Please sign in to comment.