Browse Source

fix:解决前端部署生产报错

pull/12/head
高森 4 years ago
parent
commit
3a8d041d08
4 changed files with 60 additions and 39 deletions
  1. +0
    -34
      webapp/src/App.vue
  2. +41
    -3
      webapp/src/config/index.js
  3. +0
    -1
      webapp/src/views/dataset/list/index.vue
  4. +19
    -1
      webapp/src/views/login.vue

+ 0
- 34
webapp/src/App.vue View File

@@ -7,50 +7,16 @@
</template>

<script>
import { dictByName } from '@/api/dict.js';
import { getToken } from '@/utils/auth';
import { TokenKey } from '@/settings';

export default {
name: 'App',
watch: {
$route() {
this.initDic();
},
},
mounted() {
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://s9.cnzz.com/z_stat.php?id=1280834206&web_id=1280834206';
document.getElementsByTagName('head')[0].appendChild(script);
},
created() {
this.initDic();
},
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: 获取缩放值
* @param { Void }


+ 41
- 3
webapp/src/config/index.js View File

@@ -38,7 +38,7 @@ export const API_MODULE_NAME = {

// 登录、注册参数配置
export const loginConfig = {
//allowRegister: process.env.NODE_ENV !== 'production', // 是否允许注册
// allowRegister: process.env.NODE_ENV !== 'production', // 是否允许注册
allowRegister: true, // 是否允许注册
};

@@ -77,9 +77,47 @@ export const atlasConfig = {
};

// 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 编码放回标注类型(数据集数据类型)
export const datasetTypeBy = (valueBy) => (value, key) => {


+ 0
- 1
webapp/src/views/dataset/list/index.vue View File

@@ -363,7 +363,6 @@ import EditDataset from './edit-dataset';
import UploadDataFile from './upload-datafile';
import '../style/list.scss';
import { datasetTypeBy } from '@/config/index';
import { dictByName } from '@/api/dict.js';

const defaultForm = {
id: null,


+ 19
- 1
webapp/src/views/login.vue View File

@@ -157,7 +157,7 @@ import LoginPublic from '@/components/LoginPublic';
import { loginConfig } from '@/config';
import Privacy from './privacy.vue';
import Agreement from './agreement.vue';
import { dictByName } from '@/api/dict.js';
export default {
name: 'Login',
components: {
@@ -269,6 +269,24 @@ export default {
.then(() => {
this.loading = false;
this.$router.push({ path: '/' });

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;
}
});
})
.catch((err) => {
const msg = err.message;


Loading…
Cancel
Save