改成 crypto.randomUUID(); 生成uuid

This commit is contained in:
于小丘
2025-10-13 09:35:39 +08:00
parent 374f2a92aa
commit 432a5d01f8
3 changed files with 5 additions and 8 deletions
@@ -11,7 +11,6 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { v4 as uuidv4 } from 'uuid';
import { useConfigStore } from "@/store";
import { getEnvBaseUrl, sm2Encrypt } from "@/utils";
import { toast } from "@/utils/toast";
@@ -117,7 +116,7 @@ function closeAreaCodeSheet() {
// 获取图形验证码
async function refreshCaptcha() {
const uuid = uuidv4();
const uuid = crypto.randomUUID();
formData.value.captchaId = uuid;
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
}
@@ -11,7 +11,6 @@
<script lang="ts" setup>
import type { LoginData } from '@/api/auth';
import { computed, onMounted, ref } from 'vue';
import { v4 as uuidv4 } from 'uuid';
import { login } from '@/api/auth';
import { useConfigStore } from '@/store';
import { getEnvBaseUrl } from '@/utils';
@@ -135,9 +134,9 @@ function goToServerSetting() {
// 获取验证码
async function refreshCaptcha() {
const uuid = uuidv4();
formData.value.captchaId = uuid
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`
const uuid = crypto.randomUUID();
formData.value.captchaId = uuid;
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
}
// 登录
@@ -11,7 +11,6 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { register, sendSmsCode } from '@/api/auth';
import { v4 as uuidv4 } from 'uuid';
import { useConfigStore } from '@/store';
import { getEnvBaseUrl } from '@/utils';
import { toast } from '@/utils/toast';
@@ -127,7 +126,7 @@ function closeAreaCodeSheet() {
// 获取验证码
async function refreshCaptcha() {
const uuid = uuidv4();
const uuid = crypto.randomUUID();
formData.value.captchaId = uuid;
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
}