guhongwei 2 gadi atpakaļ
vecāks
revīzija
86a698b201

+ 2 - 2
pagesMatch/matchAdmin/referee/add.json

@@ -1,6 +1,6 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+        "mobile-main": "/commpents/mobile-frame/index"
     }
-  }
+}

+ 39 - 11
pagesMatch/matchAdmin/referee/list.js

@@ -1,14 +1,23 @@
 const app = getApp();
+import WxValidate from '../../../utils/wxValidate';
 Page({
     data: {
         frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
-        list: [
-            { _id: '123456', name: '裁判信息', phone: '12345678901' },
-        ],
+        list: [],
         total: 0,
         page: 0,
         skip: 0,
         limit: 5,
+        // 弹框
+        dialog: { title: '选择教练', show: false, type: '1' },
+        // 教练列表
+        coachList: [],
+    },
+    initValidate() {
+        const rules = { coach_id: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { coach_id: { required: '选择教练', } };
+        this.WxValidate = new WxValidate(rules, messages)
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
@@ -19,12 +28,6 @@ Page({
         that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` });
     },
-    // 账号绑定
-    toBind: function (e) {
-        const that = this;
-        const { item } = e.currentTarget.dataset;
-        console.log(item);
-    },
     // 信息删除
     toDel: async function (e) {
         const that = this;
@@ -46,6 +49,21 @@ Page({
             }
         })
     },
+    // 选择教练
+    toBind: function () {
+        const that = this;
+        that.setData({ dialog: { titl: '选择教练', show: true, type: '1' } })
+    },
+    // 确认教练
+    coachChange: function (e) {
+        const that = this;
+        let data = that.data.coachList[e.detail.value];
+        if (data) that.setData({ 'form.caoch_id': data.coach_id, 'form.coach_id_name': data.coach_id_name, 'form.school_id': data.school_id })
+    },
+    // 添加裁判
+    toAdd: function () {
+        console.log('2');
+    },
     // 分页
     toPage: function () {
         const that = this;
@@ -72,10 +90,20 @@ Page({
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
+    onShow: async function () {
         const that = this;
+        // 查询其他信息
+        await that.searchOther();
         // 监听用户是否登录
-        that.watchLogin();
+        await that.watchLogin();
+    },
+    // 查询其他信息
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 查询教练列表
+        arr = await app.$get(`/rcs`)
+        if (arr.errcode == '0') { that.setData({ coachList: arr.data }) }
     },
     // 监听用户是否登录
     watchLogin: async function () {

+ 3 - 2
pagesMatch/matchAdmin/referee/list.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+        "mobile-main": "/commpents/mobile-frame/index",
+        "dialog": "/commpents/dialog/index"
     }
-  }
+}

+ 4 - 2
pagesMatch/matchAdmin/referee/list.less

@@ -21,12 +21,14 @@
         }
 
         .one_2 {
-            width: 20vw;
+            width: 42vw;
+            display: flex;
 
             button {
-                width: 100%;
+                width: 20vw;
                 padding: 2vw;
                 font-size: var(--font14Size);
+                margin: 0 1vw;
             }
         }
     }

+ 31 - 5
pagesMatch/matchAdmin/referee/list.wxml

@@ -5,7 +5,8 @@
                 <input type="text" placeholder="请输入关键词" />
             </view>
             <view class="one_2">
-                <button type="primary" bindtap="toCommon" data-route="matchAdmin/referee/add">添加</button>
+                <button type="primary" bindtap="toBind">选择教练</button>
+                <button type="primary" bindtap="toAdd">添加裁判</button>
             </view>
         </view>
         <view class="two">
@@ -21,14 +22,39 @@
                         </view>
                         <view class="btn">
                             <button type="primary" size="mini" bindtap="toCommon" data-item="{{item}}" data-route="matchAdmin/referee/add">信息维护</button>
-                            <button type="primary" size="mini" bindtap="toBind" data-item="{{item}}">账号绑定</button>
                             <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">信息删除</button>
-
-
                         </view>
                     </view>
                 </view>
             </scroll-view>
         </view>
     </view>
-</mobile-main>
+</mobile-main>
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">学校id:</view>
+                    <view class="value">
+                        <input name="school_id" value="{{form.school_id}}" placeholder="请输入学校id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">教练id:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="coachChange" name="coach_id" value="{{form.coach_id}}" range="{{coachList}}" range-key="coach_id_name">
+                            <view class="picker">{{form.coach_id_name||'请选择教练'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+        <view class="dialog_2" wx:elif="{{dialog.type=='2'}}">
+            添加教练
+        </view>
+    </view>
+</dialog>

+ 4 - 2
pagesMatch/matchAdmin/referee/list.wxss

@@ -18,12 +18,14 @@
   border-radius: 5px;
 }
 .main .one .one_2 {
-  width: 20vw;
+  width: 42vw;
+  display: flex;
 }
 .main .one .one_2 button {
-  width: 100%;
+  width: 20vw;
   padding: 2vw;
   font-size: var(--font14Size);
+  margin: 0 1vw;
 }
 .main .two {
   position: relative;

+ 3 - 2
pagesMatch/system/index.js

@@ -46,9 +46,10 @@ Page({
             success: async res => {
                 const arr = await app.$get(`/user/${res.data._id}`, {}, 'race');
                 if (arr.errcode == '0') {
-                    console.log(arr.data);
+                    const aee = await app.$get(`/user/${arr.data.user_id}`);
+                    if (aee.errcode == '0') { arr.data.user_id = aee.data; }
                     that.setData({ user: arr.data })
-                    let btnData = match_menu.find((i) => i.type == '1');
+                    let btnData = match_menu.find((i) => i.type == arr.data.type);
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }

+ 3 - 3
pagesMatch/system/index.wxml

@@ -5,11 +5,11 @@
             <view class="one_2">
                 <view class="l">
                     <view class="l_1">
-                        <image class="icon" src="{{user.icon&&user.icon.length>0?user.icon[0].url:''}}"></image>
+                        <image class="icon" src="{{user.user_id.icon&&user.user_id.icon.length>0?user.user_id.icon[0].url:''}}"></image>
                     </view>
                     <view class="l_2">
-                        <view class="info textOver">{{user.name}}</view>
-                        <view class="info textOver">{{user.phone}}</view>
+                        <view class="info textOver">{{user.user_id.name}}</view>
+                        <view class="info textOver">{{user.user_id.phone}}</view>
                     </view>
                 </view>
                 <view class="r">

+ 1 - 1
project.private.config.json

@@ -1,7 +1,7 @@
 {
     "projectname": "%E7%BE%BD%E6%A0%A1%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0",
     "setting": {
-        "compileHotReLoad": false
+        "compileHotReLoad": true
     },
     "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
 }