增加run local

This commit is contained in:
flashily 2025-03-27 00:34:41 +08:00
parent a1b071e38e
commit 2755a35548
4 changed files with 36 additions and 15 deletions

View file

@ -0,0 +1,8 @@
/*
* @Description: 本地开发环境
* @Version: 1.0
* @Author: flashily
* @LastEditTime: 2025-03-26
*/
VUE_APP_URL = 'http://localhost:8002/xiaozhi-esp32-api'
/*VUE_APP_SERVER_ID = 1 */

View file

@ -3,6 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"local": "vue-cli-service serve --mode local",
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build" "build": "vue-cli-service build"
}, },

View file

@ -7,7 +7,8 @@ import admin from './module/admin.js'
* 如果你想调用8002端口,就用'/xiaozhi-esp32-api/api/v1',请与vue.config.js的devServer配置相结合,方便跨域请求 * 如果你想调用8002端口,就用'/xiaozhi-esp32-api/api/v1',请与vue.config.js的devServer配置相结合,方便跨域请求
* *
*/ */
const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default' const DEV_API_SERVICE = process.env.VUE_APP_URL == '' ? 'https://apifoxmock.com/m1/5931378-5618560-default' : process.env.VUE_APP_URL
// 8002开发完成完成后使用这个 // 8002开发完成完成后使用这个
// const DEV_API_SERVICE = '/xiaozhi-esp32-api' // const DEV_API_SERVICE = '/xiaozhi-esp32-api'

View file

@ -83,26 +83,37 @@ export default {
} }
}, },
mounted() { mounted() {
this.captchaUuid = getUUID();
this.fetchCaptcha(); this.fetchCaptcha();
}, },
methods: { methods: {
fetchCaptcha() { fetchCaptcha() {
if (this.$store.getters.getToken) { Api.user.getCaptcha(this.captchaUuid, (res) => {
goToPage('/home') if (res.status === 200) {
} else { const blob = new Blob([res.data], {type: res.data.type});
this.captchaUuid = getUUID(); this.captchaUrl = URL.createObjectURL(blob);
Api.user.getCaptcha(this.captchaUuid, (res) => { } else {
if (res.status === 200) { console.error('验证码加载异常:', error);
const blob = new Blob([res.data], {type: res.data.type}); showDanger('验证码加载失败,点击刷新')
this.captchaUrl = URL.createObjectURL(blob); }
});
// if (this.$store.getters.getToken) {
// // goToPage('/home')
// } else {
// this.captchaUuid = getUUID();
} else { // Api.user.getCaptcha(this.captchaUuid, (res) => {
console.error('验证码加载异常:', error); // if (res.status === 200) {
showDanger('验证码加载失败,点击刷新') // const blob = new Blob([res.data], {type: res.data.type});
} // this.captchaUrl = URL.createObjectURL(blob);
});
} // } else {
// console.error('验证码加载异常:', error);
// showDanger('验证码加载失败,点击刷新')
// }
// });
// }
}, },
// 封装输入验证逻辑 // 封装输入验证逻辑