diff --git a/src/config/http.js b/src/config/http.js index b02cce6..94718e6 100644 --- a/src/config/http.js +++ b/src/config/http.js @@ -2,6 +2,7 @@ import axios from 'axios' import { Dialog } from './utils.js' import store from '../vuex/store' import router from '@/router' +import i18n from '../i18n/i18n' axios.defaults.timeout = 50000 axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' @@ -19,6 +20,7 @@ axios.interceptors.request.use( config.data = config.data.formData } } + config.headers.post['Accept-Language'] = i18n.locale === 'en-us' ? 'en' : 'zh' return config }, error => { diff --git a/src/i18n/langs/en.js b/src/i18n/langs/en.js index eff18a5..c01f03b 100644 --- a/src/i18n/langs/en.js +++ b/src/i18n/langs/en.js @@ -3,9 +3,11 @@ module.exports = { passwordlogin: 'Login', configuration: 'Configuration', password: 'Password', - domainnameaddress: 'Domain address', - refreshtime: 'Refresh time(s)', - login: 'Login' + domainnameaddress: 'Domain Address', + refreshtime: 'Refresh Time(s)', + login: 'Login', + toast1: 'Please enter one user name', + toast2: 'Please enter password' }, homeinfo: { topinfo: 'Device Information', @@ -44,71 +46,78 @@ module.exports = { solution: 'Solution' }, user: { - usermanagement: 'User management', - fullname: 'Full name', + usermanagement: 'User Management', + fullname: 'Full Name', phone: 'Phone', gender: 'Gender', - creationdate: 'Creation date', - adduser: 'Add user', + creationdate: 'Creation Date', + adduser: 'Add User', question1: 'Are you sure you want to reset your password?', - question2: 'Are you sure you want to delete this user?' + question2: 'Are you sure you want to delete this user?', + toast1: 'The username cannot be empty', + toast2: 'Password cannot be empty' }, role: { - rolemanagement: 'Role management', - rolename: 'Role name', + rolemanagement: 'Role Management', + rolename: 'Role Name', role: 'Role', describe: 'Describe', - creationdate: 'Creation date', - addrole: 'Add role' + creationdate: 'Creation Date', + addrole: 'Add Role', + toast1: 'Role name cannot be empty' }, system: { - systemmanagement: 'System management', + systemmanagement: 'System Management', code: 'Code', value: 'Value', - addparameter: 'Add parameter', - question1: 'Are you sure to delete it?' + addparameter: 'Add Parameter', + question1: 'Are you sure to delete it?', + toast1: 'Encoding cannot be empty', + toast2: 'Name cannot be empty', + toast3: 'Value cannot be empty' }, developer: { - developeroptions: 'Developer options' + developeroptions: 'Developer Options' }, vehiclestatus: { - vehiclestatus: 'Vehicle status', + vehiclestatus: 'Vehicle Status', status: 'Status', - coordinate: 'coordinate', - headingangle: 'Heading angle', - steeringwheelangle: 'Steering wheel angle', - distributionspeed: 'Distribution speed', - actualspeed: 'Actual speed', - lateraldeviation: 'Lateral deviation', - coursedeviation: 'Course deviation', - workingstatus: 'Working status', - sensorstatus: 'Sensor status', - emergencystop: 'Emergency stop', - obstacleavoidancedeceleration: 'Obstacle avoidance deceleration', - resetbutton: 'Reset button', - obstacleavoidanceparking: 'Obstacle avoidance parking', - safetyedgesensor: 'Safety edge sensor', + coordinate: 'Coordinate', + headingangle: 'Heading Angle', + steeringwheelangle: 'Steering Wheel Angle', + distributionspeed: 'Distribution Speed', + actualspeed: 'Actual Speed', + lateraldeviation: 'Lateral Deviation', + coursedeviation: 'Course Deviation', + workingstatus: 'Working Status', + sensorstatus: 'Sensor Status', + emergencystop: 'Emergency Stop', + obstacleavoidancedeceleration: 'Obstacle Avoidance Deceleration', + resetbutton: 'Reset Button', + obstacleavoidanceparking: 'Obstacle Avoidance Parking', + safetyedgesensor: 'Safety Edge Sensor', run: 'Run', abnormal: 'Abnormal' }, vehiclecontrol: { - vehiclecontrol: 'Vehicle control', - Status: 'Status', - Control: 'Control', - control: ' control', - deviationstate: 'Deviation state', - updatestatus: 'Update status', - displaycontrol: 'Display control', - initializecoordinates: 'Initialize coordinates', - coordinateinformation: 'Coordinate information', - skipthestart: 'Skip the start', - initializecoordinate: 'Initialize coordinate', - fullscreen: 'Full screen', + vehiclecontrol: 'Vehicle Control', + status: 'Status', + control: ' Control', + deviationstate: 'Deviation State', + updatestatus: 'Update Status', + displaycontrol: 'Display Control', + initializecoordinates: 'Initialize Coordinates', + coordinateinformation: 'Coordinate Information', + skipthestart: 'Skip The Start', + initializecoordinate: 'Initialize Coordinate', + fullscreen: 'Full Screen', quit: 'Quit', poweroff: 'Power Off', - softwarerestart: 'Software restart', + softwarerestart: 'Software Restart', restart: 'Restart', - skipdetection: 'Skip detection' + skipdetection: 'Skip Detection', + toast1: 'Please select coordinates', + toast2: 'RC control and Joy control cannot be turned on simultaneously' }, button: { cancel: 'Cancel', @@ -117,17 +126,22 @@ module.exports = { modify: 'Modify', delete: 'Delete', exit: 'Exit', - resetpassword: 'Reset password' + resetpassword: 'Reset Password' }, common: { name: 'Name', - username: 'User name', + username: 'User Name', number: 'S/N', operate: 'Operate', remark: 'Remark', - changepassword: 'Change password', + changepassword: 'Change Password', exit: 'Exit', - oldpassword: 'Old password', - newpassword: 'New password' + oldpassword: 'Old Password', + newpassword: 'New Password', + operationfailed: 'Operation failed', + toast1: 'Old password cannot be empty', + toast2: 'The new password cannot be empty', + toast3: 'Enter a new password', + toast4: 'The new password input is inconsistent, please re-enter it' } } diff --git a/src/i18n/langs/zh.js b/src/i18n/langs/zh.js index 45b4bf4..13e2de7 100644 --- a/src/i18n/langs/zh.js +++ b/src/i18n/langs/zh.js @@ -5,7 +5,9 @@ module.exports = { password: '密码', domainnameaddress: '域名地址', refreshtime: '刷新时间(秒)', - login: '登录' + login: '登录', + toast1: '请输入用户名', + toast2: '请输入密码' }, homeinfo: { topinfo: '设备信息', @@ -51,7 +53,9 @@ module.exports = { creationdate: '创建日期', adduser: '添加用户', question1: '确定重置密码吗?', - question2: '确定删除该用户吗?' + question2: '确定删除该用户吗?', + toast1: '用户名不能为空', + toast2: '密码不能为空' }, role: { rolemanagement: '角色管理', @@ -59,14 +63,18 @@ module.exports = { role: '角色', describe: '描述', creationdate: '创建日期', - addrole: '新增角色' + addrole: '新增角色', + toast1: '角色名称不能为空' }, system: { systemmanagement: '系统管理', code: '编码', value: '值', addparameter: '添加参数', - question1: '确定删除吗?' + question1: '确定删除吗?', + toast1: '编码不能为空', + toast2: '名字不能为空', + toast3: '数值不能为空' }, developer: { developeroptions: '开发者选项' @@ -93,8 +101,7 @@ module.exports = { }, vehiclecontrol: { vehiclecontrol: '车辆控制', - Status: '状态', - Control: '控制', + status: '状态', control: '控制', deviationstate: '偏离状态', updatestatus: '更新状态', @@ -108,7 +115,9 @@ module.exports = { poweroff: '关机', softwarerestart: '软启动', restart: '重启', - skipdetection: '跳过检测' + skipdetection: '跳过检测', + toast1: '请选择坐标', + toast2: 'RC控制与Joy控制不能同时开启' }, button: { cancel: '取消', @@ -128,6 +137,11 @@ module.exports = { changepassword: '修改密码', exit: '退出', oldpassword: '旧的密码', - newpassword: '新的密码' + newpassword: '新的密码', + operationfailed: '操作失败', + toast1: '旧密码不能为空', + toast2: '新密码不能为空', + toast3: '输入新密码', + toast4: '新密码输入不一致,请重新输入' } } diff --git a/src/pages/modules/login/login.vue b/src/pages/modules/login/login.vue index edd9679..0863b89 100644 --- a/src/pages/modules/login/login.vue +++ b/src/pages/modules/login/login.vue @@ -135,12 +135,14 @@ export default { saveLogin () { this.disabled = true if (!this.username) { - this.toast('请输入用户名') + // this.toast('请输入用户名') + this.toast(this.$t('login.toast1')) this.disabled = false return } if (!this.password) { - this.toast('请输入密码') + // this.toast('请输入密码') + this.toast(this.$t('login.toast2')) this.disabled = false return } diff --git a/src/pages/modules/systemmanage/developer.vue b/src/pages/modules/systemmanage/developer.vue index 7f17ee4..64ed9da 100644 --- a/src/pages/modules/systemmanage/developer.vue +++ b/src/pages/modules/systemmanage/developer.vue @@ -49,9 +49,9 @@ export default { }, computed: { tabs () { - let arr = [{id: '1', label: 'ifconfig'}, {id: '2', label: '日志列表'}, {id: '3', label: 'ROS运行列表'}, {id: '4', label: '芯片温度/主频'}, {id: '5', label: '调试信息'}, {id: '6', label: '软/硬件版本'}] + let arr = [{id: '1', label: 'Ifconfig'}, {id: '2', label: '日志列表'}, {id: '3', label: 'ROS运行列表'}, {id: '4', label: '芯片温度/主频'}, {id: '5', label: '调试信息'}, {id: '6', label: '软/硬件版本'}] if (this.$i18n.locale === 'en-us') { - arr = [{id: '1', label: 'ifconfig'}, {id: '2', label: 'Log list'}, {id: '3', label: 'ROS run list'}, {id: '4', label: 'Chip temperature/main frequency'}, {id: '5', label: 'Debugging information'}, {id: '6', label: 'Software/Hardware Version'}] + arr = [{id: '1', label: 'Ifconfig'}, {id: '2', label: 'Log List'}, {id: '3', label: 'ROS Run List'}, {id: '4', label: 'Chip Temperature/Main Frequency'}, {id: '5', label: 'Debugging Information'}, {id: '6', label: 'Software/Hardware Version'}] } return arr } @@ -163,7 +163,7 @@ export default { z-index 2 .tabs_item padding 0 10px - width 200px + width 202px height 46px box-sizing border-box line-height 46px diff --git a/src/pages/modules/systemmanage/role.vue b/src/pages/modules/systemmanage/role.vue index 5037a5a..e51e382 100644 --- a/src/pages/modules/systemmanage/role.vue +++ b/src/pages/modules/systemmanage/role.vue @@ -1,6 +1,5 @@