Browse Source

组队信息

zs 2 years ago
parent
commit
7cdb001b5d
2 changed files with 34 additions and 11 deletions
  1. 2 2
      pages/usermyorder/index.js
  2. 32 9
      pages/usermyteam/index.js

+ 2 - 2
pages/usermyorder/index.js

@@ -66,8 +66,8 @@ Page({
                 const arr = await app.$get(`/newCourt/api/payOrder`, { openid: res.data.openid })
                 if (arr.errcode == '0') {
                     let list = arr.data;
-                    list = list.map(i => ({ ...i, statusZh: this.getStatusZh(i.status) }))
-                    this.setData({ list })
+                    list = list.map(i => ({ ...i, statusZh: that.getStatusZh(i.status) }))
+                    that.setData({ list })
                 }
             },
             fail: res => {

+ 32 - 9
pages/usermyteam/index.js

@@ -6,13 +6,7 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '组队信息', leftArrow: true, useBar: false },
-        list: [
-            {
-                apply_time: '2022-01-01',
-                teammate_name: '申请队友名称',
-                status: '0'
-            }
-        ],
+        list: [],
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         info: {}
@@ -22,9 +16,19 @@ Page({
         wx.navigateBack({ delta: 1 })
     },
     // 详细信息
-    toView: function (e) {
+    toView: async function (e) {
         const that = this;
         const { item } = e.currentTarget.dataset;
+        // 赛事信息
+        const match = await app.$get(`/newCourt/api/match/${item.match_id}`);
+        if (match.errcode = '0') { item.match_name = match.data.name; item.grouping = match.data.grouping; };
+        // 赛事组别
+        let group = match.data.grouping.find((i) => i._id == item.grouping_id);
+        if (group) { item.grouping_name = group.name; }
+        // 赛事项目
+        const project = await app.$get(`/newCourt/api/matchProject/${item.project_id}`)
+        if (project.errcode = '0') { item.project_name = project.data.name };
+        that.setData({ info: item })
         that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 关闭弹框
@@ -37,7 +41,26 @@ Page({
      */
     onLoad: function (options) {
         const that = this;
-
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    watchLogin: function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async (res) => {
+                let info = {};
+                if (searchInfo && searchInfo.name) info.teammate_name = searchInfo.name;
+                const arr = await app.$get(`/newCourt/api/teamApply`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: arr.data })
+                } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+            },
+            fail: async (res) => {
+                wx.redirectTo({ url: '/pages/index/index' });
+            },
+        });
     },
     /**
      * 生命周期函数--监听页面初次渲染完成