|
@@ -15,7 +15,30 @@ Page({
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
id: '',
|
|
|
- schedulelist: []
|
|
|
+ //修改比分
|
|
|
+ form: [],
|
|
|
+ //详情数据
|
|
|
+ schedulelist: [],
|
|
|
+ showModal: false,
|
|
|
+ },
|
|
|
+ //验证是否输入
|
|
|
+ initValidate() {
|
|
|
+ const rules = { blue_branch: { required: true }, red_branch: { required: true, } }
|
|
|
+ // 验证字段的提示信息,若不传则调用默认的信息
|
|
|
+ const messages = { blue_branch: { required: '请输入蓝方比分', }, red_branch: { required: '请输入红方比分', } };
|
|
|
+ this.WxValidate = new WxValidate(rules, messages)
|
|
|
+ },
|
|
|
+ //显示对话框
|
|
|
+ clickme: function () {
|
|
|
+ this.setData({
|
|
|
+ showModal: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //关闭弹窗
|
|
|
+ go: function () {
|
|
|
+ this.setData({
|
|
|
+ showModal: false
|
|
|
+ })
|
|
|
},
|
|
|
//上传图片
|
|
|
imgUpload: function (e) {
|
|
@@ -34,14 +57,47 @@ Page({
|
|
|
back: function () {
|
|
|
wx.navigateBack({ url: '/pages/home/index' })
|
|
|
},
|
|
|
+ // 提交登录
|
|
|
+ formSubmit: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let id = that.data.id;
|
|
|
+ const params = e.detail.value;
|
|
|
+ params.match_file = that.data.fileList;
|
|
|
+ if (!this.WxValidate.checkForm(params)) {
|
|
|
+ const error = this.WxValidate.errorList[0];
|
|
|
+ wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/schedule/${id}`, //接口地址
|
|
|
+ method: 'post',
|
|
|
+ data: params,
|
|
|
+ success(res) {
|
|
|
+ if (res.data.errcode == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ duration: 2000,
|
|
|
+ icon: 'success',
|
|
|
+ success: (res) => { that.back() }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: res.data.errmsg, icon: 'error', duration: 2000 })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
const that = this;
|
|
|
that.setData({ id: options.id })
|
|
|
+ //验证规则函数
|
|
|
+ this.initValidate();
|
|
|
// 计算高度
|
|
|
- this.searchHeight()
|
|
|
+ this.searchHeight();
|
|
|
// 监听用户是否登录
|
|
|
this.watchLogin();
|
|
|
},
|
|
@@ -57,8 +113,10 @@ Page({
|
|
|
method: 'get',
|
|
|
data: {},
|
|
|
success(res) {
|
|
|
+ let fileList = res.data.data.match_file;
|
|
|
that.setData({
|
|
|
schedulelist: res.data.data,
|
|
|
+ fileList: fileList,
|
|
|
})
|
|
|
}
|
|
|
})
|