结构调整

This commit is contained in:
zhh 2018-05-16 17:30:47 +08:00
parent 5f6f46cee2
commit d44443309f
14 changed files with 45 additions and 273 deletions

View File

@ -1,9 +0,0 @@
import request from '@/utils/request'
export function getList(params) {
return request({
url: '/table/list',
method: 'get',
params
})
}

View File

@ -28,8 +28,8 @@ export default {
getBreadcrumb() {
let matched = this.$route.matched.filter(item => item.name)
const first = matched[0]
if (first && first.name !== 'dashboard') {
matched = [{ path: '/dashboard', meta: { title: '首页' }}].concat(matched)
if (first && first.name !== 'home') {
matched = [{ path: '/home', meta: { title: '首页' }}].concat(matched)
}
this.levelList = matched
}

View File

@ -24,11 +24,11 @@ export const constantRouterMap = [
{
path: '',
component: Layout,
redirect: '/dashboard',
redirect: '/home',
children: [{
path: 'dashboard',
name: 'dashboard',
component: () => import('@/views/dashboard/index'),
path: 'home',
name: 'home',
component: () => import('@/views/home/index'),
meta: {title: '首页', icon: 'home'}
}]
},

View File

@ -60,7 +60,7 @@ a:hover {
/*外框样式*/
.container-frame{
padding: 8px;
padding: 10px;
border: 1px solid rgb(235, 235, 235);
border-image: initial;
border-radius: 3px;

View File

@ -32,7 +32,7 @@ service.interceptors.response.use(
Message({
message: res.message,
type: 'error',
duration: 5 * 1000
duration: 3 * 1000
})
// 401:未登录;
@ -57,7 +57,7 @@ service.interceptors.response.use(
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
duration: 3 * 1000
})
return Promise.reject(error)
}

View File

@ -1,85 +0,0 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai"></el-option>
<el-option label="Zone two" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker type="date" placeholder="Pick a date" v-model="form.date1" style="width: 100%;"></el-date-picker>
</el-col>
<el-col class="line" :span="2">-</el-col>
<el-col :span="11">
<el-time-picker type="fixed-time" placeholder="Pick a time" v-model="form.date2" style="width: 100%;"></el-time-picker>
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch v-model="form.delivery"></el-switch>
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox label="Online activities" name="type"></el-checkbox>
<el-checkbox label="Promotion activities" name="type"></el-checkbox>
<el-checkbox label="Offline activities" name="type"></el-checkbox>
<el-checkbox label="Simple brand exposure" name="type"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio label="Sponsor"></el-radio>
<el-radio label="Venue"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">Create</el-button>
<el-button @click="onCancel">Cancel</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
}
}
},
methods: {
onSubmit() {
this.$message('submit!')
},
onCancel() {
this.$message({
message: 'cancel!',
type: 'warning'
})
}
}
}
</script>
<style scoped>
.line{
text-align: center;
}
</style>

View File

@ -9,7 +9,7 @@
import { mapGetters } from 'vuex'
export default {
name: 'dashboard',
name: 'home',
computed: {
...mapGetters([
'name',

View File

@ -10,11 +10,11 @@
<el-dropdown-menu class="user-dropdown" slot="dropdown">
<router-link class="inlineBlock" to="/">
<el-dropdown-item>
Home
首页
</el-dropdown-item>
</router-link>
<el-dropdown-item divided>
<span @click="logout" style="display:block;">LogOut</span>
<span @click="logout" style="display:block;">退出</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

View File

@ -2,10 +2,10 @@
<brand-detail :is-edit='false'></brand-detail>
</template>
<script>
import brandDetail from './components/brandDetail'
import BrandDetail from './components/BrandDetail'
export default {
name: 'addBrand',
components: { brandDetail }
components: { BrandDetail }
}
</script>
<style>

View File

@ -46,7 +46,7 @@
import {createBrand, getBrand, updateBrand} from '@/api/brand'
export default {
name: 'brandDetail',
name: 'BrandDetail',
props: {
isEdit: {
type: Boolean,
@ -100,7 +100,8 @@
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success'
type: 'success',
duration:1000
});
});
} else {
@ -108,7 +109,8 @@
this.$refs[formName].resetFields();
this.$message({
message: '提交成功',
type: 'success'
type: 'success',
duration:1000
});
});
}
@ -117,7 +119,8 @@
} else {
this.$message({
message: '验证失败',
type: 'error'
type: 'error',
duration:1000
});
return false;
}

View File

@ -2,8 +2,8 @@
<div class="app-container">
<div class="filter-container container-frame">
<div>
<i class="el-icon-search"></i>
筛选搜索
<i class="el-icon-search" style="margin-top: 10px"></i>
<span style="margin-top: 10px">筛选搜索</span>
<el-button
style="float: right"
@click="searchBrandList()"
@ -23,8 +23,9 @@
</div>
</div>
<div class="operate-container container-frame">
<i class="el-icon-tickets"></i>
操作栏
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
@click="addBrand()"
size="mini">
@ -77,13 +78,13 @@
<el-button
size="mini"
type="text"
@click="handleProductList(scope.$index, scope.row)">100
@click="getProductList(scope.$index, scope.row)">100
</el-button>
<span>评价</span>
<el-button
size="mini"
type="text"
@click="handleProductCommentList(scope.$index, scope.row)">1000
@click="getProductCommentList(scope.$index, scope.row)">1000
</el-button>
</template>
</el-table-column>
@ -91,7 +92,7 @@
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">编辑
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
@ -181,7 +182,7 @@
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleEdit(index, row) {
handleUpdate(index, row) {
this.$router.push({path: '/pms/updateBrand',query:{id:row.id}})
},
handleDelete(index, row) {
@ -193,26 +194,28 @@
deleteBrand(row.id).then(response=>{
this.$message({
message: '删除成功',
type: 'success'
type: 'success',
duration:1000
});
this.getList();
});
});
},
handleProductList(index, row) {
getProductList(index, row) {
console.log(index, row);
},
handleProductCommentList(index, row) {
getProductCommentList(index, row) {
console.log(index, row);
},
handleFactoryStatusChange(index, row) {
var data = new FormData();
var data = new URLSearchParams();
data.append("ids",row.id);
data.append("factoryStatus",row.factoryStatus);
updateFactoryStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success'
type: 'success',
duration:1000
});
}).catch(error => {
if (row.factoryStatus === 0) {
@ -229,7 +232,8 @@
updateShowStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success'
type: 'success',
duration:1000
});
}).catch(error => {
if (row.showStatus === 0) {
@ -267,7 +271,8 @@
}else{
this.$message({
message: '请选择批量操作类型',
type: 'warning'
type: 'warning',
duration:1000
});
return;
}
@ -282,7 +287,8 @@
this.getList();
this.$message({
message: '修改成功',
type: 'success'
type: 'success',
duration:1000
});
});
},

View File

@ -2,10 +2,10 @@
<brand-detail :is-edit='true'></brand-detail>
</template>
<script>
import brandDetail from './components/brandDetail'
import BrandDetail from './components/BrandDetail'
export default {
name: 'updateBrand',
components: { brandDetail }
components: { BrandDetail }
}
</script>
<style>

View File

@ -1,72 +0,0 @@
<template>
<div class="app-container">
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
<el-table-column align="center" label='ID' width="95">
<template slot-scope="scope">
{{scope.$index}}
</template>
</el-table-column>
<el-table-column label="Title">
<template slot-scope="scope">
{{scope.row.title}}
</template>
</el-table-column>
<el-table-column label="Author" width="110" align="center">
<template slot-scope="scope">
<span>{{scope.row.author}}</span>
</template>
</el-table-column>
<el-table-column label="Pageviews" width="110" align="center">
<template slot-scope="scope">
{{scope.row.pageviews}}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="Status" width="110" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span>{{scope.row.display_time}}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getList } from '@/api/table'
export default {
data() {
return {
list: null,
listLoading: true
}
},
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'gray',
deleted: 'danger'
}
return statusMap[status]
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.listLoading = true
getList(this.listQuery).then(response => {
this.list = response.data.items
this.listLoading = false
})
}
}
}
</script>

View File

@ -1,71 +0,0 @@
<template>
<div class="app-container">
<el-input placeholder="Filter keyword" v-model="filterText" style="margin-bottom:30px;"></el-input>
<el-tree class="filter-tree" :data="data2" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree2"></el-tree>
</div>
</template>
<script>
export default {
watch: {
filterText(val) {
this.$refs.tree2.filter(val)
}
},
methods: {
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
}
},
data() {
return {
filterText: '',
data2: [{
id: 1,
label: 'Level one 1',
children: [{
id: 4,
label: 'Level two 1-1',
children: [{
id: 9,
label: 'Level three 1-1-1'
}, {
id: 10,
label: 'Level three 1-1-2'
}]
}]
}, {
id: 2,
label: 'Level one 2',
children: [{
id: 5,
label: 'Level two 2-1'
}, {
id: 6,
label: 'Level two 2-2'
}]
}, {
id: 3,
label: 'Level one 3',
children: [{
id: 7,
label: 'Level two 3-1'
}, {
id: 8,
label: 'Level two 3-2'
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
}
}
}
</script>