Pārlūkot izejas kodu

修改创建比赛

zs 3 gadi atpakaļ
vecāks
revīzija
61f481682e

+ 4 - 4
pages/administration/index.wxml

@@ -8,15 +8,15 @@
       <image class="imags" src="{{match}}"></image>
     </view>
     <view class="thr">
-      <view class="left">
-        <text class="th"  bindtap='jump' data-type="ranking">团队排名</text>
+      <view class="left" bindtap='jump' data-type="ranking">
+        <text class="th">团队排名</text>
         <view class="imagx">
           <text class="icon iconfont icon-paiming_paiming"></text>
         </view>
         <image class="imagh" src="{{black}}"></image>
       </view>
-      <view class="right">
-        <text class="th"  bindtap='jump' data-type="manage">团队审批</text>
+      <view class="right" bindtap='jump' data-type="manage">
+        <text class="th">团队审批</text>
         <view class="imagx">
           <text class="icon iconfont icon-shenpi"></text>
         </view>

+ 16 - 26
pages/competition/index.js

@@ -10,12 +10,11 @@ Page({
     frameStyle: { useTop: true, name: '创建比赛', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-    form:{
-      date: '2022-04-11',//默认起始时间  
-      date2: '2022-04-24',//默认结束时间 
-      singledate: '2022-04-11',
-      time: '12:01',
-    },
+    form: {},
+    singledate: '2022-04-11',
+    time: '12:01',
+    date: '2022-04-11',//默认起始时间  
+    date2: '2022-04-24',//默认结束时间 
     // 赛制信息
     // 默认值
     szValue: [],
@@ -75,44 +74,35 @@ Page({
   //日期选择器
   bindDateChange3: function (e) {
     this.setData({
-      ['form.singledate']: e.detail.value
+      singledate: e.detail.value
     })
   },
   //时间选择器
   bindTimeChange: function (e) {
     this.setData({
-      ['form.time']: e.detail.value
+      time: e.detail.value
     })
   },
   // 时间段选择  
   bindDateChange(e) {
     let that = this;
     that.setData({
-      ['form.date']: e.detail.value,
+      date: e.detail.value,
     })
   },
   bindDateChange2(e) {
     let that = this;
     that.setData({
-      ['form.date2']: e.detail.value,
+      date2: e.detail.value,
     })
   },
   // 提交创建
   onSubmit: function (e) {
     const param = e.detail.value;
-    var name = param.names;
-    var match_time = param.date + ' - ' + param.date2;
-    var single_time = param.singledate + ' ' + param.time;
-    var address = param.address;
-    var format = this.data.szList;
-    const params = {
-      "name": name,
-      "match_time": match_time,
-      "single_time": single_time,
-      "address": address,
-      "format": format,
-    };
-    if (!this.WxValidate.checkForm(params)) {
+    param.match_time = this.data.date + ' - ' + this.data.date2;
+    param.single_time = this.data.singledate + ' ' + this.data.time;
+    param.format = this.data.szList;
+    if (!this.WxValidate.checkForm(param)) {
       const error = this.WxValidate.errorList[0];
       wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
       return false
@@ -120,7 +110,7 @@ Page({
       wx.request({
         url: `${app.globalData.publicUrl}/courtAdmin/api/match`,
         method: 'post',
-        data: params,
+        data: param,
         success(res) {
           if (res.data.errcode == 0) {
             wx.showToast({ title: `创建比赛成功`, icon: 'success', duration: 2000 })
@@ -143,8 +133,8 @@ Page({
     //获取当前时间
     let date = moment().format('YYYY-MM-DD');
     this.setData({
-      ['form.date']: date,
-      ['form.singledate']: date
+      date: date,
+      singledate: date
     });
     //验证规则函数
     this.initValidate();

+ 11 - 11
pages/competition/index.wxml

@@ -5,21 +5,21 @@
         <view class="content">
           <view class="page1"><text>比赛名称</text></view>
           <view class="input">
-            <input name="names" value="{{form.names}}" maxlength="11" placeholder="请输入比赛名称"></input>
+            <input name="name" value="{{form.name}}" placeholder="请输入比赛名称"></input>
           </view>
         </view>
         <view class="content">
           <view class="page1"><text>时间</text></view>
           <view class="picker_group">
-            <picker name="date" mode="date" value="{{form.date}}" end="{{form.date2}}" bindchange="bindDateChange">
+            <picker mode="date" value="{{date}}" end="{{date2}}" bindchange="bindDateChange">
               <view class="picker">
-                {{form.date}}
+                {{date}}
               </view>
             </picker>
             <text>—</text>
-            <picker name="date2" mode="date" value="{{form.date2}}" start="{{form.date}}" end="2050-01-01" bindchange="bindDateChange2">
+            <picker mode="date" value="{{date2}}" start="{{date}}" end="2080-01-01" bindchange="bindDateChange2">
               <view class="picker">
-                {{form.date2}}
+                {{date2}}
               </view>
             </picker>
           </view>
@@ -27,14 +27,14 @@
         <view class="content">
           <view class="section">
             <view class="section__title">单场时间</view>
-            <picker name="singledate" mode="date" value="{{form.singledate}}" start="2018-09-01" end="2150-09-01" bindchange="bindDateChange3">
+            <picker mode="date" value="{{singledate}}" start="2018-09-01" end="2150-09-01" bindchange="bindDateChange3">
               <view class="picker1">
-                {{form.singledate}}
+                {{singledate}}
               </view>
             </picker>
-            <picker name="time" mode="time" value="{{form.time}}" start="00:00" end="24:00" bindchange="bindTimeChange">
+            <picker mode="time" value="{{time}}" start="00:00" end="24:00" bindchange="bindTimeChange">
               <view class="picker2">
-                {{form.time}}
+                {{time}}
               </view>
             </picker>
           </view>
@@ -42,7 +42,7 @@
         <view class="content contents">
           <view class="page1"><text>地点</text></view>
           <view class="input">
-            <input name="address" value="{{form.address}}" maxlength="11" placeholder="请输入地点"></input>
+            <input name="address" value="{{form.address}}" placeholder="请输入地点"></input>
           </view>
         </view>
         <view class="content">
@@ -59,7 +59,7 @@
           <view class="multone">
             <view class="mult1" wx:for="{{szList}}" wx:key="item">
               <view class="mult00">赛制</view>
-              <view class="mult88" >
+              <view class="mult88">
                 <text>{{item.type}}-{{item.name}}</text>
                 <text class=" icon iconfont icon-jianhao" bindtap="toDel" data-index="{{index}}"></text>
               </view>