|
@@ -32,10 +32,8 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
mySelect(e) {
|
|
mySelect(e) {
|
|
- console.log(e)
|
|
|
|
var name = e.currentTarget.dataset.name
|
|
var name = e.currentTarget.dataset.name
|
|
var blue = e.currentTarget.dataset.data
|
|
var blue = e.currentTarget.dataset.data
|
|
- console.log(e.currentTarget.dataset.data);
|
|
|
|
this.setData({
|
|
this.setData({
|
|
blue: blue,
|
|
blue: blue,
|
|
grade_name: name,
|
|
grade_name: name,
|
|
@@ -49,10 +47,8 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
mySelect1(e) {
|
|
mySelect1(e) {
|
|
- console.log(e)
|
|
|
|
var name = e.currentTarget.dataset.name1
|
|
var name = e.currentTarget.dataset.name1
|
|
var red = e.currentTarget.dataset.data1
|
|
var red = e.currentTarget.dataset.data1
|
|
- console.log(e.currentTarget.dataset.data1);
|
|
|
|
this.setData({
|
|
this.setData({
|
|
red: red,
|
|
red: red,
|
|
grade_name1: name,
|
|
grade_name1: name,
|
|
@@ -61,13 +57,11 @@ Page({
|
|
},
|
|
},
|
|
//选择时间
|
|
//选择时间
|
|
bindDateChange: function (e) {
|
|
bindDateChange: function (e) {
|
|
- console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
|
this.setData({
|
|
this.setData({
|
|
date: e.detail.value
|
|
date: e.detail.value
|
|
})
|
|
})
|
|
},
|
|
},
|
|
bindTimeChange: function (e) {
|
|
bindTimeChange: function (e) {
|
|
- console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
|
this.setData({
|
|
this.setData({
|
|
time: e.detail.value
|
|
time: e.detail.value
|
|
})
|
|
})
|
|
@@ -89,12 +83,52 @@ Page({
|
|
back: function () {
|
|
back: function () {
|
|
wx.navigateBack({ url: '/pages/me/index' })
|
|
wx.navigateBack({ url: '/pages/me/index' })
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ //提交
|
|
|
|
+ formSubmit: function (e) {
|
|
|
|
+ var match_time = this.data.date + ' ' + this.data.time;
|
|
|
|
+ const value = e.detail.value;
|
|
|
|
+ value.match_id = this.data.id;
|
|
|
|
+ value.red_id = this.data.red._id;
|
|
|
|
+ value.red_name = this.data.red.team_name;
|
|
|
|
+ value.red_logo = this.data.red.logo;
|
|
|
|
+ value.red_members = this.data.red.members;
|
|
|
|
+ value.blue_id = this.data.blue._id;
|
|
|
|
+ value.blue_name = this.data.blue.team_name;
|
|
|
|
+ value.blue_logo = this.data.blue.logo;
|
|
|
|
+ value.blue_members = this.data.blue.members;
|
|
|
|
+ value.match_time = match_time;
|
|
|
|
+ if (!this.WxValidate.checkForm(value)) {
|
|
|
|
+ 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`, //接口地址
|
|
|
|
+ method: "post",
|
|
|
|
+ data: value,
|
|
|
|
+ header: {},
|
|
|
|
+ success: res => {
|
|
|
|
+ if (res.data.errcode == 0) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '保存成功',
|
|
|
|
+ icon: 'success',
|
|
|
|
+ duration: 2000//延迟两秒
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '保存失败',
|
|
|
|
+ icon: 'success',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
- console.log(options.id);
|
|
|
|
this.setData({ id: options.id })
|
|
this.setData({ id: options.id })
|
|
// 计算高度
|
|
// 计算高度
|
|
this.searchHeight();
|
|
this.searchHeight();
|
|
@@ -106,7 +140,6 @@ Page({
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: function () {
|
|
watchLogin: function () {
|
|
const that = this;
|
|
const that = this;
|
|
- console.log(that.data.id);
|
|
|
|
let id = that.data.id;
|
|
let id = that.data.id;
|
|
wx.getStorage({
|
|
wx.getStorage({
|
|
key: 'token',
|
|
key: 'token',
|
|
@@ -116,7 +149,6 @@ Page({
|
|
method: 'get',
|
|
method: 'get',
|
|
data: {},
|
|
data: {},
|
|
success(res) {
|
|
success(res) {
|
|
- console.log(res.data.data);
|
|
|
|
that.setData({ form: res.data.data })
|
|
that.setData({ form: res.data.data })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -125,7 +157,6 @@ Page({
|
|
method: 'get',
|
|
method: 'get',
|
|
data: { match_id: that.data.id },
|
|
data: { match_id: that.data.id },
|
|
success(res) {
|
|
success(res) {
|
|
- console.log(res.data.data);
|
|
|
|
that.setData({ grades: res.data.data })
|
|
that.setData({ grades: res.data.data })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -142,50 +173,7 @@ Page({
|
|
const messages = { match_name: { required: '请输入比赛名称' }, };
|
|
const messages = { match_name: { required: '请输入比赛名称' }, };
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
},
|
|
},
|
|
- //提交
|
|
|
|
- formSubmit: function (e) {
|
|
|
|
- var match_time = this.data.date + ' ' + this.data.time;
|
|
|
|
- const value = e.detail.value;
|
|
|
|
- value.match_id = this.data.id;
|
|
|
|
- value.red_id = this.data.red._id;
|
|
|
|
- value.red_name = this.data.red.team_name;
|
|
|
|
- value.red_logo = this.data.red.logo;
|
|
|
|
- value.red_members = this.data.red.members;
|
|
|
|
- value.blue_id = this.data.blue._id;
|
|
|
|
- value.blue_name = this.data.blue.team_name;
|
|
|
|
- value.blue_logo = this.data.blue.logo;
|
|
|
|
- value.blue_members = this.data.blue.members;
|
|
|
|
- value.match_time = match_time;
|
|
|
|
- console.log(value);
|
|
|
|
- if (!this.WxValidate.checkForm(value)) {
|
|
|
|
- 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`, //接口地址
|
|
|
|
- method: "post",
|
|
|
|
- data: value,
|
|
|
|
- header: {},
|
|
|
|
- success: res => {
|
|
|
|
- console.log(res);
|
|
|
|
- if (res.data.errcode == 0) {
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '保存成功',
|
|
|
|
- icon: 'success',
|
|
|
|
- duration: 2000//延迟两秒
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '保存失败',
|
|
|
|
- icon: 'success',
|
|
|
|
- duration: 2000
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
// 计算高度
|
|
// 计算高度
|
|
searchHeight: function () {
|
|
searchHeight: function () {
|
|
let frameStyle = this.data.frameStyle;
|
|
let frameStyle = this.data.frameStyle;
|