Skip to content

Commit

Permalink
Opt 036 (#338)
Browse files Browse the repository at this point in the history
* refactor(*): upgrade to version 0.3.6

* refactor(axios): optimize code

* fix(Fix table component cannot be centered issue):

fix #337

* docs: update readme
  • Loading branch information
vanoneang committed Jul 21, 2020
1 parent 026f71f commit d319cf1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
plugins: ['vue'],
extends: ['plugin:vue/essential', '@vue/airbnb'],
rules: {
'max-len': 0,
camelcase: 0, // 变量可以用下划线
'no-plusplus': 0, // 禁止使用++,--
'guard-for-in': 0,
Expand All @@ -17,12 +18,10 @@ module.exports = {
'import/no-unresolved': 0,
'no-underscore-dangle': 0, // 无下划线
'no-restricted-syntax': 0,
'no-restricted-syntax': 0,
'consistent-return': 'off',
semi: ['error', 'never'],
'no-prototype-builtins': 'off',
'class-methods-use-this': 'off',
semi: ['error', 'never'], // 无分号
'max-len': ['error', { code: 200 }],
'arrow-parens': ['error', 'as-needed'],
'comma-dangle': ['error', 'only-multiline'],
'no-param-reassign': ['error', { props: false }],
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ QQ群搜索:Lin CMS 官方交流群 或 814597236
1. `F` 修复一级菜单双击报错
2. `U` 统一不同编辑器换行符
3. `U` 内容提交使用“加载中”按钮
4. `F` 修复Table组件不能居中问题
5. `F` 编辑用户时,至少选择一个分组

### 0.3.5

Expand Down
9 changes: 1 addition & 8 deletions src/assets/style/realize/element-variable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,6 @@ $--font-path: "~element-ui/lib/theme-chalk/fonts";
}
}

.el-table .cell {
display: flex;
margin-top: 2px;
margin-bottom: 2px;
padding-left: 20px;
}

.el-table thead tr th .cell {
color: #333;
font-weight: 500;
Expand Down Expand Up @@ -911,4 +904,4 @@ $typeMap: (primary:#3963BC,
@include e(title) {
color: #333333;
}
}
}
15 changes: 14 additions & 1 deletion src/lin/plugin/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ const config = {
},
}

/**
* 错误码是否是refresh相关
* @param {number} code 错误码
*/
function refreshTokenException(code) {
let flag = false
const codes = [10000, 10042, 10050, 10052]
if (codes.includes(code)) {
flag = true
}
return flag
}

// const retryTime = 2 // 请求失败重试次数
// const retryDelay = 1500 // 请求失败重试间隔

Expand Down Expand Up @@ -117,7 +130,7 @@ _axios.interceptors.response.use(
const { url } = res.config

// refreshToken相关,直接登出
if (code === 10000 || code === 10042 || code === 10052) {
if (refreshTokenException(code)) {
setTimeout(() => {
store.dispatch('loginOut')
const { origin } = window.location
Expand Down
12 changes: 6 additions & 6 deletions src/plugin/lin-cms-ui/view/table/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<div slot="header"><span>基础表格</span></div>
<el-row>
<el-table :data="tableData" style="width: 100%" stripe>
<el-table-column fixed prop="date" label="日期" width="150"></el-table-column>
<el-table-column prop="name" label="姓名" width="120"></el-table-column>
<el-table-column prop="province" label="省份" width="120"></el-table-column>
<el-table-column prop="city" label="市区" width="120"></el-table-column>
<el-table-column prop="zip" label="邮编" width="120"></el-table-column>
<el-table-column prop="address" label="地址"></el-table-column>
<el-table-column align="center" fixed prop="date" label="日期" width="150"></el-table-column>
<el-table-column align="center" prop="name" label="姓名" width="120"></el-table-column>
<el-table-column align="center" prop="province" label="省份" width="120"></el-table-column>
<el-table-column align="center" prop="city" label="市区" width="120"></el-table-column>
<el-table-column align="center" prop="zip" label="邮编" width="120"></el-table-column>
<el-table-column align="center" prop="address" label="地址"></el-table-column>
</el-table>
</el-row>
<el-collapse>
Expand Down
4 changes: 4 additions & 0 deletions src/view/admin/user/user-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ export default {
return
}
try {
if (!this.form.group_ids.length) {
this.$message.error('至少选择一个分组')
return
}
this.loading = true
res = await Admin.updateOneUser(this.form.email, this.form.group_ids, this.id)
} catch (e) {
Expand Down
6 changes: 4 additions & 2 deletions src/view/admin/user/user-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export default {
},
// 切换tab栏
handleClick(tab) {
console.log(tab)
this.activeTab = tab.name
},
// 监听子组件更新用户信息是否成功
Expand Down Expand Up @@ -260,7 +259,10 @@ export default {
async created() {
await this.getAdminUsers()
this.getAllGroups()
this.tableColumn = [{ prop: 'username', label: '名称' }, { prop: 'groupNames', label: '所属分组' }] // 设置表头信息
this.tableColumn = [
{ prop: 'username', label: '名称' },
{ prop: 'groupNames', label: '所属分组' },
] // 设置表头信息
this.operate = [
{ name: '编辑', func: 'handleEdit', type: 'primary' },
{ name: '删除', func: 'handleDelete', type: 'danger' },
Expand Down

0 comments on commit d319cf1

Please sign in to comment.