验证码刷新

This commit is contained in:
zhaoyz 2024-02-02 09:39:50 +08:00
parent 2b5363be8e
commit 9d608fdabf
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,6 @@
import axios from "axios";
// const HOST = 'http://127.0.0.1:3001';
const HOST = 'http://123.57.147.184:3001';
export const HOST = 'http://localhost:9999';
const BASE_URL = import.meta.env.BASE_URL
export const get = (url: any, params: any, success: any) => {

View File

@ -101,7 +101,7 @@
</el-form-item>
<el-form-item label="验证码" prop="code">
<el-input v-model="registerParams.code" placeholder="请输入验证码" style="width: calc(100% - 110px);"></el-input>
<img width="100" height="32" style="margin-left: 10px;" src="" />
<img width="100" height="32" style="margin-left: 10px;" :src="captchaImgUrl" @click="refreshImg" />
</el-form-item>
</el-form>
@ -124,6 +124,7 @@ import {ElMessage, ElMessageBox} from 'element-plus'
import {useLoginStore} from '@/stores/user-info-store'
import {getHospitalsData, getPhoneAreasData} from '@/static-data/core'
import {v4} from "uuid";
import {HOST} from "@/axios";
const router = useRouter()
@ -266,8 +267,12 @@ const login = async (type: string) => {
function getCaptchaCode() {
isShowRegister.value = true
refreshImg()
}
function refreshImg() {
const randomStr = v4()
captchaImgUrl.value = 'http://localhost:9999/admin/code/textImage?randomStr=' + randomStr
captchaImgUrl.value = HOST + '/admin/code/textImage?randomStr=' + randomStr
}
const toHome = () => {