guhongwei 2 years ago
parent
commit
1334ddd98a
3 changed files with 81 additions and 4 deletions
  1. 30 3
      pages/matchadmin/layoutInfo.js
  2. 16 1
      pages/matchadmin/layoutInfo.wxml
  3. 35 0
      pages/matchadmin/layoutInfo.wxss

+ 30 - 3
pages/matchadmin/layoutInfo.js

@@ -17,7 +17,9 @@ Page({
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         //详情
-        form: {}
+        form: {},
+        // 状态
+        statusList: [{ label: '未开始', value: '0' }, { label: '进行中', value: '1' }, { label: '已结束', value: '2' }],
     },
     back: function () {
         wx.navigateBack({ url: '/pages/matchadmin/index' })
@@ -37,8 +39,33 @@ Page({
             that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
         }
     },
-    //维护
-    toEdit: function () {
+    //比赛进度
+    toEdit: async function (e) {
+        const that = this;
+        let { id } = e.currentTarget.dataset;
+        const arr = await app.$get(`/courtAdmin/api/schedule/${id}`);
+        if (arr.errcode == '0') {
+            that.setData({ form: arr.data })
+            that.setData({ dialog: { title: '比赛进度', show: true, type: '2' } })
+        }
+    },
+    // 选择状态
+    statusChange: function (e) {
+        const that = this;
+        const { value } = e.detail;
+        that.setData({ 'form.status': value })
+    },
+    // 提交
+    onSubmit: async function (e) {
+        const that = this;
+        const data = that.data.form;
+        const params = e.detail.value;
+        const arr = await app.$post(`/courtAdmin/api/schedule/${data.id}`, params);
+        if (arr.errcode == '0') {
+            wx.showToast({ title: `维护信息成功`, icon: 'error', duration: 2000 });
+            that.toClose();
+            that.watchLogin();
+        } else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
     },
     // 维护赛程信息
     toRace: function (e) {

+ 16 - 1
pages/matchadmin/layoutInfo.wxml

@@ -11,7 +11,7 @@
                     <view class="otherInfo"><text>红方比分:</text><text>{{item.red_branch||'0'}}</text></view>
                     <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text></view>
                     <view class="otherInfo"><text>蓝方比分: </text><text>{{item.blue_branch||'0'}}</text></view>
-                    <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text></view>
+                    <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'进行中':'已结束'}}</text></view>
                 </view>
                 <view class="btn">
                     <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
@@ -90,5 +90,20 @@
                 <text class="text1">{{form.is_bye=='true'?'是':'否'}}</text>
             </view>
         </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <form bindsubmit="onSubmit">
+                <view class="content">
+                    <view class="label textOver">状态</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="statusChange" name="status" value="{{form.status}}" range-key="label" range="{{statusList}}">
+                            <view class="input">{{form.status=='0'?'未开始':form.status=='1'?'进行中':'已结束'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
     </view>
 </e-dialog>

+ 35 - 0
pages/matchadmin/layoutInfo.wxss

@@ -124,4 +124,39 @@
 .dialog_one .one_1 .members {
     padding: 5px;
     font-size: 12px;
+}
+
+.dialog_two {
+    float: left;
+    width: 100%;
+}
+
+.dialog_two .content {
+    float: left;
+    width: 100%;
+    border-bottom: 1px solid #ccc;
+    padding: 10px 0;
+    margin: 0 0 10px 0;
+    font-size: 14px;
+}
+
+.dialog_two .content .label {
+    float: left;
+    width: 20%;
+}
+
+.dialog_two .content .value {
+    float: left;
+    width: 80%;
+    text-align: right;
+}
+
+.dialog_two .btn {
+    float: left;
+    width: 100%;
+    text-align: center;
+}
+
+.dialog_two .btn button {
+    font-size: 14px;
 }