Skip to content

Commit f466278

Browse files
committed
config.js
1 parent e53b04e commit f466278

File tree

8 files changed

+114
-113
lines changed

8 files changed

+114
-113
lines changed

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
<script>
66
import Index from './views/index.vue';
7+
import './style/index.css'
8+
import './config.js'
79
810
export default{
911
components:{

src/components/admin/addProductions.vue

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,69 @@
11
<template >
2-
<div>
3-
<el-container>
4-
<el-header style="display: inline-block; margin-top: 0px ;">
5-
<el-row type="flex" justify="end">
6-
<el-col :span="2">
7-
<el-button type="primary" round @click="dialogFormVisible = true"
8-
>新增</el-button
2+
<el-container>
3+
<el-header style="height: 24px">
4+
<el-row type="flex" justify="end">
5+
<el-col :span="2">
6+
<el-button type="primary" round @click="dialogFormVisible = true"
7+
>新增</el-button
8+
>
9+
</el-col>
10+
<el-col :span="6">
11+
<el-input placeholder="请输入查询商品" v-model="search">
12+
<el-button slot="append" icon="el-icon-search"></el-button>
13+
</el-input>
14+
15+
<div style="clear: both"></div>
16+
</el-col>
17+
</el-row>
18+
</el-header>
19+
<el-main>
20+
<el-table
21+
:data="
22+
tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
23+
"
24+
style="width: 100%"
25+
height="74vh"
26+
:row-style="{ height: '10px' }"
27+
>
28+
<el-table-column prop="imgUrl" label="图片链接" width="100px">
29+
<template slot-scope="scope">
30+
<img :src="scope.row.imgUrl" style="height: 100px" />
31+
</template>
32+
</el-table-column>
33+
<el-table-column label="商品名" min-width="150px">
34+
<template slot-scope="scope">
35+
<a :href="scope.row.materialUrl" target="_blank">{{
36+
scope.row.name
37+
}}</a>
38+
</template>
39+
</el-table-column>
40+
<el-table-column prop="unitPrice" label="单价"> </el-table-column>
41+
<el-table-column prop="bestPrice" label="活动价"> </el-table-column>
42+
<el-table-column prop="startDate" label="开始日期"> </el-table-column>
43+
<el-table-column prop="endDate" label="结束日期"> </el-table-column>
44+
<el-table-column prop="catagory" label="类别"> </el-table-column>
45+
<el-table-column prop="isJdSale" label="自营"> </el-table-column>
46+
<el-table-column fixed="right" label="操作" width="100">
47+
<template slot-scope="scope">
48+
<el-button @click="handleClick(scope.row)" type="text" size="small"
49+
>编辑</el-button
950
>
10-
</el-col>
11-
<el-col :span="4">
12-
<el-input placeholder="请输入内容" v-model="search">
13-
<el-button slot="append" icon="el-icon-search"></el-button>
14-
</el-input>
15-
<div style="clear: both"></div>
16-
</el-col>
17-
</el-row>
18-
</el-header>
19-
<el-main >
20-
<el-table
21-
:data="
22-
tableData.slice(
23-
(currentPage - 1) * pageSize,
24-
currentPage * pageSize
25-
)
26-
"
27-
style="width: 100%"
51+
<el-button type="text" size="small">删除</el-button>
52+
</template>
53+
</el-table-column>
54+
</el-table>
55+
<div class="block">
56+
<el-pagination
57+
@size-change="handleSizeChange"
58+
@current-change="handleCurrentChange"
59+
:current-page="currentPage"
60+
:page-sizes="[10, 20, 30, 50, 100]"
61+
:page-size="pageSize"
62+
layout="prev, pager, next"
63+
:total="tableData.length"
2864
>
29-
<el-table-column prop="imgUrl" label="图片链接" width="100px">
30-
<template slot-scope="scope">
31-
<img :src="scope.row.imgUrl" style="height: 100px" />
32-
</template>
33-
</el-table-column>
34-
<el-table-column label="商品名" min-width="150px">
35-
<template slot-scope="scope">
36-
<a :href="scope.row.materialUrl" target="_blank">{{
37-
scope.row.name
38-
}}</a>
39-
</template>
40-
</el-table-column>
41-
<el-table-column prop="unitPrice" label="单价"> </el-table-column>
42-
<el-table-column prop="bestPrice" label="活动价"> </el-table-column>
43-
<el-table-column prop="startDate" label="开始日期"> </el-table-column>
44-
<el-table-column prop="endDate" label="结束日期"> </el-table-column>
45-
<el-table-column prop="catagory" label="类别"> </el-table-column>
46-
<el-table-column prop="isJdSale" label="自营"> </el-table-column>
47-
<el-table-column fixed="right" label="操作" width="100">
48-
<template slot-scope="scope">
49-
<el-button
50-
@click="handleClick(scope.row)"
51-
type="text"
52-
size="small"
53-
>编辑</el-button
54-
>
55-
<el-button type="text" size="small">删除</el-button>
56-
</template>
57-
</el-table-column>
58-
</el-table>
59-
<div class="block">
60-
<el-pagination
61-
@size-change="handleSizeChange"
62-
@current-change="handleCurrentChange"
63-
:current-page="currentPage"
64-
:page-sizes="[10, 20, 30, 50, 100]"
65-
:page-size="pageSize"
66-
layout="prev, pager, next"
67-
:total="tableData.length"
68-
style="float: right"
69-
>
70-
</el-pagination>
71-
</div>
72-
</el-main>
73-
</el-container>
74-
<div>
65+
</el-pagination>
66+
</div>
7567
<el-dialog
7668
title="新增商品"
7769
:visible.sync="dialogFormVisible"
@@ -100,25 +92,26 @@
10092
<el-button type="primary" @click="addProduct">确 定</el-button>
10193
</div>
10294
</el-dialog>
103-
</div>
104-
</div>
95+
</el-main>
96+
</el-container>
10597
</template>
10698

10799
<script>
108100
import axios from "axios";
101+
import { API } from "../../config.js";
109102
export default {
110103
name: "AddProductions",
111104
data() {
112105
return {
113106
pageSize: 4, //每页多少条
114107
currentPage: 1, // 当前页
115108
tableData: [],
109+
formLabelWidth: "120px",
116110
form: {
117111
skuid: "",
118112
bestPrice: "",
119113
},
120114
dialogFormVisible: false,
121-
formLabelWidth: "120px",
122115
search: "",
123116
};
124117
},
@@ -134,11 +127,21 @@ export default {
134127
handleClick(row) {
135128
console.log(row.name);
136129
},
130+
getProducts() {
131+
let tableDataP = axios
132+
.post(API.GET_PRODUCTS_INFO, { goodsName: "" })
133+
.then((res) => {
134+
return res.data.data;
135+
});
136+
tableDataP.then((res) => {
137+
this.tableData = res;
138+
});
139+
},
137140
addProduct() {
138141
this.dialogFormVisible = false;
139142
//此处通过skuid传参调取api,去抓取京东商品信息
140143
let product_info = axios
141-
.post("http://localhost:5000/get_product_info", {
144+
.post(API.ADD_PRODUCT_INFO, {
142145
skuid: this.form.skuid,
143146
bestPrice: this.form.bestPrice,
144147
})
@@ -150,18 +153,12 @@ export default {
150153
});
151154
product_info.then((data) => {
152155
this.$message(data.msg);
156+
this.getProducts();
153157
});
154158
},
155159
},
156160
mounted: function () {
157-
let tableDataP = axios
158-
.post("http://localhost:5000/get_goods_list", { goodsName: "" })
159-
.then((res) => {
160-
return res.data.data;
161-
});
162-
tableDataP.then((res) => {
163-
this.tableData = res;
164-
});
161+
this.getProducts();
165162
},
166163
};
167164
</script>

src/components/common/leftNavigator.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
text-color="#fff"
1111
active-text-color="#ffd04b"
1212
style="height:100%"
13-
collapse-transition="false"
1413
>
1514
<el-submenu index="1">
1615
<template slot="title">

src/components/common/topHeader.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<template>
2-
<el-row type="flex" justify="end">
3-
<el-col :span="3"> <h2>显示个人信息</h2></el-col>
4-
<el-col :span="1">
5-
<el-avatar :size="46" :src="circleUrl" icon="el-icon-user-solid" style="margin-top:20px"></el-avatar>
6-
</el-col>
7-
</el-row>
2+
<el-row type="flex" justify="end">
3+
<el-col :span="1" style="padding-top:14px">
4+
<el-avatar
5+
:size="40"
6+
icon="el-icon-user-solid"
7+
></el-avatar>
8+
</el-col>
9+
</el-row>
810
</template>
911

1012
<script>
1113
export default {
12-
name:'TopHeader',
13-
}
14+
name: "TopHeader",
15+
};
1416
</script>
1517

1618
<style>
17-
1819
</style>

src/components/productions/electricsCatagory.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
v-for="(o, index) in 50"
66
:key="o"
77
:offset="index > 0 ? 0 : 0"
8-
98
>
109
<el-card shadow="always">
11-
<img
12-
src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
13-
class="image"
14-
/>
10+
<img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image" />
1511
</el-card>
1612
</el-col>
1713
</el-row>

src/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export const API={
3+
"ADD_PRODUCT_INFO" : "http://localhost:5000/add_pruduct_info",
4+
"GET_PRODUCTS_INFO" : "http://localhost:5000/get_pruducts_info"
5+
};
6+
7+

src/style/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body{
2+
margin:0px;
3+
}

src/views/index.vue

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<template>
2-
<el-container>
3-
<el-aside>
2+
<el-container >
3+
<el-aside >
44
<LeftNavigator></LeftNavigator>
55
</el-aside>
6-
<el-main style="height:100vh">
7-
<el-container direction="vertical">
8-
<el-header>
9-
<TopHeader></TopHeader>
10-
</el-header>
11-
<el-main >
12-
<el-divider ></el-divider>
13-
<router-view ></router-view>
14-
</el-main>
15-
</el-container>
16-
</el-main>
6+
<el-container style="height:100vh">
7+
<el-header>
8+
<TopHeader></TopHeader>
9+
</el-header>
10+
<el-main style="background-color: #E9EEF3; ">
11+
<router-view ></router-view>
12+
</el-main>
13+
</el-container>
1714
</el-container>
1815
</template>
1916
<script>
@@ -35,8 +32,7 @@ export default {
3532
<style scoped>
3633
.el-aside {
3734
width: auto !important;
38-
position: relative;
39-
top:0px;
35+
4036
}
4137
4238

0 commit comments

Comments
 (0)