mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 01:53:53 +08:00
@@ -114,18 +114,9 @@ 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 = generateUUID();
|
const uuid = crypto.randomUUID();
|
||||||
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()}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,15 @@
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { LoginData } from '@/api/auth'
|
import type { LoginData } from '@/api/auth';
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { login } from '@/api/auth'
|
import { login } from '@/api/auth';
|
||||||
import { useConfigStore } from '@/store'
|
import { useConfigStore } from '@/store';
|
||||||
import { getEnvBaseUrl } from '@/utils'
|
import { getEnvBaseUrl } from '@/utils';
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast';
|
||||||
// 导入国际化相关功能
|
// 导入国际化相关功能
|
||||||
import { t, changeLanguage, getSupportedLanguages, initI18n } from '@/i18n'
|
import { t, changeLanguage, getSupportedLanguages, initI18n } from '@/i18n';
|
||||||
import type { Language } from '@/store/lang'
|
import type { Language } from '@/store/lang';
|
||||||
// 导入SM2加密工具
|
// 导入SM2加密工具
|
||||||
import { sm2Encrypt } from '@/utils'
|
import { sm2Encrypt } from '@/utils'
|
||||||
|
|
||||||
@@ -123,15 +123,6 @@ 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 // 全局或组件作用域
|
||||||
|
|
||||||
//跳转至服务端设置页面
|
//跳转至服务端设置页面
|
||||||
@@ -143,9 +134,9 @@ function goToServerSetting() {
|
|||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = generateUUID()
|
const uuid = crypto.randomUUID();
|
||||||
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()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
|
|||||||
@@ -9,15 +9,15 @@
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { register, sendSmsCode } from '@/api/auth'
|
import { register, sendSmsCode } from '@/api/auth';
|
||||||
import { useConfigStore } from '@/store'
|
import { useConfigStore } from '@/store';
|
||||||
import { getEnvBaseUrl } from '@/utils'
|
import { getEnvBaseUrl } from '@/utils';
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast';
|
||||||
// 导入国际化相关功能
|
// 导入国际化相关功能
|
||||||
import { t, initI18n } from '@/i18n'
|
import { t, initI18n } from '@/i18n';
|
||||||
// 导入SM2加密工具
|
// 导入SM2加密工具
|
||||||
import { sm2Encrypt } from '@/utils'
|
import { sm2Encrypt } from '@/utils';
|
||||||
|
|
||||||
// 获取屏幕边界到安全区域距离
|
// 获取屏幕边界到安全区域距离
|
||||||
let safeAreaInsets
|
let safeAreaInsets
|
||||||
@@ -124,20 +124,11 @@ 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 = generateUUID()
|
const uuid = crypto.randomUUID();
|
||||||
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()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送短信验证码
|
// 发送短信验证码
|
||||||
|
|||||||
Generated
+1
-10
@@ -10168,7 +10168,7 @@
|
|||||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"uuid": "dist/bin/uuid"
|
"uuid": "bin/uuid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-list-map": {
|
"node_modules/source-list-map": {
|
||||||
@@ -11096,15 +11096,6 @@
|
|||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
|
||||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
|
||||||
"bin": {
|
|
||||||
"uuid": "bin/uuid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/validate-npm-package-license": {
|
"node_modules/validate-npm-package-license": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||||
|
|||||||
@@ -126,16 +126,6 @@ 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 { getUUID, goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from "@/utils";
|
import { 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 = getUUID();
|
this.captchaUuid = crypto.randomUUID();
|
||||||
|
|
||||||
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 { getUUID, goToPage, showDanger, showSuccess, sm2Encrypt, validateMobile } from '@/utils';
|
import { 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 = getUUID();
|
this.form.captchaId = crypto.randomUUID();
|
||||||
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 { getUUID, goToPage, showDanger, showSuccess, validateMobile, sm2Encrypt } from '@/utils';
|
import { 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 = getUUID();
|
this.form.captchaId = crypto.randomUUID();
|
||||||
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