diff --git a/components/Map.vue b/components/Map.vue
index 4150bd1..a99ce72 100644
--- a/components/Map.vue
+++ b/components/Map.vue
@@ -20,11 +20,6 @@ const mapLayerTypeToPointIcon = {
}
export default {
- async asyncData({ $axios }) {
- const { data } = await $axios.$get('http://101.43.201.20:5000/api/Home/view');
- return { pageTitle: data.home.title }; // 假设接口返回格式为 { data: '标题内容' }
- },
-
name: "Map",
data () {
return {
@@ -41,18 +36,23 @@ export default {
default: 'big'
}
},
- mounted() {
- this.$nextTick(() => {
- if (this.$refs.mapRef) {
- const win = window.top
- this.$http.get('http://101.43.201.20:5000/api/Home/view').then(({ data }) => {
- win.document.title = data.home.title
- this.setTitle(data.home.title)
- this.setInfo(data)
- this.initMap(data.home.center)
- })
+ watch: {
+ info: {
+ immediate: true,
+ deep: true,
+ handler (info) {
+ if (info) {
+ this.$nextTick(() => {
+ if (this.$refs.mapRef) {
+ this.initMap(info.home.center)
+ }
+ })
+ }
}
- })
+ }
+ },
+
+ mounted() {
this.$evBus.$on('setVisibility', (layerType, show) => {
this.setVisibility(layerType, show)
})
@@ -70,6 +70,7 @@ export default {
shisc: state => state.map.shisc,
wz: state => state.map.wz,
jkd: state => state.map.jkd,
+ info: state => state.system.info
})
},
methods: {
@@ -79,7 +80,6 @@ export default {
const { lon, lat } = center
ms3dConfig.scene.center.lng = lon
ms3dConfig.scene.center.lat = lat
- console.log('ms3dConfig:', ms3dConfig);
this.map = new mars3d.Map(this.$refs.mapRef, ms3dConfig)
this.map.on("load", () => {
Object.keys(mapLayerTypeToPointIcon).forEach(layerType => {
diff --git a/components/smallCommon/ProgressDesc.vue b/components/smallCommon/ProgressDesc.vue
index 07ba0ed..287fd1f 100644
--- a/components/smallCommon/ProgressDesc.vue
+++ b/components/smallCommon/ProgressDesc.vue
@@ -5,7 +5,7 @@
- {{ item.val * 100 }}
+ {{ (item.val * 100).toFixed(0) }}
%
diff --git a/layouts/default.vue b/layouts/default.vue
new file mode 100644
index 0000000..dc04802
--- /dev/null
+++ b/layouts/default.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layouts/loginLayout.vue b/layouts/loginLayout.vue
new file mode 100644
index 0000000..c8fc5ee
--- /dev/null
+++ b/layouts/loginLayout.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/cleanTravel/home.vue b/pages/cleanTravel/home.vue
index a60e5fc..28d61fb 100644
--- a/pages/cleanTravel/home.vue
+++ b/pages/cleanTravel/home.vue
@@ -2,7 +2,7 @@
-
+
@@ -269,12 +269,6 @@ export default {
this.getDataSource()
this.$nextTick(() => {
const win = window.top
- this.$get('http://101.43.201.20:5000/api/Home/view').then(({data}) => {
- win.document.title = data.home.title
- this.setTitle(data.home.title)
- this.setInfo(data)
- })
-
if (this.$refs.module) {
const offsetHeight = this.$refs.module.$el.offsetHeight - 40
this.tableH = offsetHeight
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 7f441f8..e32f00e 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -41,8 +41,8 @@
清洁运输比例
- 昨日
- 上周
+ 昨日
+ 上周
@@ -57,10 +57,10 @@
当前VOC的日排放量
-
{{ todaypf.voc || 0 }}mg/m3
+
{{ todaypf.today?.voc || 0 }}mg/m3
当前CEMS的日排放量
-
{{ todaypf.cems || 0 }}mg/m3
+
{{ todaypf.today?.cems || 0 }}mg/m3
@@ -261,7 +261,7 @@ export default {
data () {
return {
mapTab: 'rl',
- active: 'Yesterday',
+ active: 'yesterday',
columnsForTable: [
{
@@ -271,12 +271,12 @@ export default {
},
{
title: '报警时间',
- dataIndex: 'CreateDateTime',
+ dataIndex: 'time',
width: '33.333%'
},
{
title: '报警内容',
- dataIndex: 'AlertContent',
+ dataIndex: 'alarmName',
width: '33.333%'
},
]
diff --git a/pages/manager/login.vue b/pages/manager/login.vue
index 2a10971..a2f2d98 100644
--- a/pages/manager/login.vue
+++ b/pages/manager/login.vue
@@ -42,6 +42,7 @@ function hasErrors(fieldsError) {
return Object.keys(fieldsError).some(field => fieldsError[field]);
}
export default {
+ layout: 'LoginLayout',
data() {
return {
hasErrors,
diff --git a/pages/wuzuzhi/huanjingzhili.vue b/pages/wuzuzhi/huanjingzhili.vue
index 44a5ad1..0378cef 100644
--- a/pages/wuzuzhi/huanjingzhili.vue
+++ b/pages/wuzuzhi/huanjingzhili.vue
@@ -176,12 +176,6 @@ export default {
mounted() {
this.$nextTick(() => {
const win = window.top
- this.$get('http://101.43.201.20:5000/api/Home/view').then(({data}) => {
- win.document.title = data.home.title
- this.setTitle(data.home.title)
- this.setInfo(data)
- })
-
if (this.$refs.module) {
const offsetHeight = this.$refs.module.$el.offsetHeight - 40
this.tableH = offsetHeight
diff --git a/plugins/setup.js b/plugins/setup.js
index 280e82b..5757bf9 100644
--- a/plugins/setup.js
+++ b/plugins/setup.js
@@ -1,4 +1,3 @@
import Vue from 'vue'
-
Vue.prototype.$evBus = new Vue()
diff --git a/store/system.js b/store/system.js
index 1b507a2..3077f5b 100644
--- a/store/system.js
+++ b/store/system.js
@@ -1,6 +1,6 @@
export const state = {
title: '',
- info: {}
+ info: null
}
export const mutations = {
@@ -15,8 +15,10 @@ export const mutations = {
export const actions = {
setTitle ({ commit }, title) {
commit('setTitle', title)
+ document.title = title
},
- setInfo ({ commit }, info) {
+ setInfo ({ commit, dispatch }, info) {
commit('setInfo', info)
+ dispatch('setTitle', info.home?.title || '')
}
}
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..1039330
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,9 @@
+
+const path = require('path');
+module.exports = {
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, './'),
+ }
+ }
+};