| @@ -7,50 +7,15 @@ | |||||
| </template> | </template> | ||||
| <script> | <script> | ||||
| import { dictByName } from '@/api/dict.js'; | |||||
| import { getToken } from '@/utils/auth'; | |||||
| import { TokenKey } from '@/settings'; | |||||
| export default { | export default { | ||||
| name: 'App', | name: 'App', | ||||
| watch: { | |||||
| $route() { | |||||
| this.initDic(); | |||||
| }, | |||||
| }, | |||||
| mounted() { | mounted() { | ||||
| const script = document.createElement('script'); | const script = document.createElement('script'); | ||||
| script.type = 'text/javascript'; | script.type = 'text/javascript'; | ||||
| script.src = 'https://s9.cnzz.com/z_stat.php?id=1280834206&web_id=1280834206'; | script.src = 'https://s9.cnzz.com/z_stat.php?id=1280834206&web_id=1280834206'; | ||||
| document.getElementsByTagName('head')[0].appendChild(script); | document.getElementsByTagName('head')[0].appendChild(script); | ||||
| }, | }, | ||||
| created() { | |||||
| this.initDic(); | |||||
| }, | |||||
| methods: { | methods: { | ||||
| initDic() { | |||||
| if (!getToken(TokenKey)) { | |||||
| return; | |||||
| } | |||||
| // 数据集类型 | |||||
| dictByName('dataset_type').then((res) => { | |||||
| if (res) { | |||||
| this.$store.state.app.datasetType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| // 模型类别 | |||||
| dictByName('model_category').then((res) => { | |||||
| if (res) { | |||||
| this.$store.state.app.modelType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| // 标签类型 | |||||
| dictByName('label_type').then((res) => { | |||||
| if (res) { | |||||
| this.$store.state.app.labelType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| }, | |||||
| /** | /** | ||||
| * @description: 获取缩放值 | * @description: 获取缩放值 | ||||
| * @param { Void } | * @param { Void } | ||||
| @@ -38,7 +38,7 @@ export const API_MODULE_NAME = { | |||||
| // 登录、注册参数配置 | // 登录、注册参数配置 | ||||
| export const loginConfig = { | export const loginConfig = { | ||||
| //allowRegister: process.env.NODE_ENV !== 'production', // 是否允许注册 | |||||
| // allowRegister: process.env.NODE_ENV !== 'production', // 是否允许注册 | |||||
| allowRegister: true, // 是否允许注册 | allowRegister: true, // 是否允许注册 | ||||
| }; | }; | ||||
| @@ -77,9 +77,47 @@ export const atlasConfig = { | |||||
| }; | }; | ||||
| // demo list | // demo list | ||||
| export const algList = []; | |||||
| export const algList = [ | |||||
| { | |||||
| id: 10, | |||||
| auxInfo: '健康状态', | |||||
| }, | |||||
| { | |||||
| id: 11, | |||||
| auxInfo: '安全预警', | |||||
| }, | |||||
| { | |||||
| id: 12, | |||||
| auxInfo: '异常检测', | |||||
| }, | |||||
| { | |||||
| id: 13, | |||||
| auxInfo: '其他', | |||||
| }, | |||||
| ]; | |||||
| export const typeList = []; | |||||
| export const typeList = [ | |||||
| { | |||||
| label: '车端数据', | |||||
| value: 102, | |||||
| code: 102, | |||||
| }, | |||||
| { | |||||
| label: '桩端数据', | |||||
| value: 101, | |||||
| code: 101, | |||||
| }, | |||||
| { | |||||
| label: '实验数据', | |||||
| value: 105, | |||||
| code: 105, | |||||
| }, | |||||
| { | |||||
| label: '其他', | |||||
| value: 106, | |||||
| code: 106, | |||||
| }, | |||||
| ]; | |||||
| // 根据 code 编码放回标注类型(数据集数据类型) | // 根据 code 编码放回标注类型(数据集数据类型) | ||||
| export const datasetTypeBy = (valueBy) => (value, key) => { | export const datasetTypeBy = (valueBy) => (value, key) => { | ||||
| @@ -1,18 +1,9 @@ | |||||
| /* | |||||
| * Copyright 2019-2020 Zheng Jie | |||||
| * | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| * you may not use this file except in compliance with the License. | |||||
| * You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| */ | |||||
| /* * Copyright 2019-2020 Zheng Jie * * Licensed under the Apache License, Version 2.0 (the | |||||
| "License"); * you may not use this file except in compliance with the License. * You may obtain a | |||||
| copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by | |||||
| applicable law or agreed to in writing, software * distributed under the License is distributed on | |||||
| an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See | |||||
| the License for the specific language governing permissions and * limitations under the License. */ | |||||
| <template> | <template> | ||||
| <div class="navbar"> | <div class="navbar"> | ||||
| @@ -23,6 +23,7 @@ import { userMenus } from '@/api/user'; | |||||
| import { getToken } from '@/utils/auth'; // getToken from cookie | import { getToken } from '@/utils/auth'; // getToken from cookie | ||||
| import { updateTitle } from '@/utils'; | import { updateTitle } from '@/utils'; | ||||
| import MinioClient from '@/utils/minIO'; | import MinioClient from '@/utils/minIO'; | ||||
| import { dictByName } from '@/api/dict.js'; | |||||
| import constantRoutes from './routes'; | import constantRoutes from './routes'; | ||||
| const originalPush = VueRouter.prototype.push; | const originalPush = VueRouter.prototype.push; | ||||
| @@ -66,18 +67,6 @@ const loadUserMenus = (next, to) => { | |||||
| // 批量服务 -> SDK服务 | // 批量服务 -> SDK服务 | ||||
| // 在线服务 -> API服务 | // 在线服务 -> API服务 | ||||
| const _res = res.filter((route) => { | const _res = res.filter((route) => { | ||||
| // if (route.name === '云端Serving') { | |||||
| // route.meta.title = '云端部署'; | |||||
| // const list = route.children.filter((item) => !item.hidden); | |||||
| // list.forEach((i) => { | |||||
| // if (i?.meta?.title === '在线服务') { | |||||
| // i.meta.title = 'API服务'; | |||||
| // } | |||||
| // if (i?.meta?.title === '批量服务') { | |||||
| // i.meta.title = 'SDK服务'; | |||||
| // } | |||||
| // }); | |||||
| // } | |||||
| return route.name !== '模型炼知'; | return route.name !== '模型炼知'; | ||||
| }); | }); | ||||
| @@ -104,6 +93,24 @@ router.beforeEach(async (to, from, next) => { | |||||
| const minioClient = await instance.init(); | const minioClient = await instance.init(); | ||||
| window.minioClient = minioClient; | window.minioClient = minioClient; | ||||
| } | } | ||||
| // 获取字典值 | |||||
| dictByName('dataset_type').then((res) => { | |||||
| if (res) { | |||||
| store.state.app.datasetType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| // 模型类别 | |||||
| dictByName('model_category').then((res) => { | |||||
| if (res) { | |||||
| store.state.app.modelType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| // 标签类型 | |||||
| dictByName('label_type').then((res) => { | |||||
| if (res) { | |||||
| store.state.app.labelType = res.dictDetails; | |||||
| } | |||||
| }); | |||||
| // 已登录且要跳转的页面是登录页 | // 已登录且要跳转的页面是登录页 | ||||
| if (to.path === '/login') { | if (to.path === '/login') { | ||||
| next({ path: '/' }); | next({ path: '/' }); | ||||
| @@ -33,7 +33,7 @@ import BatchServingForm from './components/forms/batchServingForm'; | |||||
| const FORM_MAP = { | const FORM_MAP = { | ||||
| onlineServing: { | onlineServing: { | ||||
| title: '在线', | |||||
| title: 'API', | |||||
| listPageName: 'CloudServing', | listPageName: 'CloudServing', | ||||
| submitFunc: { | submitFunc: { | ||||
| add: onlineAdd, | add: onlineAdd, | ||||
| @@ -41,7 +41,7 @@ const FORM_MAP = { | |||||
| }, | }, | ||||
| }, | }, | ||||
| batchServing: { | batchServing: { | ||||
| title: '批量', | |||||
| title: 'SDK', | |||||
| listPageName: 'BatchServing', | listPageName: 'BatchServing', | ||||
| submitFunc: { | submitFunc: { | ||||
| add: batchAdd, | add: batchAdd, | ||||
| @@ -363,7 +363,6 @@ import EditDataset from './edit-dataset'; | |||||
| import UploadDataFile from './upload-datafile'; | import UploadDataFile from './upload-datafile'; | ||||
| import '../style/list.scss'; | import '../style/list.scss'; | ||||
| import { datasetTypeBy } from '@/config/index'; | import { datasetTypeBy } from '@/config/index'; | ||||
| import { dictByName } from '@/api/dict.js'; | |||||
| const defaultForm = { | const defaultForm = { | ||||
| id: null, | id: null, | ||||
| @@ -419,6 +419,9 @@ export default { | |||||
| ? 'Emails cannot be sent more than three times!' | ? 'Emails cannot be sent more than three times!' | ||||
| : '邮件发送不能超过三次!'; | : '邮件发送不能超过三次!'; | ||||
| } | } | ||||
| if (msg === '系统繁忙!') { | |||||
| str = this.$i18n.locale === 'en' ? 'The system is busy!' : '系统繁忙!'; | |||||
| } | |||||
| this.codeLoading = false; | this.codeLoading = false; | ||||
| this.$message({ | this.$message({ | ||||
| message: str || err.message, | message: str || err.message, | ||||
| @@ -34,7 +34,7 @@ the License. * ============================================================= */ | |||||
| > | > | ||||
| <el-form-item prop="email"> | <el-form-item prop="email"> | ||||
| <el-input | <el-input | ||||
| v-model="registerForm.email" | |||||
| v-model.trim="registerForm.email" | |||||
| auto-complete="on" | auto-complete="on" | ||||
| :placeholder="$t('resetPsdEmail')" | :placeholder="$t('resetPsdEmail')" | ||||
| > | > | ||||
| @@ -43,7 +43,7 @@ the License. * ============================================================= */ | |||||
| </el-form-item> | </el-form-item> | ||||
| <el-form-item prop="code"> | <el-form-item prop="code"> | ||||
| <el-input | <el-input | ||||
| v-model="registerForm.code" | |||||
| v-model.trim="registerForm.code" | |||||
| style="width: 57%" | style="width: 57%" | ||||
| :placeholder="$t('resetPsdCode')" | :placeholder="$t('resetPsdCode')" | ||||
| > | > | ||||
| @@ -248,6 +248,17 @@ export default { | |||||
| ? 'The email address format is incorrect' | ? 'The email address format is incorrect' | ||||
| : '邮箱地址格式有误'; | : '邮箱地址格式有误'; | ||||
| } | } | ||||
| if (msg === '邮件发送不能超过三次!') { | |||||
| str = | |||||
| this.$i18n.locale === 'en' | |||||
| ? 'Emails cannot be sent more than three times!' | |||||
| : '邮件发送不能超过三次!'; | |||||
| } | |||||
| if (msg === '系统繁忙!') { | |||||
| str = this.$i18n.locale === 'en' ? 'The system is busy!' : '系统繁忙!'; | |||||
| } | |||||
| this.$message({ | this.$message({ | ||||
| message: str || err.message, | message: str || err.message, | ||||
| type: 'error', | type: 'error', | ||||
| @@ -278,8 +289,31 @@ export default { | |||||
| }) | }) | ||||
| .catch((err) => { | .catch((err) => { | ||||
| this.loading = false; | this.loading = false; | ||||
| const msg = err.message; | |||||
| let str = ''; | |||||
| if (msg === '邮箱验证码已过期!') { | |||||
| str = | |||||
| this.$i18n.locale === 'en' | |||||
| ? 'The email verification code has expired!' | |||||
| : '邮箱验证码已过期!'; | |||||
| } | |||||
| if (msg === '系统繁忙!') { | |||||
| str = this.$i18n.locale === 'en' ? 'The system is busy!' : '系统繁忙!'; | |||||
| } | |||||
| if (msg === '该邮箱未注册!') { | |||||
| str = | |||||
| this.$i18n.locale === 'en' | |||||
| ? 'The email address is not registered!' | |||||
| : '该邮箱未注册!'; | |||||
| } | |||||
| if (msg === '邮箱地址或验证码错误、请重新输入!') { | |||||
| str = | |||||
| this.$i18n.locale === 'en' | |||||
| ? 'Email address or verification code is incorrect, please re-enter it!' | |||||
| : '邮箱地址或验证码错误、请重新输入!'; | |||||
| } | |||||
| this.$message({ | this.$message({ | ||||
| message: err.message, | |||||
| message: str || err.message, | |||||
| type: 'error', | type: 'error', | ||||
| }); | }); | ||||
| }); | }); | ||||