zs há 2 anos atrás
pai
commit
7e643fa1ae

Diff do ficheiro suprimidas por serem muito extensas
+ 112 - 109
icon/icon.wxss


+ 114 - 4
pagesMatch/matchAdmin/mtgroup/auto.js

@@ -1,11 +1,116 @@
 const app = getApp();
 Page({
     data: {
-        frameStyle: { useTop: true, name: '基本页面', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '自动建组', leftArrow: true, useBar: false },
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        dialog: { title: '审核申请', show: false, type: '1' },
+        form: {},
+        //比赛列表
+        matchList: [],
+        // 赛事组别
+        groupList: [],
+        // 组内项目
+        projectList: [],
+        // 成员
+        memberList: []
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    // 设置条件
+    toSet: async function (e) {
+        const that = this;
+        that.setData({ dialog: { title: '设置条件', show: true, type: '1' } })
+    },
+    // 修改
+    toEdit: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        that.setData({ form: item })
+        that.setData({ 'form.member': that.data.memberList })
+        that.setData({ dialog: { title: '修改信息', show: true, type: '2' } })
+    },
+    // 删除成员
+    toDel: async function (e) {
+        const that = this;
+        const { name, tag } = e.currentTarget.dataset;
+        that.data.memberList.push(tag)
+        let list = that.data.list;
+        for (const val of list) {
+            if (val.name == name) {
+                val.person = val.person.filter(i => i._id != tag._id)
+            }
+        }
+        that.setData({ list })
+    },
+    checkboxChange(e) {
+        const member = this.data.form.person
+        const values = e.detail.value
+        for (let i = 0, lenI = member.length; i < lenI; ++i) {
+            member[i].checked = false
+            for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+                if (member[i].value === values[j]) {
+                    member[i].checked = true
+                    break
+                }
+            }
+        }
+        this.setData({
+            'form.person': member
+        })
+    },
+    // 赛事
+    matchChange: async function (e) {
+        const that = this;
+        let data = that.data.matchList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.match_id': data._id, 'form.match_name': data.name });
+            const arr = await app.$get(`/matchGroup`, { match_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ groupList: arr.data }) }
+        }
+    },
+    // 组别
+    groupChange: async function (e) {
+        const that = this;
+        let data = that.data.groupList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.group_id': data._id, 'form.group_name': data.name });
+            const arr = await app.$get(`/matchProject`, { match_id: data.match_id, group_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ projectList: arr.data }) }
+        }
+    },
+    // 项目
+    projectChange: async function (e) {
+        const that = this;
+        let data = that.data.projectList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.project_id': data._id, 'form.project_name': data.name });
+        }
+    },
+    personSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        console.log(params);
+    },
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const arr = await app.$post(`/matchTeamGroup/auto`, params, 'race');
+        if (arr.errcode == '0') {
+            wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 });
+            that.toClose();
+            that.watchLogin(arr.data);
+        }
+        else wx.showToast({ title: `${arr.errmsg}`, icon: 'none', duration: 2000 })
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '设置条件', show: false, type: '1' } })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -23,11 +128,16 @@ Page({
         that.watchLogin();
     },
     // 监听用户是否登录
-    watchLogin: async function () {
+    watchLogin: async function (e) {
         const that = this;
         wx.getStorage({
             key: 'raceuser',
-            success: async res => { },
+            success: async res => {
+                let arr;
+                arr = await app.$get(`/match`, { belong_id: '630ec0480a92b0a015ccfbe1' }, 'race');
+                if (arr.errcode == '0') that.setData({ matchList: arr.data });
+                that.setData({ list: e });
+            },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
             }

+ 6 - 5
pagesMatch/matchAdmin/mtgroup/auto.json

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

+ 67 - 0
pagesMatch/matchAdmin/mtgroup/auto.less

@@ -6,6 +6,48 @@
 
     .one {
         width: 100vw;
+        text-align: center;
+        margin: 2vw 0;
+    }
+
+    .two {
+        .list {
+            width: 92vw;
+            margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            border: 1px dashed var(--fcColor);
+            display: flex;
+            flex-direction: column;
+            background-color: var(--f1Color);
+
+            .name {
+                display: flex;
+                justify-content: space-between;
+                text-align: center;
+                font-size: var(--font16Size);
+                font-weight: bold;
+
+                button {
+                    font-size: var(--font14Size);
+                }
+            }
+
+            .person {
+                display: flex;
+                flex-direction: row;
+                justify-content: space-between;
+                flex-wrap: wrap;
+
+                .tagname {
+                    width: 21vw;
+                    text-align: center;
+                    border: 1px dashed var(--fcColor);
+                    margin: 0 0 2vw 0;
+                    padding: 2vw 0;
+                    font-size: var(--font16Size);
+                }
+            }
+        }
     }
 }
 
@@ -20,4 +62,29 @@
         display: flex;
         flex-direction: column;
     }
+}
+
+.dialog_1 {
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .value {
+            flex-grow: 1;
+            color: var(--blackColor);
+
+        }
+    }
+
+    .btn {
+        text-align: center;
+        margin: 3vw 0;
+
+        button {
+            margin: 0 2vw;
+        }
+    }
 }

+ 95 - 2
pagesMatch/matchAdmin/mtgroup/auto.wxml

@@ -1,7 +1,100 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            基本页面
+            <button type="primary" size="mini" bindtap="toSet">设置条件</button>
+        </view>
+        <view class="two">
+            <view class="list" wx:for="{{list}}" wx:key="index">
+                <view class="name">
+                    <view>组名:{{item.name}}</view>
+                    <view>晋级数:{{item.rise||'0'}}</view>
+                    <view><button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">修改</button> </view>
+                </view>
+                <view class="person">
+                    <view class="tagname" wx:for="{{item.person}}" wx:for-item="tag" wx:key="tag">
+                        {{'张爽'}} <text class="iconfont icon-shanchu" bindtap="toDel" data-name="{{item.name}}" data-tag="{{tag}}"></text>
+                    </view>
+                </view>
+            </view>
+        </view>
+    </view>
+</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">赛事名称:</view>
+                    <view class="value">
+                        <picker bindchange="matchChange" name="match_id" value="{{form.match_id}}" range-key='name' range="{{matchList}}">
+                            <view class="picker">{{form.match_name||'请选择赛事'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">赛事分组:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="groupChange" name="group_id" value="{{form.group_id}}" range="{{groupList}}" range-key="name">
+                            <view class="picker">{{form.group_name||'请选择赛事分组'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">项目名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="projectChange" name="project_id" value="{{form.project_id}}" range="{{projectList}}" range-key="name">
+                            <view class="picker">{{form.project_name||'请选择项目名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">组数量:</view>
+                    <view class="value">
+                        <input type="number" name="team_number" value="{{form.team_number}}" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+        <view class="dialog_1" wx:if="{{dialog.type=='2'}}">
+            <form catchsubmit="personSubmit">
+                <view class="content">
+                    <view class="label">组名:</view>
+                    <view class="value">
+                        <input type="text" name="name" value="{{form.name}}" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">备注:</view>
+                    <view class="value">
+                        <input type="text" name="remark" value="{{form.remark}}" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">取前几:</view>
+                    <view class="value">
+                        <input type="text" name="rise" value="{{form.rise}}" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">成员:</view>
+                    <view class="value">
+                        <checkbox-group bindchange="checkboxChange">
+                            <label class="label" wx:for="{{form.member}}" wx:key="{{item.user_id}}">
+                                <view>
+                                    <checkbox value="{{item.user_id}}" checked="{{item.checked}}" />
+                                </view>
+                                <view class="name">{{item.user_name}}</view>
+                            </label>
+                        </checkbox-group>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
         </view>
     </view>
-</mobile-main>
+</dialog>

+ 53 - 0
pagesMatch/matchAdmin/mtgroup/auto.wxss

@@ -5,6 +5,41 @@
 }
 .main .one {
   width: 100vw;
+  text-align: center;
+  margin: 2vw 0;
+}
+.main .two .list {
+  width: 92vw;
+  margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  border: 1px dashed var(--fcColor);
+  display: flex;
+  flex-direction: column;
+  background-color: var(--f1Color);
+}
+.main .two .list .name {
+  display: flex;
+  justify-content: space-between;
+  text-align: center;
+  font-size: var(--font16Size);
+  font-weight: bold;
+}
+.main .two .list .name button {
+  font-size: var(--font14Size);
+}
+.main .two .list .person {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  flex-wrap: wrap;
+}
+.main .two .list .person .tagname {
+  width: 21vw;
+  text-align: center;
+  border: 1px dashed var(--fcColor);
+  margin: 0 0 2vw 0;
+  padding: 2vw 0;
+  font-size: var(--font16Size);
 }
 .scroll-view {
   position: absolute;
@@ -17,3 +52,21 @@
   display: flex;
   flex-direction: column;
 }
+.dialog_1 .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_1 .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.dialog_1 .btn {
+  text-align: center;
+  margin: 3vw 0;
+}
+.dialog_1 .btn button {
+  margin: 0 2vw;
+}

+ 1 - 1
pagesMatch/system/index.js

@@ -49,7 +49,7 @@ Page({
                     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 == arr.data.type);
+                    let btnData = match_menu.find((i) => i.type == '1');
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }

+ 0 - 1
pagesMatch/userAdmin/schedule/list.js

@@ -117,7 +117,6 @@ Page({
                         let groupList = [...that.data.groupList, ...arr.data]
                         that.setData({ groupList })
                         that.setData({ total: arr.total })
-
                     } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
                 }
             },