模拟考试获取当天日期精准至时分秒
This commit is contained in:
@@ -129,6 +129,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, ref, reactive } from 'vue';
|
import { inject, ref, reactive } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
|
import dayjs from "dayjs";
|
||||||
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
||||||
import config from "@/config.js"
|
import config from "@/config.js"
|
||||||
const userInfo = ref({});
|
const userInfo = ref({});
|
||||||
@@ -152,13 +153,7 @@ onLoad(() => {
|
|||||||
});
|
});
|
||||||
onShow(()=>{
|
onShow(()=>{
|
||||||
getDictionary()
|
getDictionary()
|
||||||
const date = new Date();
|
dates.value=dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||||
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
|
|
||||||
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
||||||
getHeart();
|
getHeart();
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user