Skip to content

Commit 0dde177

Browse files
committed
client change
1 parent 816c115 commit 0dde177

File tree

13 files changed

+145
-37
lines changed

13 files changed

+145
-37
lines changed

build/vue-loader.conf.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
var utils = require('./utils')
22
var config = require('../config')
33
var isProduction = process.env.NODE_ENV === 'production'
4+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
45

56
module.exports = {
67
loaders: utils.cssLoaders({
78
sourceMap: isProduction
89
? config.build.productionSourceMap
910
: config.dev.cssSourceMap,
1011
extract: isProduction
12+
}/*,{
13+
css: ExtractTextPlugin.extract({
14+
use: ['css-loader'],
15+
fallback: 'vue-style-loader',
16+
publicPath:'../'
17+
}*/)
1118
})
1219
}

config/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
index: path.resolve(__dirname, '../dist/index.html'),
88
assetsRoot: path.resolve(__dirname, '../dist'),
99
assetsSubDirectory: 'static',
10-
assetsPublicPath: '/',
10+
assetsPublicPath: './',
1111
productionSourceMap: true,
1212
// Gzip off by default as many popular static hosts such as
1313
// Surge or Netlify already gzip all static assets for you.

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
"server": "node server/bin/www"
1212
},
1313
"dependencies": {
14-
"vue": "^2.3.3",
15-
"vue-router": "^2.3.1",
16-
"iview": "^2.0.0-rc.16",
17-
"vue-axios": "^2.0.2",
18-
"vuex": "^2.3.1",
1914
"async": "^2.1.4",
2015
"axios": "^0.16.1",
2116
"body-parser": "~1.15.1",
@@ -25,9 +20,15 @@
2520
"express": "~4.13.4",
2621
"express-session": "latest",
2722
"formidable": "^1.1.1",
23+
"iview": "^2.0.0-rc.16",
24+
"moment": "^2.18.1",
2825
"monk": "^5.0.2",
2926
"morgan": "~1.7.0",
30-
"transliteration": "^1.6.2"
27+
"transliteration": "^1.6.2",
28+
"vue": "^2.3.3",
29+
"vue-axios": "^2.0.2",
30+
"vue-router": "^2.3.1",
31+
"vuex": "^2.3.1"
3132
},
3233
"devDependencies": {
3334
"autoprefixer": "^6.7.2",
@@ -43,23 +44,23 @@
4344
"css-loader": "^0.28.0",
4445
"eventsource-polyfill": "^0.9.6",
4546
"express": "^4.14.1",
46-
"extract-text-webpack-plugin": "^2.0.0",
47+
"extract-text-webpack-plugin": "^2.1.2",
4748
"file-loader": "^0.11.1",
4849
"friendly-errors-webpack-plugin": "^1.1.3",
4950
"html-webpack-plugin": "^2.28.0",
5051
"http-proxy-middleware": "^0.17.3",
51-
"webpack-bundle-analyzer": "^2.2.1",
52-
"semver": "^5.3.0",
53-
"shelljs": "^0.7.6",
5452
"opn": "^4.0.2",
5553
"optimize-css-assets-webpack-plugin": "^1.3.0",
5654
"ora": "^1.2.0",
5755
"rimraf": "^2.6.0",
56+
"semver": "^5.3.0",
57+
"shelljs": "^0.7.6",
5858
"url-loader": "^0.5.8",
5959
"vue-loader": "^12.1.0",
6060
"vue-style-loader": "^3.0.1",
6161
"vue-template-compiler": "^2.3.3",
6262
"webpack": "^2.6.1",
63+
"webpack-bundle-analyzer": "^2.2.1",
6364
"webpack-dev-middleware": "^1.10.0",
6465
"webpack-hot-middleware": "^2.18.0",
6566
"webpack-merge": "^4.1.0"

server/models/clientModels/createClient.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ const createClient = (req, callback) => {
55
let name = req.body.name,
66
phone = req.body.phone,
77
address = req.body.address,
8-
user = req.body.user;
8+
user = req.body.user,
9+
endtime = req.body.endtime,
10+
max = req.body.max,
11+
status = req.body.status;
912

10-
if( !name || !phone || !address || !user ){
13+
if( !name || !phone || !address || !user || !endtime || !max || status==null){
1114
callback({
1215
status: 0,
1316
msg: '参数错误'
@@ -21,6 +24,9 @@ const createClient = (req, callback) => {
2124
phone: phone,
2225
address: address,
2326
user: user,
27+
endtime: endtime,
28+
max: max,
29+
status: status,
2430
flag: 1
2531
})
2632
.then((result) => {

server/models/clientModels/updateClient.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ const updateClient = (req, callback) => {
88
phone = req.body.phone,
99
address = req.body.address,
1010
user = req.body.user,
11+
endtime = req.body.endtime,
12+
max = req.body.max,
13+
status = req.body.status,
1114
admin = req.session.user._id;
12-
if( !id || !name || !phone || !address || !user || !admin ){
15+
if( !id || !name || !phone || !address || !user || !admin || !endtime || !max || status==null){
1316
callback({
1417
status: 0,
1518
msg: '参数错误'
@@ -28,6 +31,9 @@ const updateClient = (req, callback) => {
2831
phone: phone,
2932
address: address,
3033
user: user,
34+
endtime: endtime,
35+
max: max,
36+
status: status,
3137
flag: result.flag
3238
}
3339
if( result.user == admin ){

server/models/userModels/updateUser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ const createUser = (req, callback) => {
2424
.then((result) => {
2525
if( result ){
2626
if( result.parents.indexOf( creator )>=0 ){
27+
let password = result.pwd == pwd ? result.pwd : md5(pwd)
2728
let data = {
2829
account: account,
2930
name: name,
30-
pwd: md5(pwd),
31+
pwd: password,
3132
roles: roles,
3233
parents: result.parents,
3334
flag: result.flag

src/App.vue

+22
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,26 @@ table tbody tr:hover{
249249
-ms-align-content: center;
250250
line-height: 24px;
251251
}
252+
.ivu-input-wrapper{
253+
margin-bottom: 0 !important;
254+
}
255+
.login-form .ivu-input-wrapper{
256+
margin-bottom: 15px !important;
257+
}
258+
.ivu-modal-body p{
259+
margin-bottom: 10px;
260+
}
261+
.demo-spin-icon-load{
262+
animation: ani-demo-spin 1s linear infinite;
263+
}
264+
@keyframes ani-demo-spin {
265+
from { transform: rotate(0deg);}
266+
50% { transform: rotate(180deg);}
267+
to { transform: rotate(360deg);}
268+
}
269+
.demo-spin-col{
270+
height: 100px;
271+
position: relative;
272+
border: 1px solid #eee;
273+
}
252274
</style>

src/assets/logo.png

-6.69 KB
Binary file not shown.

src/components/Client.vue

+60-5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<td>联系电话</td>
2424
<td>联系地址</td>
2525
<td>绑定用户</td>
26+
<td>服务开通状态</td>
27+
<td>截止时间</td>
28+
<td>最大使用人数</td>
2629
<td>操作</td>
2730
</tr>
2831
</thead>
@@ -33,6 +36,9 @@
3336
<td>{{client.phone}}</td>
3437
<td>{{client.address}}</td>
3538
<td>{{client.username}}</td>
39+
<td>{{client.status?'已开通':'未开通'}}</td>
40+
<td>{{changeTime(client.endtime)}}</td>
41+
<td>{{client.max}}</td>
3642
<td>
3743
<Button type="info" @click.stop="doedit(client._id)">编辑</Button>
3844
<Button type="error" @click.stop="remove(client._id)">删除</Button>
@@ -42,6 +48,9 @@
4248
</table>
4349
<p class="notip" v-show="clients.length==0">没有找到您搜索的客户~</p>
4450
</div>
51+
<Spin fix v-show="loading">
52+
<Icon type="load-c" size=36 class="demo-spin-icon-load"></Icon>
53+
</Spin>
4554
<div class="paginator">
4655
<Page
4756
:total="clients.length"
@@ -75,6 +84,23 @@
7584
<Option v-for="item in users" :value="item._id" :key="item">{{ item.name }}</Option>
7685
</Select>
7786
</p>
87+
88+
<p>
89+
<span class="input-label">服务开通状态</span>
90+
<Select v-model="selectStatus" style="width:250px" filterable>
91+
<Option v-for="item in status" :value="item.value" :key="item">{{ item.label }}</Option>
92+
</Select>
93+
</p>
94+
<p>
95+
<span class="input-label">截止时间</span>
96+
<!-- <Input v-model="endtime" placeholder="请选择截止时间" style="width: 250px"></Input> -->
97+
<Date-picker v-model="endtime" type="date" placeholder="选择日期" style="width: 200px"></Date-picker>
98+
</p>
99+
<p>
100+
<span class="input-label">使用人数上限</span>
101+
102+
<Input-number :min="1" v-model="max" placeholder="请输入使用人数上限" style="width: 250px"></Input-number>
103+
</p>
78104
<div slot="footer">
79105
<Button @click="cancel()">取消</Button>
80106
<Button type="success" @click="submit()">确认</Button>
@@ -88,12 +114,15 @@ export default {
88114
name: 'client',
89115
data(){
90116
return{
117+
loading: true,
91118
newClient: false,
92119
modalTitle: "新增客户",
93120
name: '',
94121
phone: '',
95122
address: '',
96123
selectUser: '',
124+
endtime: '',
125+
max: null,
97126
users: [],
98127
clients: [],
99128
clientArr:[],
@@ -106,6 +135,14 @@ export default {
106135
label: '所属用户',
107136
value: 'user'
108137
}],
138+
selectStatus: 0,
139+
status: [{
140+
label: '开通',
141+
value: 1
142+
},{
143+
label: '未开通',
144+
value: 0
145+
}],
109146
search:'',
110147
pageSize:10,
111148
pageCurrent:1
@@ -133,10 +170,11 @@ export default {
133170
this.clients = res.data
134171
this.clientArr = res.data
135172
}
173+
this.loading = false
136174
})
137175
},
138176
submit(){
139-
if( !this.name || !this.phone || !this.address || !this.selectUser ){
177+
if( !this.name || !this.phone || !this.address || !this.selectUser || !this.endtime || !this.max){
140178
this.$Message.warning({content: '请填写完整信息', duration: 3, closable: true});
141179
return;
142180
}
@@ -146,7 +184,10 @@ export default {
146184
name: this.name,
147185
phone: this.phone,
148186
address: this.address,
149-
user: this.selectUser})
187+
user: this.selectUser,
188+
endtime: this.endtime,
189+
max: this.max,
190+
status: this.selectStatus})
150191
.then( response => response.data )
151192
.then( res => {
152193
if(!this.checkLogin(res))return;
@@ -165,7 +206,10 @@ export default {
165206
name: this.name,
166207
phone: this.phone,
167208
address: this.address,
168-
user: this.selectUser})
209+
user: this.selectUser,
210+
endtime: this.endtime,
211+
max: this.max,
212+
status: this.selectStatus})
169213
.then( response => response.data )
170214
.then( res => {
171215
if(!this.checkLogin(res))return;
@@ -216,6 +260,9 @@ export default {
216260
this.name = this.clients[i].name
217261
this.phone = this.clients[i].phone
218262
this.address = this.clients[i].address
263+
this.endtime = this.clients[i].endtime
264+
this.max = this.clients[i].max
265+
this.selectStatus = this.clients[i].status
219266
this.edit = this.clients[i]
220267
// 遍历users,找出当前编辑的用户拥有的角色
221268
for( let j=0;j<this.users.length;j++ ){
@@ -235,6 +282,9 @@ export default {
235282
this.name = ''
236283
this.phone = ''
237284
this.address = ''
285+
this.endtime = ''
286+
this.max = null
287+
this.selectStatus = ''
238288
this.modalTitle = "新增客户"
239289
this.selectUser = []
240290
this.edit = null
@@ -284,10 +334,15 @@ export default {
284334
},
285335
},
286336
mounted(){
287-
this.getclients()
288337
this.getusers()
338+
this.getclients()
289339
}
290340
}
291341
</script>
292342

293-
<style scoped></style>
343+
<style scoped>
344+
.ivu-date-picker{
345+
display: inline-block;
346+
width: 250px !important;
347+
}
348+
</style>

src/components/Role.vue

+14-9
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@
3636
</template>
3737
<p class="notip" v-show="roles.length==0">没有找到您搜索的角色~</p>
3838
</Row>
39-
<div class="paginator">
40-
<Page
41-
:total="roles.length"
42-
:page-size="pageSize"
43-
:current="pageCurrent"
44-
@on-change="changepage"
45-
show-elevator></Page>
46-
</div>
47-
<!-- <pre>{{roles}}</pre> -->
4839
</div>
40+
<Spin fix v-show="loading">
41+
<Icon type="load-c" size=36 class="demo-spin-icon-load"></Icon>
42+
</Spin>
43+
<div class="paginator">
44+
<Page
45+
:total="roles.length"
46+
:page-size="pageSize"
47+
:current="pageCurrent"
48+
@on-change="changepage"
49+
show-elevator></Page>
50+
</div>
51+
<!-- <pre>{{roles}}</pre> -->
4952
</div>
5053
</div>
5154
<Modal @on-ok="submit" @on-cancel="cancel"
@@ -75,6 +78,7 @@ export default {
7578
name: 'role',
7679
data(){
7780
return{
81+
loading: true,
7882
newRole: false,
7983
modalTitle: '新增角色',
8084
name:'',
@@ -111,6 +115,7 @@ export default {
111115
}else{
112116
this.$Message.error({content: '请求数据出错,请稍后尝试!', duration: 3, closable: true});
113117
}
118+
this.loading = false
114119
})
115120
},
116121
submit(){

0 commit comments

Comments
 (0)