From 08ea47b8da078f0029c5566af5f188dd984176d6 Mon Sep 17 00:00:00 2001 From: heixinyouzi <2410633923@qq.com> Date: Sat, 2 Nov 2024 19:44:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 ++ src/api/mix/index.js | 7 +++++++ src/components/foot.vue | 13 +++++++++++-- src/util/index.js | 15 +++++++++++++++ src/views/home/side.vue | 6 ++++-- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index a9726d1..1b41a72 100644 --- a/index.html +++ b/index.html @@ -66,6 +66,8 @@ ), n(), r() }(window, document); + + diff --git a/src/api/mix/index.js b/src/api/mix/index.js index dc63513..d77b25b 100644 --- a/src/api/mix/index.js +++ b/src/api/mix/index.js @@ -7,3 +7,10 @@ export function poetry() { method: 'get' }); } +//ipStat +export function ipStat() { + return request({ + url: '/mix/ip', + method: 'get' + }); +} \ No newline at end of file diff --git a/src/components/foot.vue b/src/components/foot.vue index c2a4717..94c08da 100644 --- a/src/components/foot.vue +++ b/src/components/foot.vue @@ -2,18 +2,27 @@
皖ICP备2021017362号-1 api文档 + +
+
今日访问:{{ ips?.todayIp }}
+
总访问:{{ ips?.allIp }}
+
diff --git a/src/util/index.js b/src/util/index.js index 3ad1a8c..9aa7db0 100644 --- a/src/util/index.js +++ b/src/util/index.js @@ -1,4 +1,11 @@ // 将res的key对应的值复制给dzdata的同名key +/** + * 将源对象res的属性复制到目标对象dzdata中。 + * @param {Object} res - 源对象,其属性将被复制。 + * @param {Object} dzdata - 目标对象,将接收源对象的属性。 + * @example + * ObjectCopy({a: 1, b: 2}, {c: 3}); // dzdata 变为 {a: 1, b: 2, c: 3} + */ export function ObjectCopy(res, dzdata) { Object.keys(dzdata).map(key => { dzdata[key] = res[key]; @@ -82,6 +89,14 @@ export function deepclone(obj) { return newobj; } +/** + * 根据日期格式化时间。 + * @param {Date} date - 需要格式化的日期对象。 + * @param {string} format - 时间格式字符串。 + * @returns {string} 格式化后的时间字符串。 + * @example + * formatTimeBydate(new Date(), 'yyyy-MM-dd HH:mm:ss'); + */ export function formatTimeBydate(f) { return formatTime(this, f) } diff --git a/src/views/home/side.vue b/src/views/home/side.vue index 376ba34..1d996e8 100644 --- a/src/views/home/side.vue +++ b/src/views/home/side.vue @@ -106,14 +106,14 @@ console.log("*************",holi); -const baidu = await $http.news.listBaiduNews() + const jqImg = ref('#') const jq = await $http.wea.getJq() const j = jq.data.solarTerms.slice(0, 2) const jNum = jqs.indexOf(j) + 1 jqImg.value = 'https://www.hxyouzi.com/img/jieqi/' + jNum + '.jpg' const isBaidu = ref(false); - +const baidu = await $http.news.listBaiduNews() // const holi = await $http.wea.getNextHoliday() // console.log(555555555555,holi); @@ -130,6 +130,8 @@ const isBaidu = ref(false); //mark method setInterval(() => { time.value = formatTime(new Date(), 'hh:mm:ss') + //同步秒钟 + date.value = formatTime(new Date(), 'YYYY 年 MM 月 DD 日') }, 1000)