diff --git a/src/api/question/question.js b/src/api/question/question.js index 69379b8..696ee31 100644 --- a/src/api/question/question.js +++ b/src/api/question/question.js @@ -12,14 +12,17 @@ export const getQuestion= (type)=>{ }, }) } -//注册 -export const validationAnswer= (user)=>{ +//验证题目是否正确 +export const checkQuestion= ({ + questionId, + answer +})=>{ return http({ url:"/question/validationAnswer", method:"get", - data:user, - headers:{ - isToken:false + params:{ + questionId, + answer } }) } \ No newline at end of file diff --git a/src/api/upload/upload.js b/src/api/upload/upload.js new file mode 100644 index 0000000..4f65367 --- /dev/null +++ b/src/api/upload/upload.js @@ -0,0 +1,18 @@ +import httpInstance from '@/utils/http' + +export const uploadImage = (file) => { + // 创建一个 FormData 对象 + const formData = new FormData(); + // 将文件添加到 FormData + formData.append('file', file); + + // 发送 POST 请求 + return httpInstance({ + url: `/QiNiu/upload`, + method: "post", + data: formData, // 将 FormData 对象作为请求体 + headers: { + 'Content-Type': 'multipart/form-data' + } + }); +} diff --git a/src/api/user/user.js b/src/api/user/user.js index 05ef924..15224fd 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -33,6 +33,6 @@ export const updateUserInfo= (user)=>{ return http.request({ url:"/user/update", method:"post", - params:user + data:user }) } diff --git a/src/components/ImageUpload.vue b/src/components/ImageUpload.vue new file mode 100644 index 0000000..99c5f5b --- /dev/null +++ b/src/components/ImageUpload.vue @@ -0,0 +1,124 @@ + + + diff --git a/src/components/TypeSelect.vue b/src/components/TypeSelect.vue index 8ac6c8b..cf8f2c1 100644 --- a/src/components/TypeSelect.vue +++ b/src/components/TypeSelect.vue @@ -1,5 +1,6 @@ @@ -29,6 +31,9 @@ emit('select',word); // 这里可以抛出一个事件,或者调用其他方法 }; + onMounted(()=>{ + getWords(); + })