This commit is contained in:
zmj 2024-05-13 19:28:05 +08:00
parent babdd302f2
commit 038e56a26d
3 changed files with 44 additions and 11 deletions

9
api/feedBack.js Normal file
View File

@ -0,0 +1,9 @@
import request from '@/utils/request';
export const addFeedBackApi = (data) => {
return request.post('/user/userfeedback/add', data);
}
export const userfeedbackListApi = (data) => {
return request.get('/user/userfeedback/lists', data);
}

View File

@ -64,6 +64,13 @@
import {
config
} from "@/config/app.js"
import {
addFeedBackApi,
userfeedbackListApi
} from "@/api/feedBack.js"
import useUserStore from '@/store/user';
const userStore = useUserStore();
@ -83,6 +90,7 @@
images: [],
name: "",
contact: "",
uid: userStore.userInfo.id
})
@ -94,20 +102,20 @@
//
const fileList1 = ref([]);
// const formData.images = ref([]);
//
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
formData.images.value.splice(event.index, 1);
};
//
const afterRead = async (event) => {
// mutiple true , file
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
let fileListLen = formData.images.length;
lists.map((item) => {
fileList1.value.push({
formData.images.push({
...item,
status: 'uploading',
message: '上传中',
@ -115,11 +123,9 @@
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: 'success',
message: '',
console.log(result)
let item = formData.images[fileListLen];
formData.images.splice(fileListLen, 1, {
url: result,
});
fileListLen++;
@ -137,14 +143,23 @@
},
success: (res) => {
setTimeout(() => {
resolve(res.data.data);
resolve(JSON.parse(res.data).data.uri);
}, 1000);
},
});
});
};
const submit = () => {
console.log()
const submit = async () => {
formData.images = formData.images.map(item => {
return item.url
})
await addFeedBackApi({
...formData
})
uni.showToast({
title: '提交成功',
duration: 2000

View File

@ -19,6 +19,15 @@
</template>
<script setup>
import {
userfeedbackListApi
} from "@/api/feedBack.js"
userfeedbackListApi().then(res => {
console.log(res)
})
const goDetail = () => {
uni.navigateTo({
url: '/pageQuota/feedBack/detail'