模拟考试获取当天日期精准至时分秒

This commit is contained in:
xuchao
2026-01-16 12:42:44 +08:00
parent 1508a1a717
commit d6b6fdcc38

View File

@@ -129,6 +129,7 @@
<script setup>
import { inject, ref, reactive } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import dayjs from "dayjs";
const { $api, navTo, navBack,urls } = inject('globalFunction');
import config from "@/config.js"
const userInfo = ref({});
@@ -152,13 +153,7 @@ onLoad(() => {
});
onShow(()=>{
getDictionary()
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1; // 月份从0开始需要加1
let day = date.getDate();
month=month>9?month:'0'+month
day=day>9?day:'0'+day
dates.value=year+'-'+month+'-'+day
dates.value=dayjs().format('YYYY-MM-DD HH:mm:ss')
Authorization.value=uni.getStorageSync('Padmin-Token')||''
getHeart();
})