guhongwei 2 years ago
parent
commit
2d75e4a6a2
7 changed files with 28 additions and 11 deletions
  1. 0 2
      app.json
  2. 0 1
      pages/match/shteam.less
  3. 0 1
      pages/match/shteam.wxss
  4. 10 2
      pages/race/index.js
  5. 16 3
      pages/race/index.wxml
  6. 1 1
      pages/user/index.less
  7. 1 1
      pages/user/index.wxss

+ 0 - 2
app.json

@@ -1,7 +1,5 @@
 {
     "pages": [
-
-      
         "pages/index/index",
         "pages/register/index",
         "pages/home/index",

+ 0 - 1
pages/match/shteam.less

@@ -84,7 +84,6 @@
         padding: 10px;
 
         .text {
-            width: 46vw;
             color: #666;
             font-size: 16px;
         }

+ 0 - 1
pages/match/shteam.wxss

@@ -72,7 +72,6 @@
   padding: 10px;
 }
 .dialog_one .one_1 .text {
-  width: 46vw;
   color: #666;
   font-size: 16px;
 }

+ 10 - 2
pages/race/index.js

@@ -43,8 +43,16 @@ Page({
         if (data) { that.setData({ 'form.status': data.value }) }
     },
     // 提交保存
-    onSubmit: function (e) {
-        console.log(e);
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const arr = await app.$post(`/newCourt/api/race/${params._id}`, params);
+        if (arr.errcode == '0') {
+            wx.showToast({ title: `上分成功`, icon: 'error', duration: 2000 })
+            that.toClose()
+        } else {
+            wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
     },
     // 关闭弹框
     toClose: function () {

+ 16 - 3
pages/race/index.wxml

@@ -39,6 +39,12 @@
     <view slot="info">
         <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
             <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
                 <view class="content">
                     <view class="label">比赛状态</view>
                     <view class="value">
@@ -50,19 +56,26 @@
                 <view class="content">
                     <view class="label">选手一比分</view>
                     <view class="value">
-                        <input type="number" name="score_one" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
                     </view>
                 </view>
                 <view class="content">
                     <view class="label">选手二比分</view>
                     <view class="value">
-                        <input type="number" name="score_two" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
                     </view>
                 </view>
                 <view class="content">
                     <view class="label">胜者</view>
                     <view class="value">
-                        <input type="text" name="winner" value="{{form.winner}}" placeholder="请输入胜者" />
+                        <radio-group name="winner">
+                            <label>
+                                <radio value="{{form.player_one}}" checked="{{form.player_one==form.winner?true:false}}" />{{form.player_one_name}}
+                            </label>
+                            <label>
+                                <radio value="{{form.player_two}}" checked="{{form.player_two==form.winner?true:false}}" />{{form.player_two_name}}
+                            </label>
+                        </radio-group>
                     </view>
                 </view>
                 <view class="btn">

+ 1 - 1
pages/user/index.less

@@ -4,7 +4,7 @@
     .one {
         width: 92vw;
         margin: 0 0 2vw 0;
-        background-color: #cccccc;
+        background-color: #f1f1f1;
         padding: 2vw;
 
     }

+ 1 - 1
pages/user/index.wxss

@@ -4,7 +4,7 @@
 .main .one {
   width: 92vw;
   margin: 0 0 2vw 0;
-  background-color: #cccccc;
+  background-color: #f1f1f1;
   padding: 2vw;
 }
 .main .two {