This commit is contained in:
heixinyouzi 2024-11-02 19:44:59 +08:00
parent a2bf357fd0
commit 08ea47b8da
5 changed files with 39 additions and 4 deletions

View File

@ -66,6 +66,8 @@
), n(), r() ), n(), r()
}(window, document); }(window, document);
</script> </script>
<!-- <script src="https://api.vvhan.com/api/script/bolang"></script> -->
</html> </html>

View File

@ -7,3 +7,10 @@ export function poetry() {
method: 'get' method: 'get'
}); });
} }
//ipStat
export function ipStat() {
return request({
url: '/mix/ip',
method: 'get'
});
}

View File

@ -2,18 +2,27 @@
<div class="beian" ref="footer"> <div class="beian" ref="footer">
<a href="https://beian.miit.gov.cn" target="_blank">皖ICP备2021017362号-1</a> <a href="https://beian.miit.gov.cn" target="_blank">皖ICP备2021017362号-1</a>
<a class="swag" target="_blank" href="https://www.hxyouzi.com/swag">api文档</a> <a class="swag" target="_blank" href="https://www.hxyouzi.com/swag">api文档</a>
<div class="flex text-[#409eff] text-[12px] ml-[20px]">
<div>今日访问{{ ips?.todayIp }}</div>
<div class="ml-2">总访问{{ ips?.allIp }}</div>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { usesizeStore } from '@/stores/size.js'; import { usesizeStore } from '@/stores/size.js';
import { onMounted } from 'vue';
const footer = ref(null); const footer = ref(null);
const size = usesizeStore(); const size = usesizeStore();
const ips = ref()
onMounted(()=>{ onMounted(async ()=>{
size.setFootH(footer.value.clientHeight) size.setFootH(footer.value.clientHeight)
const res = await $http.mix.ipStat()
ips.value = res.data
console.log("8888",ips.value);
}) })
</script> </script>

View File

@ -1,4 +1,11 @@
// 将res的key对应的值复制给dzdata的同名key // 将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) { export function ObjectCopy(res, dzdata) {
Object.keys(dzdata).map(key => { Object.keys(dzdata).map(key => {
dzdata[key] = res[key]; dzdata[key] = res[key];
@ -82,6 +89,14 @@ export function deepclone(obj) {
return newobj; return newobj;
} }
/**
* 根据日期格式化时间
* @param {Date} date - 需要格式化的日期对象
* @param {string} format - 时间格式字符串
* @returns {string} 格式化后的时间字符串
* @example
* formatTimeBydate(new Date(), 'yyyy-MM-dd HH:mm:ss');
*/
export function formatTimeBydate(f) { export function formatTimeBydate(f) {
return formatTime(this, f) return formatTime(this, f)
} }

View File

@ -106,14 +106,14 @@ console.log("*************",holi);
const baidu = await $http.news.listBaiduNews()
const jqImg = ref('#') const jqImg = ref('#')
const jq = await $http.wea.getJq() const jq = await $http.wea.getJq()
const j = jq.data.solarTerms.slice(0, 2) const j = jq.data.solarTerms.slice(0, 2)
const jNum = jqs.indexOf(j) + 1 const jNum = jqs.indexOf(j) + 1
jqImg.value = 'https://www.hxyouzi.com/img/jieqi/' + jNum + '.jpg' jqImg.value = 'https://www.hxyouzi.com/img/jieqi/' + jNum + '.jpg'
const isBaidu = ref(false); const isBaidu = ref(false);
const baidu = await $http.news.listBaiduNews()
// const holi = await $http.wea.getNextHoliday() // const holi = await $http.wea.getNextHoliday()
// console.log(555555555555,holi); // console.log(555555555555,holi);
@ -130,6 +130,8 @@ const isBaidu = ref(false);
//mark method //mark method
setInterval(() => { setInterval(() => {
time.value = formatTime(new Date(), 'hh:mm:ss') time.value = formatTime(new Date(), 'hh:mm:ss')
//
date.value = formatTime(new Date(), 'YYYY 年 MM 月 DD 日') date.value = formatTime(new Date(), 'YYYY 年 MM 月 DD 日')
}, 1000) }, 1000)