guhongwei 2 years ago
parent
commit
cf37ab27b0

+ 1 - 0
app.json

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

+ 1 - 5
pages/eliminate/add.js

@@ -192,11 +192,7 @@ Page({
     async search() {
         let res = await app.$get(`/newCourt/api/eliminatArrange/getOne`, this.query)
         if (app.$checkRes(res)) {
-            const { arrange } = res.data;
-            this.setData({
-                arrangeData: res.data,
-                arrangeList: arrange
-            })
+            if (res.data) { const { arrange } = res.data; this.setData({ arrangeData: res.data, arrangeList: arrange }) }
         }
         res = await app.$get(`/newCourt/api/eliminateRace`, this.query)
         if (app.$checkRes(res)) {

+ 56 - 10
pages/eliminate/index.js

@@ -1,4 +1,5 @@
 const app = getApp()
+import { race_status } from '../../utils/dict';
 Page({
 
     /**
@@ -6,6 +7,7 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
+        list: [],
         dialog: { title: '赛程信息', show: false, type: '1' },
         form: {},
         // 赛事信息
@@ -14,11 +16,56 @@ Page({
         groupingList: [],
         //组内项目
         projectList: [],
+        statusList: race_status,
     },
     // 跳转菜单
     back(e) {
-        wx.navigateBack({
-            delta: 1,
+        wx.navigateBack({ delta: 1 })
+    },
+    // 赛事管理
+    toScore: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        const arr = await app.$get(`/newCourt/api/eliminateRace/${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 }) }
+    },
+    // 提交保存
+    scoreSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const arr = await app.$post(`/newCourt/api/eliminateRace/${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 })
+        }
+    },
+    // 删除
+    toDel: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/newCourt/api/eliminateRace/${item._id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
         })
     },
     // 添加
@@ -30,7 +77,7 @@ Page({
     toClose: function () {
         const that = this;
         that.setData({ form: {} })
-        that.setData({ dialog: { title: '赛程信息', show: true, type: '1' } })
+        that.setData({ dialog: { title: '赛程信息', show: false, type: '1' } })
 
     },
     // 选择赛事
@@ -85,10 +132,7 @@ Page({
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-        const that = this;
-
-    },
+    onLoad: function (options) { },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -111,9 +155,11 @@ Page({
             success: async res => {
                 let arr;
                 // 比赛信息
-                arr = await app.$get(`/newCourt/api/match`, { status: '0' });//2
-                if (arr.errcode == '0') { that.setData({ matchList: arr.data }) }
-
+                arr = await app.$get(`/newCourt/api/match`, { status: '0' });
+                if (arr.errcode == '0') { that.setData({ matchList: arr.data }) };
+                // 淘汰赛信息
+                arr = await app.$get(`/newCourt/api/eliminateRace`);
+                if (arr.errcode == '0') { that.setData({ list: arr.data }) };
             },
             fail: res => {
                 wx.redirectTo({ url: '/pages/index/index', })

+ 100 - 1
pages/eliminate/index.less

@@ -30,7 +30,71 @@
     .two {
         flex-grow: 1;
         position: relative;
-        background-color: #ff0000;
+
+        .scroll-view {
+            position: absolute;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+
+            .list-scroll-view {
+                display: flex;
+                flex-wrap: wrap;
+                align-content: flex-start;
+                justify-content: space-between;
+
+                .list {
+                    background-color: #ffffff;
+                    border-bottom: 1px solid #cccccc;
+                    width: 96vw;
+                    padding: 2vw;
+
+                    .name {
+                        font-size: 18px;
+                        margin: 0 0 1vw 0;
+                        font-weight: bold;
+
+                        text {
+                            color: #ff0000;
+                            font-size: 20px;
+                            padding: 0 2vw;
+                        }
+                    }
+
+                    .other {
+                        margin: 0 0 1vw 0;
+
+                        .other_1 {
+                            margin: 0 0 1vw 0;
+                            font-size: 15px;
+
+                            text {
+                                color: #000000;
+                            }
+
+                            text:nth-child(1) {
+                                color: #858585;
+                            }
+
+                        }
+                    }
+
+                    .btn {
+                        text-align: center;
+
+                        button {
+                            margin: 0 2vw;
+                            font-size: 14px;
+                        }
+                    }
+                }
+
+                .list:last-child {
+                    border-bottom: none;
+                }
+            }
+        }
     }
 }
 
@@ -63,6 +127,41 @@
         }
     }
 
+    .btn {
+        margin: 2vw 0 0 0;
+        text-align: center;
+    }
+}
+
+.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;

+ 63 - 1
pages/eliminate/index.wxml

@@ -6,7 +6,23 @@
             </view>
         </view>
         <view class="zero two">
-            列表
+            <scroll-view scroll-y="true" class="scroll-view">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="name">{{item.player_one_name||'暂无'}}<text>pk</text>{{item.player_two_name||'暂无'}}</view>
+                        <view class="other">
+                            <view class="other_1"><text>赛事名称:</text><text>{{item.match_name||'暂无'}}</text></view>
+                            <view class="other_1"><text>比赛场地:</text><text>{{item.ground_name||'暂无'}}</text></view>
+                            <view class="other_1"><text>比赛时间:</text><text>{{item.match_time||'暂无'}}</text></view>
+                            <view class="other_1"><text>比赛状态:</text><text>{{item.status=='0'?'已安排':item.status=='1'?'待开赛':item.status=='2'?'已开赛':item.status=='3'?'已结束':'暂无'}}</text></view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toScore" data-item="{{item}}">赛事管理</button>
+                            <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">信息删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
         </view>
     </view>
 </mobile-main>
@@ -43,5 +59,51 @@
                 </view>
             </form>
         </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <form catchsubmit="scoreSubmit">
+                <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'?'已安排':form.status=='1'?'待开赛':form.status=='2'?'已开赛':form.status=='3'?'已结束':'请选择'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手一比分</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">
+                        <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">
+                        <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>

+ 81 - 1
pages/eliminate/index.wxss

@@ -26,7 +26,58 @@
 .main .two {
   flex-grow: 1;
   position: relative;
-  background-color: #ff0000;
+}
+.main .two .scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.main .two .scroll-view .list-scroll-view {
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  justify-content: space-between;
+}
+.main .two .scroll-view .list-scroll-view .list {
+  background-color: #ffffff;
+  border-bottom: 1px solid #cccccc;
+  width: 96vw;
+  padding: 2vw;
+}
+.main .two .scroll-view .list-scroll-view .list .name {
+  font-size: 18px;
+  margin: 0 0 1vw 0;
+  font-weight: bold;
+}
+.main .two .scroll-view .list-scroll-view .list .name text {
+  color: #ff0000;
+  font-size: 20px;
+  padding: 0 2vw;
+}
+.main .two .scroll-view .list-scroll-view .list .other {
+  margin: 0 0 1vw 0;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 {
+  margin: 0 0 1vw 0;
+  font-size: 15px;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 text {
+  color: #000000;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 text:nth-child(1) {
+  color: #858585;
+}
+.main .two .scroll-view .list-scroll-view .list .btn {
+  text-align: center;
+}
+.main .two .scroll-view .list-scroll-view .list .btn button {
+  margin: 0 2vw;
+  font-size: 14px;
+}
+.main .two .scroll-view .list-scroll-view .list:last-child {
+  border-bottom: none;
 }
 .dialog_one {
   width: 80vw;
@@ -57,3 +108,32 @@
   margin: 2vw 0 0 0;
   text-align: center;
 }
+.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
project.private.config.json

@@ -1,7 +1,7 @@
 {
     "projectname": "%E7%BE%BD%E6%AF%9B%E7%90%83%E7%BA%BF%E4%B8%8A%E6%AF%94%E8%B5%9B",
     "setting": {
-        "compileHotReLoad": false
+        "compileHotReLoad": true
     },
     "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
 }

+ 1 - 1
utils/httpUtil.js

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