Merge branch 'zyl' of http://xny.yj-3d.com:3000/zhouyulong/electron-4 into zyl
This commit is contained in:
@ -246,7 +246,6 @@ onMounted(() => {
|
||||
weatherData.currWeather = false
|
||||
sunshine.timeBar = item
|
||||
})
|
||||
console.log(timeline, 'klklkl')
|
||||
// timeline.updateTime()
|
||||
// timeline.setCurrBar()
|
||||
})
|
||||
@ -255,15 +254,39 @@ onBeforeUnmount(() => {
|
||||
sunshine && sunshine.remove()
|
||||
timeline && timeline.clear()
|
||||
})
|
||||
let currWeatherData = false
|
||||
var weatherChange = () => {
|
||||
currWeatherData = true
|
||||
if (weatherData.currWeather) {
|
||||
let ss = getCurrentTime()
|
||||
sunshine.timeBar = ss
|
||||
sunshine && (sunshine.timeBar = ss)
|
||||
weatherData.speed = 1
|
||||
sunshine && (sunshine.speed = weatherData.speed)
|
||||
|
||||
timeline.setCurrBar()
|
||||
|
||||
timeline.setSpeed(weatherData.speed)
|
||||
|
||||
//让日期回到当前时间
|
||||
|
||||
weatherData.time = getDateTimeString()
|
||||
timeline.closeChangeDate()
|
||||
|
||||
// sunshine && (sunshine.time = weatherData.time)
|
||||
}
|
||||
}
|
||||
var getDateTimeString = () => {
|
||||
// 创建一个表示当前时间的 Date 对象
|
||||
const now = new Date()
|
||||
// 获取年份
|
||||
const year = now.getFullYear()
|
||||
// 获取月份(从 0 开始,所以要加 1),并将其转换为两位字符串,不足两位在前面补零
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0')
|
||||
// 获取日期,并将其转换为两位字符串,不足两位在前面补零
|
||||
const day = String(now.getDate()).padStart(2, '0')
|
||||
// 获取小时,并将其转换为两位字符串,不足两位在前面补零
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
watch(
|
||||
() => weatherData.darkness,
|
||||
(newValue) => {
|
||||
@ -288,7 +311,11 @@ var decrementValue = () => {
|
||||
watch(
|
||||
() => weatherData.speed,
|
||||
(newValue) => {
|
||||
weatherData.currWeather = false
|
||||
if (!currWeatherData) {
|
||||
weatherData.currWeather = false
|
||||
} else {
|
||||
currWeatherData = false
|
||||
}
|
||||
sunshine && (sunshine.speed = newValue)
|
||||
timeline.setSpeed(newValue)
|
||||
}
|
||||
@ -323,8 +350,8 @@ var switchFunc = () => {
|
||||
//关闭
|
||||
sunshine && sunshine.remove()
|
||||
sunshine = null
|
||||
let timeData = now.setHours(0, 0, 0, 0) // 设置为当天0点
|
||||
timeline.updateTime(timeData)
|
||||
// let timeData = now.setHours(0, 0, 0, 0) // 设置为当天0点
|
||||
// timeline.updateTime(timeData)
|
||||
timeline.setSunShine(false)
|
||||
}
|
||||
}
|
||||
@ -361,7 +388,6 @@ var clickIcon = (item: any) => {
|
||||
}
|
||||
|
||||
var changDarkness = () => {
|
||||
console.log('changDarkness')
|
||||
sunshine && (sunshine.darkness = weatherData.darkness)
|
||||
}
|
||||
var changSpeed = () => {
|
||||
@ -374,6 +400,7 @@ var weatherTimeChange = () => {
|
||||
let timeData = now.setHours(0, 0, 0, 0) // 设置为当天0点
|
||||
timeline.updateTime(timeData)
|
||||
sunshine && (sunshine.time = weatherData.time)
|
||||
weatherData.currWeather = false
|
||||
}
|
||||
|
||||
var onClose = () => {}
|
||||
|
||||
@ -179,7 +179,6 @@ export default class TimeLine {
|
||||
if (this.changeDate) {//切换日期后让时间从0开始
|
||||
this.startTime = performance.now()
|
||||
}
|
||||
|
||||
let elapsed = (performance.now() - this.startTime) * this.speed;
|
||||
// if (this.elapsed) {
|
||||
// elapsed = elapsed + this.elapsed
|
||||
@ -217,10 +216,12 @@ export default class TimeLine {
|
||||
// this.speed = v;
|
||||
}
|
||||
this.manualPosition = null;
|
||||
|
||||
// this.update();
|
||||
|
||||
}
|
||||
closeChangeDate() {
|
||||
this.changeDate && (this.changeDate = false)
|
||||
}
|
||||
updateTime() {
|
||||
this.manualPosition = null;
|
||||
this.startTime = performance.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
|
||||
|
||||
Reference in New Issue
Block a user