zs 2 سال پیش
والد
کامیت
cc6736448e
5فایلهای تغییر یافته به همراه179 افزوده شده و 2 حذف شده
  1. 54 0
      pages/referee/group.js
  2. 34 0
      pages/referee/group.less
  3. 61 1
      pages/referee/group.wxml
  4. 29 0
      pages/referee/group.wxss
  5. 1 1
      utils/httpUtil.js

+ 54 - 0
pages/referee/group.js

@@ -1,3 +1,4 @@
+import { race_status } from "../../utils/dict";
 const app = getApp()
 Page({
 
@@ -10,6 +11,8 @@ Page({
         list: [],
         dialog: { title: '详细信息', show: false, type: '1' },
         info: {},
+        form: {},
+        statusList: race_status
     },
     // 跳转菜单
     back(e) {
@@ -22,10 +25,61 @@ Page({
         that.setData({ info: item })
         that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
+    // 更换场地
+    toChange: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '您是否确定要更换场地吗?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$post(`/newCourt/api/race/${item._id}`, { is_change: '1' });
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `更换场地完成`, icon: 'error', duration: 2000 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+
+    },
+    // 赛事管理
+    toScore: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        const arr = await app.$get(`/newCourt/api/race/${item._id}`);
+        if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+        that.setData({ dialog: { title: '赛事管理', show: true, type: '2' } });
+    },
+    // 选择比赛状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        if (data) { that.setData({ 'form.status': data.value }) }
+    },
+    // 提交保存
+    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 () {
         const that = this;
+        that.setData({ info: {} })
+        that.setData({ form: {} })
         that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
+        that.watchLogin();
     },
     /**
      * 生命周期函数--监听页面加载

+ 34 - 0
pages/referee/group.less

@@ -104,4 +104,38 @@
             color: #000;
         }
     }
+}
+.dialog_two {
+    width: 80vw;
+
+    .content {
+        background-color: #ffffff;
+        border-bottom: 1px solid #cccccc;
+        display: flex;
+        flex-direction: row;
+        justify-content: space-between;
+        padding: 2vw;
+        width: 76vw;
+
+        .label {
+            width: 25vw;
+            text-align: left;
+            font-size: 14px;
+        }
+
+        .value {
+            width: 65vw;
+            text-align: right;
+            font-size: 14px;
+
+            textarea {
+                width: 65vw;
+            }
+        }
+    }
+
+    .btn {
+        margin: 2vw 0 0 0;
+        text-align: center;
+    }
 }

+ 61 - 1
pages/referee/group.wxml

@@ -32,7 +32,9 @@
                         </view>
                         <view class="btn">
                             <button type="primary" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
-                            <button type="primary" size="mini">赛事比分</button>
+                            <button type="primary" size="mini" bindtap="toScore" data-item="{{item}}">赛事管理</button>
+                            <button type="primary" size="mini" bindtap="toChange" data-item="{{item}}" wx:if="{{item.score_one==16||item.score_two==16}}">更换场地</button>
+
                         </view>
                     </view>
                 </view>
@@ -96,5 +98,63 @@
                 <text class="text1">{{info.status=='0'?'已安排':info.status=='1'?'待开赛':info.status=='2'?'已开赛':info.status=='3'?'已结束':'暂无'}}</text>
             </view>
         </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <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">
+                        <picker bindchange="statusChange" name="status" value="{{form.status}}" range-key='label' range="{{statusList}}">
+                            <view class="input">{{form.status=='0'?'已安排':item.status=='1'?'待开赛':item.status=='2'?'已开赛':item.status=='3'?'已结束':'请选择比赛状态'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手一比分{{form.player_one_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手二比分{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手二比分{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手一比分{{form.player_one_name}}</view>
+                    <view class="value">
+                        <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">
+                        <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">
+                    <button type="primary" size="mini" form-type="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
     </view>
 </e-dialog>

+ 29 - 0
pages/referee/group.wxss

@@ -84,3 +84,32 @@
   font-size: 15px;
   color: #000;
 }
+.dialog_two {
+  width: 80vw;
+}
+.dialog_two .content {
+  background-color: #ffffff;
+  border-bottom: 1px solid #cccccc;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding: 2vw;
+  width: 76vw;
+}
+.dialog_two .content .label {
+  width: 25vw;
+  text-align: left;
+  font-size: 14px;
+}
+.dialog_two .content .value {
+  width: 65vw;
+  text-align: right;
+  font-size: 14px;
+}
+.dialog_two .content .value textarea {
+  width: 65vw;
+}
+.dialog_two .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}

+ 1 - 1
utils/httpUtil.js

@@ -1,4 +1,4 @@
-let serverUrl = "https://broadcast.waityou24.cn";//http://127.0.0.1:15000
+let serverUrl = "http://broadcast.waityou24.cn";//http://127.0.0.1:15000
 let wechatUrl = 'https://broadcast.waityou24.cn';
 
 const getDomain = (uri) => {