zs 2 years ago
parent
commit
d4909e838b
2 changed files with 16 additions and 12 deletions
  1. 9 6
      pages/referee/eliminate.js
  2. 7 6
      pages/referee/group.js

+ 9 - 6
pages/referee/eliminate.js

@@ -22,14 +22,17 @@ Page({
     toView: async function (e) {
         const that = this;
         const { item } = e.currentTarget.dataset;
-        if (item.winner) {
-            const arr = await app.$get(`/newCourt/api/user/${item.winner}`);
-            if (arr.errcode == '0') {
-                item.winner_name = arr.data.name
+        const arr = await app.$get(`/newCourt/api/eliminateRace/${item._id}`);
+        console.log(arr.data);
+        if (arr.errcode == '0') {
+            if (arr.data.winner) {
+                const user = await app.$get(`/newCourt/api/user/${arr.data.winner}`);
+                console.log(user);
+                if (user.errcode == '0') { arr.data.winner_name = user.data.name }
             }
+            that.setData({ info: arr.data });
+            that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
         }
-        that.setData({ info: item })
-        that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 更换场地
     toChange: async function (e) {

+ 7 - 6
pages/referee/group.js

@@ -22,14 +22,15 @@ Page({
     toView: async function (e) {
         const that = this;
         const { item } = e.currentTarget.dataset;
-        if (item.winner) {
-            const arr = await app.$get(`/newCourt/api/user/${item.winner}`);
-            if (arr.errcode == '0') {
-                item.winner_name = arr.data.name
+        const arr = await app.$get(`/newCourt/api/race/${item._id}`)
+        if (arr.errcode == '0') {
+            if (arr.data.winner) {
+                const user = await app.$get(`/newCourt/api/user/${arr.data.winner}`);
+                if (user.errcode == '0') { arr.data.winner_name = user.data.name }
             }
+            that.setData({ info: arr.data });
+            that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
         }
-        that.setData({ info: item })
-        that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 更换场地
     toChange: async function (e) {