perf(): 代码优化

master
李神峰 2024-11-12 10:35:55 +08:00
parent 65b159ce06
commit b9e2563c8e
2 changed files with 21 additions and 31 deletions

View File

@ -59,7 +59,7 @@
const warnetm = moment().format("YYYY-MM-DD HH:mm:ss") const warnetm = moment().format("YYYY-MM-DD HH:mm:ss")
import SkInfo from '../skInfo/index.vue' import SkInfo from '../skInfo/index.vue'
import YlzList from '../ylzList/index.vue' import YlzList from '../ylzList/index.vue'
let timer= null; let timer = null;
export default { export default {
components: { components: {
SkInfo, SkInfo,
@ -138,21 +138,19 @@
getYlzList() { getYlzList() {
uni.$http.post('/gunshiApp/xyt/stPptnRReal/list').then(res => { uni.$http.post('/gunshiApp/xyt/stPptnRReal/list').then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
console.log(this.Ylzlist,'this.Ylzlist');
this.Ylzlist = res.data.data this.Ylzlist = res.data.data
} }
}) })
}, },
getList() { getList() {
console.log(11); uni.$http.post('/gunshiApp/xyt/messageCenter/list', {
uni.$http.post('/gunshiApp/xyt/messageCenter/list', { start: '',
start: '', end: ''
end: '' }).then(res => {
}).then(res => { if (res.data.code == 200) {
if (res.data.code == 200) { this.messagelist = res.data.data
this.messagelist = res.data.data }
} })
})
}, },
todetailmessgae() { todetailmessgae() {
uni.navigateTo({ uni.navigateTo({
@ -249,28 +247,25 @@
}, },
onLoad() { onLoad() {
console.log("走了几遍");
this.getYlzList(); this.getYlzList();
}, },
onShow() { onShow() {
var that = this; var that = this;
that.getList(); that.getList();
timer = setInterval(function() { timer = setInterval(function () {
that.getList(); that.getList();
}, 10000); }, 10000);
this.setInsert() this.setInsert()
this.getXcrwData(); this.getXcrwData();
this.getHandleData(); this.getHandleData();
this.getYjData(); this.getYjData();
}, },
onHide() { onHide() {
console.log(222); clearInterval(timer)
clearInterval(timer) timer = null;
timer = null; },
},
} }
</script> </script>
@ -281,9 +276,9 @@
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
background-color: #f3f5f8; background-color: #f3f5f8;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
} }
.info { .info {
@ -359,12 +354,13 @@
background: #fff; background: #fff;
} }
.warn1 { .warn1 {
padding: 18rpx 20rpx; padding: 18rpx 20rpx;
text-align: left; text-align: left;
// margin-bottom: 12rpx; // margin-bottom: 12rpx;
background: #fff; background: #fff;
} }
.info_24 { .info_24 {
width: 100%; width: 100%;
// position: fixed; // position: fixed;

View File

@ -68,7 +68,6 @@
} }
}, },
mounted() { mounted() {
console.log('小玉潭水库222');
this.getList() this.getList()
this.getDrp() this.getDrp()
}, },
@ -91,13 +90,10 @@
uni.$http.get('/gunshiApp/xyt/reservoir/water/detail?stcd=716164061&_=1731028927554').then(res=>{ uni.$http.get('/gunshiApp/xyt/reservoir/water/detail?stcd=716164061&_=1731028927554').then(res=>{
this.dataform={...this.dataform,...res.data.data} this.dataform={...this.dataform,...res.data.data}
console.log(this.dataform,'drp yesterdayDrp');
}) })
uni.$http.post('/gunshiApp/xyt/reservoir/water/list').then(res=>{ uni.$http.post('/gunshiApp/xyt/reservoir/water/list').then(res=>{
console.log(res,'drp list');
this.dataform={...this.dataform,...res.data.data[0]} this.dataform={...this.dataform,...res.data.data[0]}
console.log(this.dataform,'drp list');
this.tm = res.data.data[0].tm this.tm = res.data.data[0].tm
}) })
uni.$http.post('/gunshiApp/xyt/stWaterRReal/list').then(res=>{ uni.$http.post('/gunshiApp/xyt/stWaterRReal/list').then(res=>{
@ -120,7 +116,6 @@
if(index == 0){ if(index == 0){
this.showImg = item.url this.showImg = item.url
console.log(this.showImg,'this.showImg');
} }
return item}) return item})
} }
@ -140,7 +135,6 @@
}, },
getList(){ getList(){
uni.$http.post('/gunshiApp/xyt/attResBase/list').then(res=>{ uni.$http.post('/gunshiApp/xyt/attResBase/list').then(res=>{
console.log(res.data.data[0]);
this.dataform=res.data.data[0] this.dataform=res.data.data[0]
}) })
}, },