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 = { const api = {
// getMakingList (data) { // 查询合同制作列表 commit(data = {}) {
// return get( return post(`${baseURL}/app/api/app/complaint/suggest/save`, { userId: window.localStorage.getItem('userId'), ...data })
// `${baseURL}/hlct/v1/0/contracts/toMake`, },
// {...data}
// )
// },
}; };
export default api; export default api;
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</section> </section>
<section class="sub"> <section class="sub">
<Button type="primary" block>确认</Button> <Button @click="save" type="primary" block>确认</Button>
</section> </section>
</div> </div>
</div> </div>
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
<script setup> <script setup>
import { goBack } from "@/utils/globalFun" 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 AuForm from '@/components/AuForm.vue';
import AuFormClass from "@/components/useAuForm"; import AuFormClass from "@/components/useAuForm";
import api from "../api";
const form = $ref(); const form = $ref();
const formConfig = $ref(new AuFormClass([ const formConfig = $ref(new AuFormClass([
...@@ -57,6 +58,23 @@ const formConfig = $ref(new AuFormClass([ ...@@ -57,6 +58,23 @@ const formConfig = $ref(new AuFormClass([
isRequired: true 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> </script>
<style lang="less" scoped> <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