瀏覽代碼

修改添加赛程

YY 2 年之前
父節點
當前提交
0c2d01aaa2

+ 73 - 3
pagesMatch/matchAdmin/elimmatch/add.js

@@ -28,11 +28,61 @@ Page({
             ],
             ],
         },
         },
         show: false,
         show: false,
-        selectNode: {}
+        selectNode: {},
+        dialog: { title: '添加信息', show: false, type: '1' },
+        form: {},
+        // 场地
+        addressList: [],
+        // 裁判列表
+        refereeList: []
     },
     },
     // 返回
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    // 修改
+    toEdit: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        if (item._id) {
+            that.setData({ 'form.id': item._id })
+            that.setData({ dialog: { title: '添加信息', show: true, type: '1' } })
+        }
+    },
+    // 场地
+    addressChange: async function (e) {
+        const that = this;
+        let data = that.data.addressList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.address_id': data.id, 'form.address_id_name': data.name });
+        }
+    },
+    // 裁判
+    refereeChange: async function (e) {
+        const that = this;
+        let data = that.data.refereeList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.referee_id': data.id, 'form.referee_id_name': data.name });
+        }
+    },
+    // 选择时间
+    datetimeChange: function (e) {
+        const that = this;
+        that.setData({ [`form.${e.detail.name}`]: e.detail.datetime });
+    },
+    //提交查询
+    onSubmit: async function (e) {
+        const that = this;
+        const form = that.data.form;
+        let arr;
+        if (form.id) { arr = await app.$post(`http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/${form.id}`, form, 'race'); }
+        if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.toClose(); that.search();}
+        else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ form: {} })
+        that.setData({ dialog: { title: '查询条件', show: false, type: '1' } })
+    },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
@@ -62,6 +112,15 @@ Page({
                 this.setData({ playerList })
                 this.setData({ playerList })
             }
             }
         })
         })
+        wx.request({
+            url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
+            success: (res) => {
+                const schList = res?.data?.data
+                console.log(res.data.data);
+                this.setData({ schList })
+            }
+        })
+
     },
     },
     /**
     /**
      * 选中选手的处理
      * 选中选手的处理
@@ -201,7 +260,18 @@ Page({
         const that = this;
         const that = this;
         wx.getStorage({
         wx.getStorage({
             key: 'raceuser',
             key: 'raceuser',
-            success: async res => { },
+            success: async res => {
+                // 场地
+                let arr = await app.$get(`/matchAddress`, { belong_id: res.data._id, is_use: '0' }, 'race');
+                if (arr.errcode == '0') { that.setData({ addressList: arr.data }) }
+                // 裁判
+                const aee = await app.$get(`/user`, { parent_id: res.data._id, type: '2' }, 'race')
+                if (aee.errcode == '0') {
+                    for (const val of aee.data) { val.name = val.user_id.name }
+                    that.setData({ refereeList: aee.data })
+                }
+
+            },
             fail: async res => {
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
                 wx.redirectTo({ url: '/pages/index/index' })
             }
             }

+ 3 - 1
pagesMatch/matchAdmin/elimmatch/add.json

@@ -4,6 +4,8 @@
         "mobile-main": "/commpents/mobile-frame/index",
         "mobile-main": "/commpents/mobile-frame/index",
         "f6-darge": "/commpents/f6darge/index",
         "f6-darge": "/commpents/f6darge/index",
         "s-tab": "/commpents/tabs/index",
         "s-tab": "/commpents/tabs/index",
-        "drawer": "/commpents/drawer/index"
+        "drawer": "/commpents/drawer/index",
+        "datatime-picker": "/commpents/datetime-picker/index",
+        "dialog": "/commpents/dialog/index"
     }
     }
 }
 }

+ 77 - 0
pagesMatch/matchAdmin/elimmatch/add.less

@@ -7,6 +7,43 @@
     .one {
     .one {
         width: 100vw;
         width: 100vw;
     }
     }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+        width: 100vw;
+
+        .c {
+            padding: 0 2vw;
+            width: 96vw;
+
+            .schList {
+                text-align: center;
+                background-color: var(--f1Color);
+                margin: 3vw 0;
+                padding: 3vw;
+
+                .name {
+                    display: flex;
+                    flex-direction: row;
+                    justify-content: space-around;
+                    font-size: var(--font20Szie);
+                    font-weight: 1000;
+                    margin: 3vw 0;
+                }
+
+                .change {
+                    display: flex;
+                    flex-direction: row;
+                    justify-content: space-around;
+                }
+
+                button {
+                    margin: 0 5vw;
+                }
+            }
+        }
+    }
 }
 }
 
 
 .scroll-view {
 .scroll-view {
@@ -20,4 +57,44 @@
         display: flex;
         display: flex;
         flex-direction: column;
         flex-direction: column;
     }
     }
+}
+.dialog_1 {
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .value {
+            flex-grow: 1;
+            color: var(--blackColor);
+            width: 20vw;
+
+            .checkbox {
+                display: flex;
+                flex-direction: row;
+                flex-wrap: wrap;
+
+                .member {
+                    width: 23vw;
+                    margin: 0 1vw 0 0;
+                }
+
+                .memberTeam {
+                    width: 40vw;
+                    margin: 0 1vw 0 0;
+                }
+            }
+        }
+    }
+
+    .btn {
+        text-align: center;
+        margin: 3vw 0;
+
+        button {
+            margin: 0 2vw;
+        }
+    }
 }
 }

+ 78 - 15
pagesMatch/matchAdmin/elimmatch/add.wxml

@@ -1,25 +1,88 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
     <view slot="info" class="container main">
         <view class="one">
         <view class="one">
-            <view>
-                <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
-            </view>
-            <view>
-                <view wx:if="{{tabs.active=='a'}}">
-                    <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{winData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
-                </view>
-                <view wx:elif="{{tabs.active=='b'}}">
-                    <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{loseData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
-                </view>
-                <view wx:elif="{{tabs.active=='c'}}">
-                    <view wx:for="{{schList}}" wx:for-item="s">
-                        {{s.player_one_name || s.player_one_node}} - {{s.player_two_name || s.player_two_node}}
+            <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view">
+                <view class="list-scroll-view">
+                    <view wx:if="{{tabs.active=='a'}}">
+                        <scroll-view scroll-y="true" class="scroll-view">
+                            <view class="list-scroll-view">
+                                <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{winData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
+                            </view>
+                        </scroll-view>
+                    </view>
+                    <view wx:elif="{{tabs.active=='b'}}">
+                        <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{loseData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
+                    </view>
+                    <view wx:elif="{{tabs.active=='c'}}" class="c">
+                        <scroll-view scroll-y="true" class="scroll-view">
+                            <view class="list-scroll-view">
+                                <view wx:for="{{schList}}" wx:for-item="s">
+                                    <view class="schList">
+                                        <view class="change">
+                                            <view class="change_1 textOver">
+                                                <view>{{s.address_id.name||'暂无场地'}}</view>
+                                            </view>
+                                            <view class="change_1 textOver">
+                                                <view>{{s.referee_id.user_id.name||'暂无裁判'}}</view>
+                                            </view>
+                                            <view class="change_1 textOver">
+                                                <view>{{s.match_time||'暂无时间'}}</view>
+                                            </view>
+                                        </view>
+                                        <view class="name">
+                                            <view class="name_1">{{s.player_one_name || s.player_one_node}}</view>
+                                            <view> <text style="color: red;">PK</text></view>
+                                            <view class="name_1">{{s.player_two_name || s.player_two_node}}</view>
+                                        </view>
+                                        <view class="btn">
+                                            <button type="primary" bindtap="toEdit" size="mini" data-item="{{s}}">添加信息</button>
+                                        </view>
+                                    </view>
+                                </view>
+                            </view>
+                        </scroll-view>
                     </view>
                     </view>
                 </view>
                 </view>
-            </view>
+            </scroll-view>
         </view>
         </view>
     </view>
     </view>
 </mobile-main>
 </mobile-main>
 <view>
 <view>
     <drawer show="{{show}}" list="{{playerList}}" label="name" bind:select="selectPlayer"></drawer>
     <drawer show="{{show}}" list="{{playerList}}" label="name" bind:select="selectPlayer"></drawer>
-</view>
+</view>
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">裁判:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="refereeChange" name="referee_id" value="{{form.referee_id}}" range="{{refereeList}}" range-key="name">
+                            <view class="picker">{{form.referee_id_name||'请选择裁判名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">场地:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="addressChange" name="address_id" value="{{form.address_id}}" range="{{addressList}}" range-key="name">
+                            <view class="picker">{{form.address_id_name||'请选择场地'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛时间:</view>
+                    <view class="value">
+                        <datatime-picker datetime="{{form.match_time}}" name="match_time" bind:datetimeChange="datetimeChange"></datatime-picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</dialog>

+ 63 - 0
pagesMatch/matchAdmin/elimmatch/add.wxss

@@ -6,6 +6,37 @@
 .main .one {
 .main .one {
   width: 100vw;
   width: 100vw;
 }
 }
+.main .two {
+  position: relative;
+  flex-grow: 1;
+  width: 100vw;
+}
+.main .two .c {
+  padding: 0 2vw;
+  width: 96vw;
+}
+.main .two .c .schList {
+  text-align: center;
+  background-color: var(--f1Color);
+  margin: 3vw 0;
+  padding: 3vw;
+}
+.main .two .c .schList .name {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  font-size: var(--font20Szie);
+  font-weight: 1000;
+  margin: 3vw 0;
+}
+.main .two .c .schList .change {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+}
+.main .two .c .schList button {
+  margin: 0 5vw;
+}
 .scroll-view {
 .scroll-view {
   position: absolute;
   position: absolute;
   top: 0;
   top: 0;
@@ -17,3 +48,35 @@
   display: flex;
   display: flex;
   flex-direction: column;
   flex-direction: column;
 }
 }
+.dialog_1 .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_1 .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+  width: 20vw;
+}
+.dialog_1 .content .value .checkbox {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
+.dialog_1 .content .value .checkbox .member {
+  width: 23vw;
+  margin: 0 1vw 0 0;
+}
+.dialog_1 .content .value .checkbox .memberTeam {
+  width: 40vw;
+  margin: 0 1vw 0 0;
+}
+.dialog_1 .btn {
+  text-align: center;
+  margin: 3vw 0;
+}
+.dialog_1 .btn button {
+  margin: 0 2vw;
+}

+ 1 - 1
project.private.config.json

@@ -1,7 +1,7 @@
 {
 {
     "projectname": "%E7%BE%BD%E6%A0%A1%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0",
     "projectname": "%E7%BE%BD%E6%A0%A1%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0",
     "setting": {
     "setting": {
-        "compileHotReLoad": false
+        "compileHotReLoad": true
     },
     },
     "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
     "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
 }
 }