提交法律援助和财税援助,调整我的页面
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
import { askAid } from "../../../service/system";
|
||||
import dayjs from "../../../utils/dayjs";
|
||||
import { alertInfo, alertSuccess, isValidPhoneNumber, loadingFunc } from "../../../utils/index";
|
||||
import request from '../../../utils/request'
|
||||
const { OK } = request
|
||||
|
||||
// pages/aid/consult/index.js
|
||||
Page({
|
||||
|
||||
@@ -12,10 +18,54 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { type } = options;
|
||||
this.setData({ type });
|
||||
const { id, type } = options;
|
||||
this.setData({ type: Number(type), id });
|
||||
},
|
||||
onChange(e) {
|
||||
const data = e.detail;
|
||||
const { name } = e.currentTarget.dataset
|
||||
const { form } = this.data;
|
||||
form[name] = data;
|
||||
this.setData({
|
||||
form,
|
||||
})
|
||||
},
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
async submit() {
|
||||
const { form } = this.data;
|
||||
const { name, phone, detail } = form;
|
||||
if (!name) {
|
||||
alertInfo("请输入名字")
|
||||
return;
|
||||
}
|
||||
if (!phone) {
|
||||
alertInfo("请输入手机号")
|
||||
return;
|
||||
}
|
||||
if (phone && !isValidPhoneNumber(phone)) {
|
||||
alertInfo("手机号格式不正确")
|
||||
return
|
||||
}
|
||||
if (!detail) {
|
||||
alertInfo("请输入详情")
|
||||
return
|
||||
}
|
||||
const that = this;
|
||||
loadingFunc(async () => {
|
||||
const { type, id } = that.data;
|
||||
const { code, message } = await askAid({ ...form, type, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), connectId: id })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("创建成功")
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
Reference in New Issue
Block a user