Browse Source

优化

master
4670101279 10 months ago
parent
commit
bb4e4c8897
  1. 18756
      package-lock.json
  2. 2
      src/layout/components/Navbar.vue
  3. 2
      src/utils/auth.js
  4. 108
      src/views/index.vue

18756
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
src/layout/components/Navbar.vue

@ -128,7 +128,7 @@ export default { @@ -128,7 +128,7 @@ export default {
}
.navbar {
height: 100px;
height: 50px;
overflow: hidden;
position: relative;
background: #fff;

2
src/utils/auth.js

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
const TokenKey = 'Water-Monitor-Token'
export function getToken() {
return Cookies.get(TokenKey)

108
src/views/index.vue

@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
</div>
<!-- 地图 -->
<div id="container" style="height: 840px;width: 100%"></div>
<div id="container" style="width: 100%"></div>
<!-- 放大图片 -->
<transition name="fade">
<div id="mask" v-show="showMask" @click="showMask = false">
@ -88,6 +88,16 @@ @@ -88,6 +88,16 @@
</div>
</div>
</template>
<style>
/*去掉百度地图logo*/
.BMap_cpyCtrl {
display: none;
}
.anchorBL {
display: none;
}
</style>
<script>
import echarts from 'echarts'
import "../utils/flexible"
@ -146,7 +156,7 @@ export default { @@ -146,7 +156,7 @@ export default {
},
mounted() {
// 5
this.getList()
this.init()
// setInterval(this.getList(), 300000)
this.setMap()
this.setTime()
@ -157,56 +167,52 @@ export default { @@ -157,56 +167,52 @@ export default {
},
methods: {
//
async getList() {
init(){
this.get1().then(()=>{
//
let show = this.showLevel.filter(item => item.flag)
let id = show.length? show.map(item => item.id).join(): this.showLevel[0].id
this.get1_2(id)
});
this.get2();
this.get3();
},
async get1() {
//
fetch(this.api+'info')
.then(e => e.json())
.then(e => {
this.station = e
e.forEach(station => {
if(this.showLevel.some(item => item.id == station.id)) return
this.showLevel.push({
id: station.id,
stnm: station.stnm,
flag: this.showLevel.filter(e => e.flag).length<5? true: false
})
let res = await this.$axiosGet('/api/daping/station/info');
if(res.code == 0){
this.station = res.data;
for (var i = 0; i < this.station.length; i++) {
let station = this.station[i];
if(this.showLevel.some(item => item.id == station.id)) return
this.showLevel.push({
id: station.id,
stnm: station.stnm,
flag: this.showLevel.filter(e => e.flag).length<5? true: false
})
}
//
let show = this.showLevel.filter(item => item.flag)
let id = show.length? show.map(item => item.id).join(): this.showLevel[0].id
fetch(this.api + 'waterLevelTrend?ids=' + id)
.then(e => e.json())
.then(e => {
this.level = e.data
this.setLine()
})
.catch(e => { console.error(e) })
this.setMarks()
this.playInfobox()
this.setTable()
})
.catch(e => { console.error(e) })
// 线
fetch(this.api + 'status')
.then(e => e.json())
.then(e => {
this.status = e.data
this.setPie()
})
.catch(e => { console.error(e) })
//
fetch(this.api + 'count')
.then(e => e.json())
.then(e => {
this.dist.stnms = e.data.stnms
this.dist.values[0].value = e.data.zx
this.dist.values[1].value = e.data.lx
this.setDist()
})
.catch(e => { console.error(e) })
return this.getList
this.setMarks()
this.playInfobox()
this.setTable()
}
},
async get1_2(id){
let res = await this.$axiosGet('/api/daping/station/waterLevelTrend?ids='+id);
this.level = res.data
this.setLine()
},
async get2(){
let res = await this.$axiosGet('/api/daping/station/status');
this.status = res.data
this.setPie()
},
async get3(){
let res = await this.$axiosGet('/api/daping/station/count');
this.dist.stnms = res.data.stnms
this.dist.values[0].value = res.data.zx
this.dist.values[1].value = res.data.lx
this.setDist()
},
//
setTime() {
@ -667,7 +673,7 @@ export default { @@ -667,7 +673,7 @@ export default {
<style scoped>
.app-container{
height: 840px;
height: calc(100vh - 50px);
width: 100%;
}
.network_show{
@ -740,7 +746,7 @@ export default { @@ -740,7 +746,7 @@ export default {
#container {
position: absolute;
width: 100%;
height: 100%;
height: calc(100vh - 50px);
}
/* 去logo */
.BMap_cpyCtrl {

Loading…
Cancel
Save