guhongwei 2 anni fa
parent
commit
f3dce10f06

+ 14 - 13
pagesMatch/matchAdmin/referee/list.js

@@ -1,22 +1,22 @@
 const app = getApp();
 import WxValidate from '../../../utils/wxValidate';
 import QRCode from '../../../utils/weapp-qrcode.js';
-
 Page({
     data: {
         frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
         // 比赛系统用户
         raceuser: {},
+        // 性别列表
+        genderList: [],
+        // 教练列表
+        coachList: [],
         list: [],
         total: 0,
         page: 0,
         skip: 0,
         limit: 5,
-        genderList:[],
         // 弹框
         dialog: { title: '选择教练', show: false, type: '1' },
-        // 教练列表
-        coachList: [],
     },
     initValidate() {
         const rules = { coach_id: { required: true } }
@@ -65,6 +65,7 @@ Page({
         let data = that.data.coachList[e.detail.value];
         if (data) that.setData({ 'form.coach_id': data.coach_id, 'form.coach_id_name': data.coach_id_name })
     },
+    // 提交保存
     onSubmit: async function (e) {
         const that = this;
         let params = e.detail.value;
@@ -86,6 +87,7 @@ Page({
         that.makeQRCode();
         that.setData({ dialog: { title: '账号绑定', show: true, type: '2' } })
     },
+    // 生成二维码
     makeQRCode(template = 0) {
         const that = this;
         const url = `${that.data.raceuser._id}&&2`;
@@ -102,11 +104,9 @@ Page({
     // 关闭弹窗
     toClose: function () {
         const that = this;
-        that.setData({ 'form.coach_id': '' })
-        that.setData({ 'form.coach_id_name': '' })
+        that.setData({ 'form.coach_id': '', 'form.coach_id_name': '' })
         that.setData({ dialog: { titl: '教练', show: false, type: '2' } })
     },
-
     // 分页
     toPage: function () {
         const that = this;
@@ -159,23 +159,24 @@ Page({
                 that.setData({ raceuser: res.data })
                 let arr;
                 // 查询当前用户学校,学校id存比赛系统user中的_id,查询当前用户学校与教练的关系表
+                // 教练信息
                 arr = await app.$get(`/school`, { user_id: res.data.user_id._id })
                 if (arr.errcode == '0' && arr.total > 0) {
                     let school = arr.data[0];
                     that.setData({ 'form.parent_id': res.data._id })
                     const aee = await app.$get(`/rcs`, { school_id: school._id })
-                    if (aee.errcode == '0') {
-                        that.setData({ coachList: aee.data })
-                    }
+                    if (aee.errcode == '0') { that.setData({ coachList: aee.data }) }
                 }
+                // 裁判信息
                 let info = { skip: that.data.skip, limit: that.data.limit, parent_id: res.data._id, type: '2' };
                 const aee = await app.$get(`/user`, { ...info }, 'race')
                 if (aee.errcode == '0') {
-                    for (const val of aee.data) {
-                        let gender = that.data.genderList.find(i => i.value == val.user_id.gender); 
+                    let list = [...that.data.list, ...aee.data];
+                    for (const val of list) {
+                        let gender = that.data.genderList.find(i => i.value == val.user_id.gender);
                         if (gender) val.user_id.zhGender = gender.label;
                     }
-                    that.setData({ list: [...that.data.list, ...aee.data] })
+                    that.setData({ list })
                     that.setData({ total: aee.total })
                 }
             },

+ 7 - 6
pagesMatch/matchAdmin/referee/list.less

@@ -6,12 +6,13 @@
 
     .one {
         display: flex;
-        flex-direction: row;
+        flex-direction: column;
+        width: 96vw;
         padding: 2vw;
         border-bottom: 1px solid var(--f1Color);
 
         .one_1 {
-            flex-grow: 1;
+            margin: 0 0 2vw 0;
 
             input {
                 padding: 1vw 0 2vw 2vw;
@@ -21,14 +22,14 @@
         }
 
         .one_2 {
-            width: 42vw;
             display: flex;
+            flex-direction: row;
+            justify-content: space-around;
 
             button {
-                width: 20vw;
-                padding: 1.5vw;
+                width: 100%;
+                padding: 2vw;
                 font-size: var(--font14Size);
-                margin: 0 1vw;
             }
         }
     }

+ 6 - 2
pagesMatch/matchAdmin/referee/list.wxml

@@ -5,8 +5,12 @@
                 <input type="text" placeholder="请输入关键词" />
             </view>
             <view class="one_2">
-                <button type="primary" bindtap="toBind">选择教练</button>
-                <button type="primary" bindtap="toAdd">添加裁判</button>
+                <view class="one_2_1">
+                    <button type="primary" bindtap="toBind">选择教练</button>
+                </view>
+                <view class="one_2_1">
+                    <button type="primary" bindtap="toAdd">添加裁判</button>
+                </view>
             </view>
         </view>
         <view class="two">

+ 7 - 6
pagesMatch/matchAdmin/referee/list.wxss

@@ -5,12 +5,13 @@
 }
 .main .one {
   display: flex;
-  flex-direction: row;
+  flex-direction: column;
+  width: 96vw;
   padding: 2vw;
   border-bottom: 1px solid var(--f1Color);
 }
 .main .one .one_1 {
-  flex-grow: 1;
+  margin: 0 0 2vw 0;
 }
 .main .one .one_1 input {
   padding: 1vw 0 2vw 2vw;
@@ -18,14 +19,14 @@
   border-radius: 5px;
 }
 .main .one .one_2 {
-  width: 42vw;
   display: flex;
+  flex-direction: row;
+  justify-content: space-around;
 }
 .main .one .one_2 button {
-  width: 20vw;
-  padding: 1.5vw;
+  width: 100%;
+  padding: 2vw;
   font-size: var(--font14Size);
-  margin: 0 1vw;
 }
 .main .two {
   position: relative;