From 5135a640b457901d3f8b7e3da941025afab7a0d1 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 3 Apr 2019 17:39:43 +0800 Subject: [PATCH] u+ --- package.json | 1 - src/lang/en.js | 172 ---------------------------------- src/lang/es.js | 172 ---------------------------------- src/lang/index.js | 36 ------- src/lang/zh.js | 172 ---------------------------------- src/main.js | 5 +- src/views/login/index.vue | 9 -- src/views/permission/role.vue | 15 +-- 8 files changed, 3 insertions(+), 579 deletions(-) delete mode 100644 src/lang/en.js delete mode 100755 src/lang/es.js delete mode 100644 src/lang/index.js delete mode 100644 src/lang/zh.js diff --git a/package.json b/package.json index 12bf3ffc..887d66f8 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "tui-editor": "1.3.3", "vue": "2.6.10", "vue-count-to": "1.0.13", - "vue-i18n": "7.3.2", "vue-router": "3.0.2", "vue-splitpane": "1.0.4", "vuedraggable": "2.20.0", diff --git a/src/lang/en.js b/src/lang/en.js deleted file mode 100644 index e2bfbbd7..00000000 --- a/src/lang/en.js +++ /dev/null @@ -1,172 +0,0 @@ -export default { - route: { - dashboard: 'Dashboard', - introduction: 'Introduction', - documentation: 'Documentation', - guide: 'Guide', - permission: 'Permission', - pagePermission: 'Page Permission', - rolePermission: 'Role Permission', - directivePermission: 'Directive Permission', - icons: 'Icons', - components: 'Components', - componentIndex: 'Introduction', - tinymce: 'Tinymce', - markdown: 'Markdown', - jsonEditor: 'JSON Editor', - dndList: 'Dnd List', - splitPane: 'SplitPane', - avatarUpload: 'Avatar Upload', - dropzone: 'Dropzone', - sticky: 'Sticky', - countTo: 'CountTo', - componentMixin: 'Mixin', - backToTop: 'BackToTop', - dragDialog: 'Drag Dialog', - dragSelect: 'Drag Select', - dragKanban: 'Drag Kanban', - charts: 'Charts', - keyboardChart: 'Keyboard Chart', - lineChart: 'Line Chart', - mixChart: 'Mix Chart', - example: 'Example', - nested: 'Nested Routes', - menu1: 'Menu 1', - 'menu1-1': 'Menu 1-1', - 'menu1-2': 'Menu 1-2', - 'menu1-2-1': 'Menu 1-2-1', - 'menu1-2-2': 'Menu 1-2-2', - 'menu1-3': 'Menu 1-3', - menu2: 'Menu 2', - Table: 'Table', - dynamicTable: 'Dynamic Table', - dragTable: 'Drag Table', - inlineEditTable: 'Inline Edit', - complexTable: 'Complex Table', - tab: 'Tab', - form: 'Form', - createArticle: 'Create Article', - editArticle: 'Edit Article', - articleList: 'Article List', - errorPages: 'Error Pages', - page401: '401', - page404: '404', - errorLog: 'Error Log', - excel: 'Excel', - exportExcel: 'Export Excel', - selectExcel: 'Export Selected', - mergeHeader: 'Merge Header', - uploadExcel: 'Upload Excel', - zip: 'Zip', - pdf: 'PDF', - exportZip: 'Export Zip', - theme: 'Theme', - clipboardDemo: 'Clipboard', - i18n: 'I18n', - externalLink: 'External Link' - }, - navbar: { - logOut: 'Log Out', - dashboard: 'Dashboard', - github: 'Github', - theme: 'Theme', - size: 'Global Size' - }, - login: { - title: 'Login Form', - logIn: 'Log in', - username: 'Username', - password: 'Password', - any: 'any', - thirdparty: 'Or connect with', - thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !' - }, - documentation: { - documentation: 'Documentation', - github: 'Github Repository' - }, - permission: { - addRole: 'New Role', - editPermission: 'Edit Permission', - roles: 'Your roles', - switchRoles: 'Switch roles', - tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.', - delete: 'Delete', - confirm: 'Confirm', - cancel: 'Cancel' - }, - guide: { - description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', - button: 'Show Guide' - }, - components: { - documentation: 'Documentation', - tinymceTips: 'Rich text is a core feature of the management backend, but at the same time it is a place with lots of pits. In the process of selecting rich texts, I also took a lot of detours. The common rich texts on the market have been basically used, and I finally chose Tinymce. See the more detailed rich text comparison and introduction.', - dropzoneTips: 'Because my business has special needs, and has to upload images to qiniu, so instead of a third party, I chose encapsulate it by myself. It is very simple, you can see the detail code in @/components/Dropzone.', - stickyTips: 'when the page is scrolled to the preset position will be sticky on the top.', - backToTopTips1: 'When the page is scrolled to the specified position, the Back to Top button appears in the lower right corner', - backToTopTips2: 'You can customize the style of the button, show / hide, height of appearance, height of the return. If you need a text prompt, you can use element-ui el-tooltip elements externally', - imageUploadTips: 'Since I was using only the vue@1 version, and it is not compatible with mockjs at the moment, I modified it myself, and if you are going to use it, it is better to use official version.' - }, - table: { - dynamicTips1: 'Fixed header, sorted by header order', - dynamicTips2: 'Not fixed header, sorted by click order', - dragTips1: 'The default order', - dragTips2: 'The after dragging order', - title: 'Title', - importance: 'Imp', - type: 'Type', - remark: 'Remark', - search: 'Search', - add: 'Add', - export: 'Export', - reviewer: 'reviewer', - id: 'ID', - date: 'Date', - author: 'Author', - readings: 'Readings', - status: 'Status', - actions: 'Actions', - edit: 'Edit', - publish: 'Publish', - draft: 'Draft', - delete: 'Delete', - cancel: 'Cancel', - confirm: 'Confirm' - }, - errorLog: { - tips: 'Please click the bug icon in the upper right corner', - description: 'Now the management system are basically the form of the spa, it enhances the user experience, but it also increases the possibility of page problems, a small negligence may lead to the entire page deadlock. Fortunately Vue provides a way to catch handling exceptions, where you can handle errors or report exceptions.', - documentation: 'Document introduction' - }, - excel: { - export: 'Export', - selectedExport: 'Export Selected Items', - placeholder: 'Please enter the file name(default excel-list)' - }, - zip: { - export: 'Export', - placeholder: 'Please enter the file name(default file)' - }, - pdf: { - tips: 'Here we use window.print() to implement the feature of downloading pdf.' - }, - theme: { - change: 'Change Theme', - documentation: 'Theme documentation', - tips: 'Tips: It is different from the theme-pick on the navbar is two different skinning methods, each with different application scenarios. Refer to the documentation for details.' - }, - tagsView: { - refresh: 'Refresh', - close: 'Close', - closeOthers: 'Close Others', - closeAll: 'Close All' - }, - settings: { - title: 'Page style setting', - theme: 'Theme Color', - tagsView: 'Open Tags-View', - fixedHeader: 'Fixed Header', - sidebarLogo: 'Sidebar Logo' - } -} diff --git a/src/lang/es.js b/src/lang/es.js deleted file mode 100755 index 89a9e9d3..00000000 --- a/src/lang/es.js +++ /dev/null @@ -1,172 +0,0 @@ -export default { - route: { - dashboard: 'Panel de control', - introduction: 'Introducción', - documentation: 'Documentación', - guide: 'Guía', - permission: 'Permisos', - rolePermission: 'Permisos de rol', - pagePermission: 'Permisos de la página', - directivePermission: 'Permisos de la directiva', - icons: 'Iconos', - components: 'Componentes', - componentIndex: 'Introducción', - tinymce: 'Tinymce', - markdown: 'Markdown', - jsonEditor: 'Editor JSON', - dndList: 'Lista Dnd', - splitPane: 'Panel dividido', - avatarUpload: 'Subir avatar', - dropzone: 'Subir ficheros', - sticky: 'Sticky', - countTo: 'CountTo', - componentMixin: 'Mixin', - backToTop: 'Ir arriba', - dragDialog: 'Drag Dialog', - dragSelect: 'Drag Select', - dragKanban: 'Drag Kanban', - charts: 'Gráficos', - keyboardChart: 'Keyboard Chart', - lineChart: 'Gráfico de líneas', - mixChart: 'Mix Chart', - example: 'Ejemplo', - nested: 'Rutas anidadass', - menu1: 'Menu 1', - 'menu1-1': 'Menu 1-1', - 'menu1-2': 'Menu 1-2', - 'menu1-2-1': 'Menu 1-2-1', - 'menu1-2-2': 'Menu 1-2-2', - 'menu1-3': 'Menu 1-3', - menu2: 'Menu 2', - Table: 'Tabla', - dynamicTable: 'Tabla dinámica', - dragTable: 'Arrastrar tabla', - inlineEditTable: 'Editor', - complexTable: 'Complex Table', - tab: 'Pestaña', - form: 'Formulario', - createArticle: 'Crear artículo', - editArticle: 'Editar artículo', - articleList: 'Listado de artículos', - errorPages: 'Páginas de error', - page401: '401', - page404: '404', - errorLog: 'Registro de errores', - excel: 'Excel', - exportExcel: 'Exportar a Excel', - selectExcel: 'Export seleccionado', - mergeHeader: 'Merge Header', - uploadExcel: 'Subir Excel', - zip: 'Zip', - pdf: 'PDF', - exportZip: 'Exportar a Zip', - theme: 'Tema', - clipboardDemo: 'Clipboard', - i18n: 'I18n', - externalLink: 'Enlace externo' - }, - navbar: { - logOut: 'Salir', - dashboard: 'Panel de control', - github: 'Github', - theme: 'Tema', - size: 'Tamaño global' - }, - login: { - title: 'Formulario de acceso', - logIn: 'Acceso', - username: 'Usuario', - password: 'Contraseña', - any: 'nada', - thirdparty: 'Conectar con', - thirdpartyTips: 'No se puede simular en local, así que combine su propia simulación de negocios. ! !' - }, - documentation: { - documentation: 'Documentación', - github: 'Repositorio Github' - }, - permission: { - addRole: 'Nuevo rol', - editPermission: 'Permiso de edición', - roles: 'Tus permisos', - switchRoles: 'Cambiar permisos', - tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.', - delete: 'Borrar', - confirm: 'Confirmar', - cancel: 'Cancelar' - }, - guide: { - description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', - button: 'Ver guía' - }, - components: { - documentation: 'Documentación', - tinymceTips: 'Rich text editor is a core part of management system, but at the same time is a place with lots of problems. In the process of selecting rich texts, I also walked a lot of detours. The common rich text editors in the market are basically used, and the finally chose Tinymce. See documentation for more detailed rich text editor comparisons and introductions.', - dropzoneTips: 'Because my business has special needs, and has to upload images to qiniu, so instead of a third party, I chose encapsulate it by myself. It is very simple, you can see the detail code in @/components/Dropzone.', - stickyTips: 'when the page is scrolled to the preset position will be sticky on the top.', - backToTopTips1: 'When the page is scrolled to the specified position, the Back to Top button appears in the lower right corner', - backToTopTips2: 'You can customize the style of the button, show / hide, height of appearance, height of the return. If you need a text prompt, you can use element-ui el-tooltip elements externally', - imageUploadTips: 'Since I was using only the vue@1 version, and it is not compatible with mockjs at the moment, I modified it myself, and if you are going to use it, it is better to use official version.' - }, - table: { - dynamicTips1: 'Fixed header, sorted by header order', - dynamicTips2: 'Not fixed header, sorted by click order', - dragTips1: 'Orden por defecto', - dragTips2: 'The after dragging order', - title: 'Título', - importance: 'Importancia', - type: 'Tipo', - remark: 'Remark', - search: 'Buscar', - add: 'Añadir', - export: 'Exportar', - reviewer: 'reviewer', - id: 'ID', - date: 'Fecha', - author: 'Autor', - readings: 'Lector', - status: 'Estado', - actions: 'Acciones', - edit: 'Editar', - publish: 'Publicar', - draft: 'Draft', - delete: 'Eliminar', - cancel: 'Cancelar', - confirm: 'Confirmar' - }, - errorLog: { - tips: 'Please click the bug icon in the upper right corner', - description: 'Now the management system are basically the form of the spa, it enhances the user experience, but it also increases the possibility of page problems, a small negligence may lead to the entire page deadlock. Fortunately Vue provides a way to catch handling exceptions, where you can handle errors or report exceptions.', - documentation: 'Documento de introducción' - }, - excel: { - export: 'Exportar', - selectedExport: 'Exportar seleccionados', - placeholder: 'Por favor escribe un nombre de fichero' - }, - zip: { - export: 'Exportar', - placeholder: 'Por favor escribe un nombre de fichero' - }, - pdf: { - tips: 'Here we use window.print() to implement the feature of downloading pdf.' - }, - theme: { - change: 'Cambiar tema', - documentation: 'Documentación del tema', - tips: 'Tips: It is different from the theme-pick on the navbar is two different skinning methods, each with different application scenarios. Refer to the documentation for details.' - }, - tagsView: { - refresh: 'Actualizar', - close: 'Cerrar', - closeOthers: 'Cerrar otros', - closeAll: 'Cerrar todos' - }, - settings: { - title: 'Page style setting', - theme: 'Theme Color', - tagsView: 'Open Tags-View', - fixedHeader: 'Fixed Header', - sidebarLogo: 'Sidebar Logo' - } -} diff --git a/src/lang/index.js b/src/lang/index.js deleted file mode 100644 index 7c9c8af6..00000000 --- a/src/lang/index.js +++ /dev/null @@ -1,36 +0,0 @@ -import Vue from 'vue' -import VueI18n from 'vue-i18n' -import Cookies from 'js-cookie' -import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang -import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang -import elementEsLocale from 'element-ui/lib/locale/lang/es'// element-ui lang -import enLocale from './en' -import zhLocale from './zh' -import esLocale from './es' - -Vue.use(VueI18n) - -const messages = { - en: { - ...enLocale, - ...elementEnLocale - }, - zh: { - ...zhLocale, - ...elementZhLocale - }, - es: { - ...esLocale, - ...elementEsLocale - } -} - -const i18n = new VueI18n({ - // set locale - // options: en | zh | es - locale: Cookies.get('language') || 'en', - // set locale messages - messages -}) - -export default i18n diff --git a/src/lang/zh.js b/src/lang/zh.js deleted file mode 100644 index 702725cd..00000000 --- a/src/lang/zh.js +++ /dev/null @@ -1,172 +0,0 @@ -export default { - route: { - dashboard: '首页', - introduction: '简述', - documentation: '文档', - guide: '引导页', - permission: '权限测试页', - rolePermission: '角色权限', - pagePermission: '页面权限', - directivePermission: '指令权限', - icons: '图标', - components: '组件', - componentIndex: '介绍', - tinymce: '富文本编辑器', - markdown: 'Markdown', - jsonEditor: 'JSON编辑器', - dndList: '列表拖拽', - splitPane: 'Splitpane', - avatarUpload: '头像上传', - dropzone: 'Dropzone', - sticky: 'Sticky', - countTo: 'CountTo', - componentMixin: '小组件', - backToTop: '返回顶部', - dragDialog: '拖拽 Dialog', - dragSelect: '拖拽 Select', - dragKanban: '可拖拽看板', - charts: '图表', - keyboardChart: '键盘图表', - lineChart: '折线图', - mixChart: '混合图表', - example: '综合实例', - nested: '路由嵌套', - menu1: '菜单1', - 'menu1-1': '菜单1-1', - 'menu1-2': '菜单1-2', - 'menu1-2-1': '菜单1-2-1', - 'menu1-2-2': '菜单1-2-2', - 'menu1-3': '菜单1-3', - menu2: '菜单2', - Table: 'Table', - dynamicTable: '动态Table', - dragTable: '拖拽Table', - inlineEditTable: 'Table内编辑', - complexTable: '综合Table', - tab: 'Tab', - form: '表单', - createArticle: '创建文章', - editArticle: '编辑文章', - articleList: '文章列表', - errorPages: '错误页面', - page401: '401', - page404: '404', - errorLog: '错误日志', - excel: 'Excel', - exportExcel: '导出 Excel', - selectExcel: '导出 已选择项', - mergeHeader: '导出 多级表头', - uploadExcel: '上传 Excel', - zip: 'Zip', - pdf: 'PDF', - exportZip: 'Export Zip', - theme: '换肤', - clipboardDemo: 'Clipboard', - i18n: '国际化', - externalLink: '外链' - }, - navbar: { - logOut: '退出登录', - dashboard: '首页', - github: '项目地址', - theme: '换肤', - size: '布局大小' - }, - login: { - title: '系统登录', - logIn: '登录', - username: '账号', - password: '密码', - any: '随便填', - thirdparty: '第三方登录', - thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!' - }, - documentation: { - documentation: '文档', - github: 'Github 地址' - }, - permission: { - addRole: '新增角色', - editPermission: '编辑权限', - roles: '你的权限', - switchRoles: '切换权限', - tips: '在某些情况下,不适合使用 v-permission。例如:Element-UI 的 Tab 组件或 el-table-column 以及其它动态渲染 dom 的场景。你只能通过手动设置 v-if 来实现。', - delete: '删除', - confirm: '确定', - cancel: '取消' - }, - guide: { - description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于', - button: '打开引导' - }, - components: { - documentation: '文档', - tinymceTips: '富文本是管理后台一个核心的功能,但同时又是一个有很多坑的地方。在选择富文本的过程中我也走了不少的弯路,市面上常见的富文本都基本用过了,最终权衡了一下选择了Tinymce。更详细的富文本比较和介绍见', - dropzoneTips: '由于我司业务有特殊需求,而且要传七牛 所以没用第三方,选择了自己封装。代码非常的简单,具体代码你可以在这里看到 @/components/Dropzone', - stickyTips: '当页面滚动到预设的位置会吸附在顶部', - backToTopTips1: '页面滚动到指定位置会在右下角出现返回顶部按钮', - backToTopTips2: '可自定义按钮的样式、show/hide、出现的高度、返回的位置 如需文字提示,可在外部使用Element的el-tooltip元素', - imageUploadTips: '由于我在使用时它只有vue@1版本,而且和mockjs不兼容,所以自己改造了一下,如果大家要使用的话,优先还是使用官方版本。' - }, - table: { - dynamicTips1: '固定表头, 按照表头顺序排序', - dynamicTips2: '不固定表头, 按照点击顺序排序', - dragTips1: '默认顺序', - dragTips2: '拖拽后顺序', - title: '标题', - importance: '重要性', - type: '类型', - remark: '点评', - search: '搜索', - add: '添加', - export: '导出', - reviewer: '审核人', - id: '序号', - date: '时间', - author: '作者', - readings: '阅读数', - status: '状态', - actions: '操作', - edit: '编辑', - publish: '发布', - draft: '草稿', - delete: '删除', - cancel: '取 消', - confirm: '确 定' - }, - errorLog: { - tips: '请点击右上角bug小图标', - description: '现在的管理后台基本都是spa的形式了,它增强了用户体验,但同时也会增加页面出问题的可能性,可能一个小小的疏忽就导致整个页面的死锁。好在 Vue 官网提供了一个方法来捕获处理异常,你可以在其中进行错误处理或者异常上报。', - documentation: '文档介绍' - }, - excel: { - export: '导出', - selectedExport: '导出已选择项', - placeholder: '请输入文件名(默认excel-list)' - }, - zip: { - export: '导出', - placeholder: '请输入文件名(默认file)' - }, - pdf: { - tips: '这里使用 window.print() 来实现下载pdf的功能' - }, - theme: { - change: '换肤', - documentation: '换肤文档', - tips: 'Tips: 它区别于 navbar 上的 theme-pick, 是两种不同的换肤方法,各自有不同的应用场景,具体请参考文档。' - }, - tagsView: { - refresh: '刷新', - close: '关闭', - closeOthers: '关闭其它', - closeAll: '关闭所有' - }, - settings: { - title: '系统布局配置', - theme: '主题色', - tagsView: '开启 Tags-View', - fixedHeader: '固定 Header', - sidebarLogo: '侧边栏 Logo' - } -} diff --git a/src/main.js b/src/main.js index 375a6b6e..d92dda7b 100644 --- a/src/main.js +++ b/src/main.js @@ -13,7 +13,6 @@ import App from './App' import store from './store' import router from './router' -import i18n from './lang' // Internationalization import './icons' // icon import './permission' // permission control import './utils/errorLog' // error log @@ -26,8 +25,7 @@ import { mockXHR } from '../mock' // simulation data if (process.env.NODE_ENV === 'production') { mockXHR() } Vue.use(Element, { - size: Cookies.get('size') || 'medium', // set element-ui default size - i18n: (key, value) => i18n.t(key, value) + size: Cookies.get('size') || 'medium' // set element-ui default size }) // register global utility filters. @@ -41,6 +39,5 @@ new Vue({ el: '#app', router, store, - i18n, render: h => h(App) }) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 1033d19e..b8e928e7 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -273,15 +273,6 @@ $light_gray:#eee; text-align: center; font-weight: bold; } - - .set-language { - color: #fff; - position: absolute; - top: 3px; - font-size: 18px; - right: 0px; - cursor: pointer; - } } .show-pwd { diff --git a/src/views/permission/role.vue b/src/views/permission/role.vue index 9ca98fa6..38e085e5 100644 --- a/src/views/permission/role.vue +++ b/src/views/permission/role.vue @@ -63,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: '', @@ -101,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 = []