zs 1 vuosi sitten
vanhempi
commit
6d4aa8c0e7
1 muutettua tiedostoa jossa 16 lisäystä ja 10 poistoa
  1. 16 10
      pagesMy/teamCreate/index.js

+ 16 - 10
pagesMy/teamCreate/index.js

@@ -92,12 +92,6 @@ Page({
         // 类别
         res = await app.$api('dictData', 'GET', { type: 'type', is_use: '0' })
         if (res.errcode == '0') that.setData({ typeList: res.data })
-        // 成员
-        res = await app.$api('user', 'GET', { status: '1', type: '0' })
-        if (res.errcode == '0') {
-            for (const val of res.data) if (!val.name) val.name = '暂无';
-            that.setData({ userList: res.data })
-        }
     },
     search() {
         const that = this;
@@ -109,16 +103,28 @@ Page({
                     if (res.errcode == '0') {
                         let arr = res.data.create_time.split(/\s+/);
                         if (arr) { res.data.date = arr[0]; res.data.time = arr[1] }
-                        for (const val of res.data.member) {
-                            for (const as of that.data.userList) {
-                                if (as._id == val) as.checked = "true"
+                        // 成员
+                        const member = await app.$api('user', 'GET', { status: '1', type: '0' })
+                        if (member.errcode == '0') {
+                            for (const val of res.data.member) {
+                                for (const as of member.data) {
+                                    if (!as.name) as.name = '暂无';
+                                    if (as._id == val) as.checked = true
+                                }
                             }
+                            that.setData({ userList: member.data })
                         }
-                        console.log(that.data.userList);
                         that.setData({ imgList: res.data.logo, form: res.data })
                     } else {
                         wx.showToast({ title: `${res.errmsg}`, icon: 'none' });
                     }
+                } else {
+                    // 成员
+                    const member = await app.$api('user', 'GET', { status: '1', type: '0' })
+                    if (member.errcode == '0') {
+                        for (const val of member.data) if (!val.name) val.name = '暂无';
+                        that.setData({ userList: member.data })
+                    }
                 }
                 that.setData({ "form.administrator": res.data._id })
             },