Commit 223aeb36 authored by Step_by_step's avatar Step_by_step

feat: 投诉与建议接口联调

parent f90d1f90
import { get, put, post, File, deleteReq } from '@/utils/http'
import { post } from '@/utils/http'
const baseURL = import.meta.env.DEV ? '/api' : import.meta.env.VITE_HTTP_BASE_URL
const baseURL = import.meta.env.VITE_HTTP_BASE_URL
const api = {
// getMakingList (data) { // 查询合同制作列表
// return get(
// `${baseURL}/hlct/v1/0/contracts/toMake`,
// {...data}
// )
// },
commit(data = {}) {
return post(`${baseURL}/app/api/app/complaint/suggest/save`, { userId: window.localStorage.getItem('userId'), ...data })
},
};
export default api;
......@@ -21,7 +21,7 @@
</section>
<section class="sub">
<Button type="primary" block>确认</Button>
<Button @click="save" type="primary" block>确认</Button>
</section>
</div>
</div>
......@@ -29,9 +29,10 @@
<script setup>
import { goBack } from "@/utils/globalFun"
import { NavBar, Button, Field } from "vant";
import { NavBar, Button, Field, Toast } from "vant";
import AuForm from '@/components/AuForm.vue';
import AuFormClass from "@/components/useAuForm";
import api from "../api";
const form = $ref();
const formConfig = $ref(new AuFormClass([
......@@ -57,6 +58,23 @@ const formConfig = $ref(new AuFormClass([
isRequired: true
}
]))
const save = async () => {
if (formConfig.validate()) {
let formObj = formConfig.getValues();
let res = await api.commit(formObj)
if (res.success) {
Toast.success('提交成功!感谢您的反馈')
setTimeout(() => {
goBack()
}, 2000);
} else {
Toast.fail('提交失败!请稍后重试')
}
} else {
Toast({ message: '请将必填项填写完整', position: 'top' });
}
}
</script>
<style lang="less" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment