mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-21 22:53:56 +08:00
update:暂时恢复先前的随机生成uuid
This commit is contained in:
@@ -114,9 +114,18 @@ function closeAreaCodeSheet() {
|
|||||||
showAreaCodeSheet.value = false;
|
showAreaCodeSheet.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成UUID
|
||||||
|
function generateUUID() {
|
||||||
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||||
|
const r = (Math.random() * 16) | 0;
|
||||||
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取图形验证码
|
// 获取图形验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = crypto.randomUUID();
|
const uuid = generateUUID();
|
||||||
formData.value.captchaId = uuid;
|
formData.value.captchaId = uuid;
|
||||||
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,15 @@ function goToForgotPassword() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成UUID
|
||||||
|
function generateUUID() {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||||
|
const r = Math.random() * 16 | 0
|
||||||
|
const v = c === 'x' ? r : (r & 0x3 | 0x8)
|
||||||
|
return v.toString(16)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let skipReLaunch = false // 全局或组件作用域
|
let skipReLaunch = false // 全局或组件作用域
|
||||||
|
|
||||||
//跳转至服务端设置页面
|
//跳转至服务端设置页面
|
||||||
@@ -134,7 +143,7 @@ function goToServerSetting() {
|
|||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = crypto.randomUUID();
|
const uuid = generateUUID();
|
||||||
formData.value.captchaId = uuid;
|
formData.value.captchaId = uuid;
|
||||||
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,9 +124,18 @@ function closeAreaCodeSheet() {
|
|||||||
showAreaCodeSheet.value = false
|
showAreaCodeSheet.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成UUID
|
||||||
|
function generateUUID() {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||||
|
const r = (Math.random() * 16) | 0
|
||||||
|
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
||||||
|
return v.toString(16)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = crypto.randomUUID();
|
const uuid = generateUUID();
|
||||||
formData.value.captchaId = uuid;
|
formData.value.captchaId = uuid;
|
||||||
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,17 @@ export function randomNum(min, max) {
|
|||||||
return Math.round(Math.random() * (max - min) + min)
|
return Math.round(Math.random() * (max - min) + min)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取uuid
|
||||||
|
*/
|
||||||
|
export function getUUID() {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||||
|
return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证手机号格式
|
* 验证手机号格式
|
||||||
* @param {string} mobile 手机号
|
* @param {string} mobile 手机号
|
||||||
|
|||||||
@@ -148,7 +148,7 @@
|
|||||||
import Api from "@/apis/api";
|
import Api from "@/apis/api";
|
||||||
import VersionFooter from "@/components/VersionFooter.vue";
|
import VersionFooter from "@/components/VersionFooter.vue";
|
||||||
import i18n, { changeLanguage } from "@/i18n";
|
import i18n, { changeLanguage } from "@/i18n";
|
||||||
import { goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from "@/utils";
|
import { getUUID, goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from "@/utils";
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -213,7 +213,7 @@ export default {
|
|||||||
this.$router.push("/home");
|
this.$router.push("/home");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.captchaUuid = crypto.randomUUID();
|
this.captchaUuid = getUUID();
|
||||||
|
|
||||||
Api.user.getCaptcha(this.captchaUuid, (res) => {
|
Api.user.getCaptcha(this.captchaUuid, (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Api from '@/apis/api';
|
import Api from '@/apis/api';
|
||||||
import VersionFooter from '@/components/VersionFooter.vue';
|
import VersionFooter from '@/components/VersionFooter.vue';
|
||||||
import { goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from '@/utils';
|
import { getUUID, goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from '@/utils';
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
// 导入语言切换功能
|
// 导入语言切换功能
|
||||||
@@ -177,7 +177,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 复用验证码获取方法
|
// 复用验证码获取方法
|
||||||
fetchCaptcha() {
|
fetchCaptcha() {
|
||||||
this.form.captchaId = crypto.randomUUID();
|
this.form.captchaId = getUUID();
|
||||||
Api.user.getCaptcha(this.form.captchaId, (res) => {
|
Api.user.getCaptcha(this.form.captchaId, (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const blob = new Blob([res.data], { type: res.data.type });
|
const blob = new Blob([res.data], { type: res.data.type });
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Api from '@/apis/api';
|
import Api from '@/apis/api';
|
||||||
import VersionFooter from '@/components/VersionFooter.vue';
|
import VersionFooter from '@/components/VersionFooter.vue';
|
||||||
import { goToPage, showDanger, showSuccess, validateMobile, sm2Encrypt } from '@/utils';
|
import { getUUID, goToPage, showDanger, showSuccess, validateMobile, sm2Encrypt } from '@/utils';
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
// 导入语言切换功能
|
// 导入语言切换功能
|
||||||
@@ -144,7 +144,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 复用验证码获取方法
|
// 复用验证码获取方法
|
||||||
fetchCaptcha() {
|
fetchCaptcha() {
|
||||||
this.form.captchaId = crypto.randomUUID();
|
this.form.captchaId = getUUID();
|
||||||
Api.user.getCaptcha(this.form.captchaId, (res) => {
|
Api.user.getCaptcha(this.form.captchaId, (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const blob = new Blob([res.data], { type: res.data.type });
|
const blob = new Blob([res.data], { type: res.data.type });
|
||||||
|
|||||||
Reference in New Issue
Block a user