|
@@ -1,5 +1,6 @@
|
|
|
const app = getApp();
|
|
|
import { btn } from '../../utils/dict';
|
|
|
+import WxValidate from '../../utils/wxValidate'
|
|
|
Page({
|
|
|
|
|
|
|
|
@@ -14,34 +15,21 @@ Page({
|
|
|
|
|
|
userInfo: {},
|
|
|
|
|
|
- ismatchList: [
|
|
|
- {
|
|
|
- id: '1',
|
|
|
- _id: '1',
|
|
|
- status: '0',
|
|
|
- match_time: '2020-11-11 10:11',
|
|
|
- red_logo: [{
|
|
|
- name: "20220331104915.jpg",
|
|
|
- uri: "/files/court/elimg/20220331104915.jpg",
|
|
|
- url: "http://broadcast.waityou24.cn/files/court/elimg/20220331104915.jpg",
|
|
|
- }],
|
|
|
- red_name: '红方名称',
|
|
|
- red_branch: '11',
|
|
|
- blue_branch: '11',
|
|
|
- blue_name: '蓝方名称',
|
|
|
- blue_logo: [{
|
|
|
- name: "20220331104915.jpg",
|
|
|
- uri: "/files/court/elimg/20220331104915.jpg",
|
|
|
- url: "http://broadcast.waityou24.cn/files/court/elimg/20220331104915.jpg",
|
|
|
- }],
|
|
|
- },
|
|
|
- ],
|
|
|
+ ismatchList: [],
|
|
|
|
|
|
teamList: [],
|
|
|
|
|
|
btnList: [],
|
|
|
|
|
|
- dialog: { title: '上传比分', show: false, type: '1' }
|
|
|
+ dialog: { title: '上传比分', show: false, type: '1' },
|
|
|
+ form: {},
|
|
|
+
|
|
|
+ },
|
|
|
+ initValidate() {
|
|
|
+ const rules = { red_branch: { required: true }, blue_branch: { required: true }, red_integral: { required: true }, blue_integral: { required: true } }
|
|
|
+
|
|
|
+ const messages = { red_branch: { required: '请输入红方比分', }, blue_branch: { required: '请输入蓝方比分', }, red_integral: { required: '请输入红方积分', }, blue_integral: { required: '请输入蓝方积分', } };
|
|
|
+ this.WxValidate = new WxValidate(rules, messages)
|
|
|
},
|
|
|
tabPath: function (e) {
|
|
|
let { route } = e.detail.detail;
|
|
@@ -52,6 +40,35 @@ Page({
|
|
|
const that = this;
|
|
|
that.setData({ dialog: { title: '上传比分', show: true, type: '1' } })
|
|
|
},
|
|
|
+
|
|
|
+ ismatchChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ const list = that.data.ismatchList;
|
|
|
+ const { value } = e.detail;
|
|
|
+ const data = list[value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({ 'form._id': data._id })
|
|
|
+ that.setData({ 'form.red_name': data.red_name })
|
|
|
+ that.setData({ 'form.blue_name': data.blue_name })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async onSubmit(e) {
|
|
|
+ const that = this;
|
|
|
+ const params = e.detail.value;
|
|
|
+ if (!this.WxValidate.checkForm(params)) {
|
|
|
+ const error = this.WxValidate.errorList[0];
|
|
|
+ wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ const arr = await app.$get(`/courtAdmin/api/schedule/${params._id}`, params)
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `上传比分成功`, icon: 'success', duration: 2000 });
|
|
|
+ that.toClose();
|
|
|
+ that.watchLogin();
|
|
|
+ } else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
matchView: function (e) {
|
|
|
const { id } = e.currentTarget.dataset;
|
|
@@ -87,6 +104,8 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
+
|
|
|
+ this.initValidate();
|
|
|
|
|
|
this.searchHeight();
|
|
|
|