Skip to content

Commit ea9500a

Browse files
committed
2 parents c0a7ea1 + 3e24d0e commit ea9500a

File tree

11 files changed

+2951
-2581
lines changed

11 files changed

+2951
-2581
lines changed

package-lock.json

Lines changed: 2768 additions & 2455 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
},
1414
"dependencies": {
1515
"@antv/data-set": "^0.10.1",
16-
"ant-design-vue": "~1.3.8",
17-
"axios": "^0.18.0",
16+
"ant-design-vue": "~1.3.9",
17+
"axios": "^0.19.0",
1818
"core-js": "^2.6.5",
1919
"enquire.js": "^2.1.6",
2020
"js-cookie": "^2.2.0",

src/components/NoticeIcon/NoticeIcon.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
trigger="click"
55
placement="bottomRight"
66
overlayClassName="header-notice-wrapper"
7+
:getPopupContainer="() => $refs.noticeRef.parentElement"
78
:autoAdjustOverflow="true"
89
:arrowPointAtCenter="true"
910
:overlayStyle="{ width: '300px', top: '50px' }"
@@ -39,7 +40,7 @@
3940
</a-tabs>
4041
</a-spin>
4142
</template>
42-
<span @click="fetchNotice" class="header-notice">
43+
<span @click="fetchNotice" class="header-notice" ref="noticeRef">
4344
<a-badge count="12">
4445
<a-icon style="font-size: 16px; padding: 4px" type="bell" />
4546
</a-badge>

src/components/SettingDrawer/SettingDrawer.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ export default {
195195
setTimeout(() => {
196196
vm.visible = false
197197
}, 16)
198-
// 当主题色不是默认色时,才进行主题编译
199-
if (this.primaryColor !== config.primaryColor) {
200-
updateTheme(this.primaryColor)
201-
}
198+
updateTheme(this.primaryColor)
202199
if (this.colorWeak !== config.colorWeak) {
203200
updateColorWeak(this.colorWeak)
204201
}

src/components/Table/index.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ export default {
109109
current: localPageNum,
110110
pageSize: this.pageSize,
111111
showSizeChanger: this.showSizeChanger
112-
})
112+
}) || false
113+
console.log('this.localPagination', this.localPagination)
113114
this.needTotalList = this.initTotalList(this.columns)
114115
this.loadData()
115116
},
@@ -135,9 +136,9 @@ export default {
135136
this.localLoading = true
136137
const parameter = Object.assign({
137138
pageNo: (pagination && pagination.current) ||
138-
this.localPagination.current || this.pageNum,
139+
this.showPagination && this.localPagination.current || this.pageNum,
139140
pageSize: (pagination && pagination.pageSize) ||
140-
this.localPagination.pageSize || this.pageSize
141+
this.showPagination && this.localPagination.pageSize || this.pageSize
141142
},
142143
(sorter && sorter.field && {
143144
sortField: sorter.field
@@ -148,29 +149,36 @@ export default {
148149
...filters
149150
}
150151
)
152+
console.log('parameter', parameter)
151153
const result = this.data(parameter)
152154
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
153155
// eslint-disable-next-line
154156
if ((typeof result === 'object' || typeof result === 'function') && typeof result.then === 'function') {
155157
result.then(r => {
156-
this.localPagination = Object.assign({}, this.localPagination, {
158+
this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
157159
current: r.pageNo, // 返回结果中的当前分页数
158160
total: r.totalCount, // 返回结果中的总记录数
159161
showSizeChanger: this.showSizeChanger,
160162
pageSize: (pagination && pagination.pageSize) ||
161163
this.localPagination.pageSize
162-
})
164+
}) || false
163165
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
164-
if (r.data.length === 0 && this.localPagination.current > 1) {
166+
if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
165167
this.localPagination.current--
166168
this.loadData()
167169
return
168170
}
169171

170-
// 这里用于判断接口是否有返回 r.totalCount this.showPagination = false
172+
// 这里用于判断接口是否有返回 r.totalCount this.showPagination = true 且 pageNo 和 pageSize 存在 且 totalCount 小于等于 pageNo * pageSize 的大小
171173
// 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
172-
173-
(!this.showPagination || !r.totalCount && this.showPagination === 'auto') && (this.localPagination.hideOnSinglePage = true)
174+
try {
175+
if ((['auto', true].includes(this.showPagination) && r.totalCount <= (r.pageNo * this.localPagination.pageSize))) {
176+
this.localPagination.hideOnSinglePage = true
177+
}
178+
} catch (e) {
179+
this.localPagination = false
180+
}
181+
console.log('loadData -> this.localPagination', this.localPagination)
174182
this.localDataSource = r.data // 返回结果中的数组数据
175183
this.localLoading = false
176184
})
@@ -272,7 +280,9 @@ export default {
272280
if (k === 'rowSelection') {
273281
if (showAlert && this.rowSelection) {
274282
// 如果需要使用alert,则重新绑定 rowSelection 事件
283+
console.log('this.rowSelection', this.rowSelection)
275284
props[k] = {
285+
...this.rowSelection,
276286
selectedRows: this.selectedRows,
277287
selectedRowKeys: this.selectedRowKeys,
278288
onChange: (selectedRowKeys, selectedRows) => {

src/config/defaultSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* 项目默认配置项
3-
* primaryColor - 默认主题色
3+
* primaryColor - 默认主题色, 如果修改颜色不生效,请清理 localStorage
44
* navTheme - sidebar theme ['dark', 'light'] 两种主题
55
* colorWeak - 色盲模式
66
* layout - 整体布局方式 ['sidemenu', 'topmenu'] 两种布局
@@ -14,7 +14,7 @@
1414
*/
1515

1616
export default {
17-
primaryColor: '#1890FF', // primary color of ant design
17+
primaryColor: '#52C41A', // primary color of ant design
1818
navTheme: 'dark', // theme for nav menu
1919
layout: 'sidemenu', // nav menu position: sidemenu or topmenu
2020
contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu

src/views/account/settings/Index.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a-menu
77
:mode="device == 'mobile' ? 'horizontal' : 'inline'"
88
:style="{ border: '0', width: device == 'mobile' ? '560px' : 'auto'}"
9-
:defaultSelectedKeys="defaultSelectedKeys"
9+
:selectedKeys="selectedKeys"
1010
type="inner"
1111
@openChange="onOpenChange"
1212
>
@@ -64,7 +64,7 @@ export default {
6464
mode: 'inline',
6565
6666
openKeys: [],
67-
defaultSelectedKeys: [],
67+
selectedKeys: [],
6868
6969
// cropper
7070
preview: {},
@@ -96,7 +96,12 @@ export default {
9696
},
9797
updateMenu () {
9898
const routes = this.$route.matched.concat()
99-
this.defaultSelectedKeys = [ routes.pop().path ]
99+
this.selectedKeys = [ routes.pop().path ]
100+
}
101+
},
102+
watch: {
103+
'$route' (val) {
104+
this.updateMenu()
100105
}
101106
}
102107
}

src/views/list/TableList.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,17 @@
8484
:data="loadData"
8585
:alert="options.alert"
8686
:rowSelection="options.rowSelection"
87+
showPagination="auto"
8788
>
8889
<span slot="serial" slot-scope="text, record, index">
8990
{{ index + 1 }}
9091
</span>
9192
<span slot="status" slot-scope="text">
9293
<a-badge :status="text | statusTypeFilter" :text="text | statusFilter" />
9394
</span>
95+
<span slot="description" slot-scope="text">
96+
<ellipsis :length="4" tooltip>{{ text }}</ellipsis>
97+
</span>
9498

9599
<span slot="action" slot-scope="text, record">
96100
<template>
@@ -107,7 +111,7 @@
107111

108112
<script>
109113
import moment from 'moment'
110-
import { STable } from '@/components'
114+
import { STable, Ellipsis } from '@/components'
111115
import StepByStepModal from './modules/StepByStepModal'
112116
import CreateForm from './modules/CreateForm'
113117
import { getRoleList, getServiceList } from '@/api/manage'
@@ -135,6 +139,7 @@ export default {
135139
name: 'TableList',
136140
components: {
137141
STable,
142+
Ellipsis,
138143
CreateForm,
139144
StepByStepModal
140145
},
@@ -157,7 +162,8 @@ export default {
157162
},
158163
{
159164
title: '描述',
160-
dataIndex: 'description'
165+
dataIndex: 'description',
166+
scopedSlots: { customRender: 'description' }
161167
},
162168
{
163169
title: '服务调用次数',
@@ -224,7 +230,13 @@ export default {
224230
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
225231
rowSelection: {
226232
selectedRowKeys: this.selectedRowKeys,
227-
onChange: this.onSelectChange
233+
onChange: this.onSelectChange,
234+
getCheckboxProps: record => ({
235+
props: {
236+
disabled: record.no === 'No 2', // Column configuration not to be checked
237+
name: record.no
238+
}
239+
})
228240
}
229241
}
230242
this.optionAlertShow = true

src/views/user/Register.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
></a-input>
1212
</a-form-item>
1313

14-
<a-popover placement="rightTop" trigger="click" :visible="state.passwordLevelChecked">
14+
<a-popover
15+
placement="rightTop"
16+
:trigger="['focus']"
17+
:getPopupContainer="(trigger) => trigger.parentElement"
18+
v-model="state.passwordLevelChecked">
1519
<template slot="content">
1620
<div :style="{ width: '240px' }" >
1721
<div :class="['user-register', passwordLevelClass]">强度:<span>{{ passwordLevelName }}</span></div>
@@ -148,7 +152,6 @@ export default {
148152
}
149153
},
150154
methods: {
151-
152155
handlePasswordLevel (rule, value, callback) {
153156
let level = 0
154157
@@ -208,9 +211,10 @@ export default {
208211
},
209212
210213
handleSubmit () {
211-
const { form: { validateFields }, $router } = this
214+
const { form: { validateFields }, state, $router } = this
212215
validateFields({ force: true }, (err, values) => {
213216
if (!err) {
217+
state.passwordLevelChecked = false
214218
$router.push({ name: 'registerResult', params: { ...values } })
215219
}
216220
})

vue.config.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,12 @@ function resolve (dir) {
99

1010
// vue.config.js
1111
module.exports = {
12-
/*
13-
Vue-cli3:
14-
Crashed when using Webpack `import()` #2463
15-
https://github.com/vuejs/vue-cli/issues/2463
16-
17-
*/
18-
/*
19-
pages: {
20-
index: {
21-
entry: 'src/main.js',
22-
chunks: ['chunk-vendors', 'chunk-common', 'index']
23-
}
24-
},
25-
*/
2612
configureWebpack: {
2713
plugins: [
2814
// Ignore all locale files of moment.js
2915
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
3016
// 生成仅包含颜色的替换样式(主题色等)
17+
// TODO 需要增加根据环境不开启主题需求
3118
new ThemeColorReplacer({
3219
fileName: 'css/theme-colors-[contenthash:8].css',
3320
matchColors: getAntdSerials('#1890ff'), // 主色系列
@@ -38,8 +25,13 @@ module.exports = {
3825
return ':not(.ant-calendar-selected-date)' + selector
3926
case '.ant-btn:focus,.ant-btn:hover':
4027
return '.ant-btn:focus:not(.ant-btn-primary),.ant-btn:hover:not(.ant-btn-primary)'
28+
case '.ant-steps-item-process .ant-steps-item-icon > .ant-steps-icon':
29+
return null
4130
case '.ant-btn.active,.ant-btn:active':
4231
return '.ant-btn.active:not(.ant-btn-primary),.ant-btn:active:not(.ant-btn-primary)'
32+
case '.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-submenu-selected,.ant-menu-horizontal>.ant-menu-submenu:hover':
33+
case '.ant-menu-horizontal > .ant-menu-item-active,.ant-menu-horizontal > .ant-menu-item-open,.ant-menu-horizontal > .ant-menu-item-selected,.ant-menu-horizontal > .ant-menu-item:hover,.ant-menu-horizontal > .ant-menu-submenu-active,.ant-menu-horizontal > .ant-menu-submenu-open,.ant-menu-horizontal > .ant-menu-submenu-selected,.ant-menu-horizontal > .ant-menu-submenu:hover':
34+
return '.ant-menu-horizontal > .ant-menu-item-active,.ant-menu-horizontal > .ant-menu-item-open,.ant-menu-horizontal > .ant-menu-item-selected,.ant-menu-horizontal > .ant-menu-item:hover,.ant-menu-horizontal > .ant-menu-submenu-active,.ant-menu-horizontal > .ant-menu-submenu-open,.ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu-selected,.ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu:hover'
4335
default :
4436
return selector
4537
}

0 commit comments

Comments
 (0)