chore: remove i18n (#1828)

This commit is contained in:
花裤衩
2019-05-05 16:49:40 +08:00
committed by GitHub
parent e8e6c7e79c
commit 00a19db299
63 changed files with 317 additions and 1440 deletions

View File

@@ -1,9 +1,9 @@
<template>
<div>
<div style="margin-bottom:15px;">
{{ $t('permission.roles') }}: {{ roles }}
Your roles: {{ roles }}
</div>
{{ $t('permission.switchRoles') }}:
Switch roles:
<el-radio-group v-model="switchRoles">
<el-radio-button label="editor" />
<el-radio-button label="admin" />

View File

@@ -36,7 +36,7 @@
<div :key="'checkPermission'+key" style="margin-top:60px;">
<aside>
{{ $t('permission.tips') }}
In some cases, using v-permission will have no effect. For example: Element-UI's Tab component or el-table-column and other scenes that dynamically render dom. You can only do this with v-if.
<br> e.g.
</aside>

View File

@@ -1,8 +1,6 @@
<template>
<div class="app-container">
<el-button type="primary" @click="handleAddRole">
{{ $t('permission.addRole') }}
</el-button>
<el-button type="primary" @click="handleAddRole">New Role</el-button>
<el-table :data="rolesList" style="width: 100%;margin-top:30px;" border>
<el-table-column align="center" label="Role Key" width="220">
@@ -22,12 +20,8 @@
</el-table-column>
<el-table-column align="center" label="Operations">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="handleEdit(scope)">
{{ $t('permission.editPermission') }}
</el-button>
<el-button type="danger" size="small" @click="handleDelete(scope)">
{{ $t('permission.delete') }}
</el-button>
<el-button type="primary" size="small" @click="handleEdit(scope)">Edit</el-button>
<el-button type="danger" size="small" @click="handleDelete(scope)">Delete</el-button>
</template>
</el-table-column>
</el-table>
@@ -46,16 +40,20 @@
/>
</el-form-item>
<el-form-item label="Menus">
<el-tree ref="tree" :check-strictly="checkStrictly" :data="routesData" :props="defaultProps" show-checkbox node-key="path" class="permission-tree" />
<el-tree
ref="tree"
:check-strictly="checkStrictly"
:data="routesData"
:props="defaultProps"
show-checkbox
node-key="path"
class="permission-tree"
/>
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">
{{ $t('permission.cancel') }}
</el-button>
<el-button type="primary" @click="confirmRole">
{{ $t('permission.confirm') }}
</el-button>
<el-button type="danger" @click="dialogVisible=false">Cancel</el-button>
<el-button type="primary" @click="confirmRole">Confirm</el-button>
</div>
</el-dialog>
</div>
@@ -65,7 +63,6 @@
import path from 'path'
import { deepClone } from '@/utils'
import { getRoutes, getRoles, addRole, deleteRole, updateRole } from '@/api/role'
import i18n from '@/lang'
const defaultRole = {
key: '',
@@ -103,23 +100,13 @@ export default {
async getRoutes() {
const res = await getRoutes()
this.serviceRoutes = res.data
const routes = this.generateRoutes(res.data)
this.routes = this.i18n(routes)
this.routes = this.generateRoutes(res.data)
},
async getRoles() {
const res = await getRoles()
this.rolesList = res.data
},
i18n(routes) {
const app = routes.map(route => {
route.title = i18n.t(`route.${route.title}`)
if (route.children) {
route.children = this.i18n(route.children)
}
return route
})
return app
},
// Reshape the routes structure so that it looks the same as the sidebar
generateRoutes(routes, basePath = '/') {
const res = []