// pages/info/info.ts import Time from "../../../utils/Time"; import config from "../../../config/index" interface IAboutData { timer?: number; total?: number; beginFriendText: string; } Page({ data: { copyright: `Copyright © 2017 - ${new Date().getFullYear()} imyeyu.com`, timer: undefined, total: undefined, beginFriendText: "相识 -- 天 -- 小时 -- 分钟 -- 秒", beginLoveText: "相恋 -- 天 -- 小时 -- 分钟 -- 秒" }, onShow() { const beginLove = new Date("2025/11/10 00:10:00"); const beginFriend = new Date("2025/06/28 16:00:00"); const timer = setInterval(() => { { const r = Time.between(beginLove) this.setData({ beginLoveText: `相恋 ${r.d} 天 ${r.h} 小时 ${r.m.toString().padStart(2, "0")} 分钟 ${r.s.toString().padStart(2, "0")} 秒` }) } { const r = Time.between(beginFriend) this.setData({ beginFriendText: `相识 ${r.d} 天 ${r.h} 小时 ${r.m.toString().padStart(2, "0")} 分钟 ${r.s.toString().padStart(2, "0")} 秒` }) } }, 1000) this.setData({ timer }); wx.request({ url: `${config.url}/journal/total`, method: "GET", header: { Key: wx.getStorageSync("key") }, success: (resp: any) => { this.setData({ total: resp.data.data }); } }); }, onHide() { this.data.timer && clearInterval(this.data.timer); }, exit() { wx.redirectTo({ "url": "/pages/index/index?from=info" }) } })