修改路由并添加路由

This commit is contained in:
熊丽君
2021-10-27 13:35:05 +08:00
parent 25738e5413
commit 5c9f7730cd
6 changed files with 273 additions and 4 deletions

View File

@ -12,8 +12,9 @@ import accountManagement from './modules/accountManagement';
import customerService from './modules/customerService';
import feedback from './modules/feedback';
import settings from './modules/settings';
import rotation from './modules/rotation';
import aboutUs from './modules/aboutUs';
// import rotation from './modules/rotation';
// import aboutUs from './modules/aboutUs';
import asdmSetting from './modules/asdmSetting';
export const DynamicRoutes = [
// 政策管理
@ -31,9 +32,11 @@ export const DynamicRoutes = [
// 意见反馈
feedback,
// 轮播管理
rotation,
// rotation,
// 关于我们
aboutUs,
// aboutUs,
// 管理端设置
asdmSetting,
// 系统设置
settings
];

View File

@ -0,0 +1,50 @@
import Layout from '@/layout';
// 管理端设置
const nestedRouter = {
path: '/asdm',
component: Layout,
redirect: 'noRedirect',
name:'asdm',
meta: { title: '管理端设置', icon: 'row'},
children: [
{
path: 'rotation',
component: resolve =>
require(['@/views/asdm/rotation/index'], resolve),
name: 'rotation',
meta: { title: '轮播管理', icon: 'list' }
},
{
path: 'about',
component: resolve =>
require(['@/views/asdm/about/index'], resolve),
name: 'about',
meta: { title: '关于我们', icon: 'list' }
},
{
path: 'partner',
component: resolve =>
require(['@/views/asdm/partner/index'], resolve),
name: 'partner',
meta: { title: '合作伙伴', icon: 'list' }
},
{
path: 'footer',
component: resolve =>
require(['@/views/asdm/footer/index'], resolve),
name: 'footer',
meta: { title: '底部信息', icon: 'list' }
},
// {
// path: 'addAchievement',
// component: resolve =>
// require(['@/views/asdm/achievement/add'], resolve),
// name: 'addAchievement',
// meta: { title: '科技成果' },
// hidden: true
// }
]
};
export default nestedRouter;

View File

@ -0,0 +1,5 @@
<template>
<div>
footer
</div>
</template>

View File

@ -0,0 +1,211 @@
<template>
<div class="app-container">
<el-card shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button style="float: right" @click="open" size="mini" type="primary">
添加
</el-button>
</el-card>
<el-table style="width: 100%" class="table-container" :data="rotationList">
<el-table-column
label="序号"
align="center"
type="index"
></el-table-column>
<el-table-column label="合作伙伴Logo" prop="pic" align="center">
<template slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.pic"
fit="cover">
</el-image>
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button @click="handleUpdate(scope.row)" type="text" size="small"
>编辑</el-button
>
<el-button @click="handleDelete(scope.row.id)" type="text" size="small"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog
title="合作伙伴Logo"
:visible.sync="dialogVisible"
width="30%">
<el-form
:model="ruleForm"
ref="ruleForm"
:rules="rules"
label-width="80px"
>
<el-form-item label="Logo" prop="pic">
<multi-upload v-model="selectProductPics" :maxCount="this.ruleForm.id?1:2"></multi-upload>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('ruleForm')"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getRotationList,addRotation, deleteRotation, updateRotation } from '@/api/rotation';
import MultiUpload from '@/components/Upload/multiUpload';
export default {
components: {
MultiUpload
},
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10
},
total: 0,
rotationList: [],
dialogVisible: false,
ruleForm: {
url: '',
pic: ''
},
rules: {
url: [{ required: true, message: '请输入', trigger: 'blur' }],
pic: [{ required: true, message: '请上传', trigger: 'blur' }]
}
};
},
computed: {
//主图和画册图片
selectProductPics: {
get: function() {
let pics = [];
if (
this.ruleForm.pic === undefined ||
this.ruleForm.pic == null ||
this.ruleForm.pic === ''
) {
return pics;
}
pics.push(this.ruleForm.pic);
if (
this.ruleForm.albumPics === undefined ||
this.ruleForm.albumPics == null ||
this.ruleForm.albumPics === ''
) {
return pics;
}
let albumPics = this.ruleForm.albumPics.split(',');
for (let i = 0; i < albumPics.length; i++) {
pics.push(albumPics[i]);
}
return pics;
},
set: function(newValue) {
if (newValue == null || newValue.length === 0) {
this.ruleForm.pic = null;
this.ruleForm.albumPics = null;
} else {
this.ruleForm.pic = newValue[0];
// this.ruleForm.picList = newValue;
this.ruleForm.albumPics = '';
if (newValue.length > 1) {
for (let i = 1; i < newValue.length; i++) {
this.ruleForm.albumPics += newValue[i];
if (i !== newValue.length - 1) {
this.ruleForm.albumPics += ',';
}
}
}
}
}
}
},
methods: {
getList() {
getRotationList(this.queryParams).then(({ data }) => {
this.rotationList = data.list;
this.total = data.total
});
},
open(){
this.ruleForm={
pic: ''
},
this.dialogVisible = true
},
handleUpdate(row){
this.ruleForm = Object.assign({}, row)
this.dialogVisible = true
},
submitForm(formName){
this.$refs[formName].validate(valid=>{
if(valid){
if(this.ruleForm.id){
updateRotation(this.ruleForm).then(res=>{
this.msgSuccess(res.data)
this.ruleForm = {
url: '',
pic: ''
}
this.getList()
this.dialogVisible = false
})
}else{
addRotation(this.ruleForm).then(res=>{
this.msgSuccess(res.data)
this.ruleForm = {
url: '',
pic: ''
}
this.getList()
this.dialogVisible = false
})
}
}
})
// this.dialogVisible = false
},
/** 删除按钮操作 */
handleDelete(id) {
this.$confirm('确认删除该轮播图?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return deleteRotation({id});
})
.then(() => {
this.getList();
this.msgSuccess('删除成功');
});
}
},
created() {
this.getList();
}
};
</script>
<style lang="scss" scoped>
// .el-tag + .el-tag {
// margin-left: 10px;
// }
</style>