fix: 短临

master
张林 2024-06-27 09:14:38 +08:00
parent 8428ca90ae
commit 044d7e7a1d
2 changed files with 65 additions and 22 deletions

View File

@ -386,7 +386,8 @@ export default {
imgHours: '',
imgHourstm: [],
imgHoursList: {},
interval: null
interval: null,
numPic: 0
}
},
computed: {
@ -511,15 +512,15 @@ export default {
}
})
},
async getHoursImg () {
getTmData () {
let h = moment().format('HH')
let m = moment().format('mm')
console.log('hhh--', h, m)
console.log('hhh--', h, m, this.numPic)
let tms = null,
mm = null
let h1 = Number(h) - 1
if (h1 < 9) {
h1 = Number(h) - 3
h1 = Number(h) - this.numPic
}
if (h1 < 10) {
h1 = `0${h1}`
@ -535,31 +536,73 @@ export default {
tms = `${this.imgtm}${h1}30`
mm = '30'
}
},
async getHoursImg () {
let h = moment().format('HH')
let m = moment().format('mm')
console.log('hhh--', h, m, this.numPic)
let tms = null,
mm = null
let h1 = Number(h) - 1
if (h1 < 9) {
h1 = Number(h) - Number(this.numPic)
}
if (h1 < 10) {
let t = Number(h1) - Number(this.numPic)
h1 = `0${t}`
}
if (m > 30) {
h1 = Number(h) - 1
let t3 = Number(h) - this.numPic
if (this.numPic <= 0) {
tms = `${this.imgtm}${h}30`
} else {
tms = `${this.imgtm}${t3}30`
}
console.log('ddddd', h, h1)
console.log('ddddd', tms)
mm = '30'
} else if (m < 10) {
tms = `${this.imgtm}${h1}00`
mm = '00'
} else {
tms = `${this.imgtm}${h1}30`
mm = '30'
}
console.log('小时', h1)
console.log('需要参数', tms)
uni.request({
url: 'https://shqxjs.cloudowr.cn/service/radar/rainimg',
data: {
tm: tms
},
success: res => {
console.log('000000', tms, res.data.data)
console.log('pic---', tms, res.data.data)
this.imgHoursList = res.data.data.img
let m = moment().format('MM月DD日')
console.log('am222', this.imgHoursList)
let m1 = Number(h1) + 2
this.imgHourstm = [`${m}${h1}${mm}`, `${m}${m1}${mm}`]
if (res.data.data.img == null) {
this.numPic++
setTimeout(() => {
this.getHoursImg()
}, 10 * 1000)
} else {
this.numPic = 0
return
}
}
})
},
async getInterval () {
this.interval = setInterval(() => {
this.getHoursImg()
}, 60 * 1000)
},
// async getInterval () {
// this.interval = setInterval(() => {
// this.getHoursImg()
// }, 60 * 1000)
// },
async getYjRead () {
try {
const { data } = await uni.$http.get(
@ -814,15 +857,15 @@ export default {
this.getReadStatus()
if (this.limit == 1) {
this.getYjRead()
this.getInterval()
// this.getInterval()
this.getImgs()
this.getHoursImg()
}
},
onUnload () {
clearInterval(this.interval)
this.interval = null
}
// onUnload () {
// clearInterval(this.interval)
// this.interval = null
// }
}
</script>

View File

@ -91,10 +91,10 @@ export default {
uni.setStorageSync('loginName', postForm.loginName)
uni.setStorageSync('secretKey', postForm.secretKey)
} else {
// uni.removeStorageSync('loginName')
// uni.removeStorageSync('secretKey')
// this.formData.username = ''
// this.formData.password = ''
uni.removeStorageSync('loginName')
uni.removeStorageSync('secretKey')
this.formData.username = ''
this.formData.password = ''
}
//