guhongwei 2 年 前
コミット
06353b070e

+ 3 - 2
app.json

@@ -20,18 +20,19 @@
         "pages/matchadmin/index",
         "pages/matchadmin/layoutInfo",
         "pages/matchadmin/layout",
-        "pages/matchteam/layoutdetail",
         "pages/teamInfo/index",
         "pages/matchteam/index",
         "pages/matchteam/detail",
         "pages/matchteam/layout",
+        "pages/matchteam/layoutdetail",
         "pages/teamMembers/index",
         "pages/teamDissolution/index",
         "pages/teamapply/index",
         "pages/uploadimg/index",
         "pages/updatepd/index",
         "pages/test/index",
-        "pages/logs/logs"
+        "pages/logs/logs",
+        "pages/matchadmin/layoutdetail"
     ],
     "usingComponents": {
         "van-button": "/miniprogram_npm/@vant/weapp/button/index",

+ 5 - 0
pages/match/info.js

@@ -45,6 +45,11 @@ Page({
         const that = this;
         that.setData({ 'tabs.active': e.detail.name })
     },
+    // 赛程信息
+    toSchedule: function (e) {
+        let { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/schedule?id=${id}` })
+    },
     /**
      * 生命周期函数--监听页面加载
      */

+ 1 - 1
pages/match/info.wxml

@@ -25,7 +25,7 @@
                     </view>
                 </view>
                 <view wx:if="{{tabs.active=='c'}}" class="c">
-                    <view class="list" wx:for="{{scheduleList}}" wx:key="item">
+                    <view class="list" wx:for="{{scheduleList}}" wx:key="item" bindtap="toSchedule" data-id="{{item._id}}">
                         <view class="list_1" style="background-image: url({{bg_img1}})">
                             <text>{{item.status=='0'?'未开始':item.status=='1'?'开始':'已结束'}}</text>
                             <text>{{item.match_time}}</text>

+ 8 - 4
pages/match/schedule.js

@@ -112,11 +112,15 @@ Page({
                 let schedule = arr.data;
                 if (arr.errcode == '0') that.setData({ form: schedule }); that.setData({ match_file: schedule.match_file || [] });
                 // 红方
-                arr = await app.$get(`/courtAdmin/api/team/${schedule.red_id}`);
-                if (arr.errcode == '0') that.setData({ redTeam: arr.data });
+                if (schedule && schedule.red_id) {
+                    arr = await app.$get(`/courtAdmin/api/team/${schedule.red_id}`);
+                    if (arr.errcode == '0') that.setData({ redTeam: arr.data });
+                }
                 // 蓝方
-                arr = await app.$get(`/courtAdmin/api/team/${schedule.blue_id}`);
-                if (arr.errcode == '0') that.setData({ blueTeam: arr.data });
+                if (schedule && schedule.blue_id) {
+                    arr = await app.$get(`/courtAdmin/api/team/${schedule.blue_id}`);
+                    if (arr.errcode == '0') that.setData({ blueTeam: arr.data });
+                }
             },
             fail: res => {
                 return wx.redirectTo({ url: '/pages/login/index', })

+ 4 - 2
pages/matchadmin/layout.js

@@ -7,7 +7,7 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '编辑赛信息', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '编辑赛信息', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
         // 用户信息
@@ -94,7 +94,9 @@ Page({
      */
     onLoad: function (options) {
         const that = this;
-        if (options && options.id) that.setData({ match_id: options.id })
+        const { info_id, id } = options;
+        that.setData({ match_id: id })
+        that.setData({ info_id: info_id })
         //验证规则函数
         this.initValidate();
         // 计算高度

+ 1 - 0
pages/matchadmin/layoutInfo.js

@@ -43,6 +43,7 @@ Page({
     toEdit: async function (e) {
         const that = this;
         let { id } = e.currentTarget.dataset;
+        // wx.navigateTo({ url: `/pages/matchadmin/layout?info_id=${id}&id=${that.data.match_id}` })
         const arr = await app.$get(`/courtAdmin/api/schedule/${id}`);
         if (arr.errcode == '0') {
             that.setData({ form: arr.data })