Pārlūkot izejas kodu

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

YY 2 gadi atpakaļ
vecāks
revīzija
0e83d6d0fc

+ 2 - 0
app.json

@@ -103,7 +103,9 @@
                 "matchAdmin/match/list",
                 "matchAdmin/match/add",
                 "matchAdmin/group/list",
+                "matchAdmin/group/add",
                 "matchAdmin/project/list",
+                "matchAdmin/project/add",
                 "matchAdmin/teamapply/list",
                 "test/index"
             ]

+ 111 - 0
pagesMatch/matchAdmin/group/add.js

@@ -0,0 +1,111 @@
+const app = getApp()
+import WxValidate from '../../../utils/wxValidate';
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
+        form: {},
+    },
+    initValidate() {
+        const rules = { name: { required: true }, age: { required: false }, explain: { required: false } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { name: { required: '未输入名称' }, age: { required: '未输入年龄限制' }, explain: { required: '未输入说明' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //提交
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (params._id) { arr = await app.$post(`/matchGroup/${params._id}`, params) }
+            else { arr = await app.$post(`/matchGroup`, params) }
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    let arr = await app.$get(`/matchGroup/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data })
+                    }
+                };
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pagesMatch/matchAdmin/group/add.json

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

+ 40 - 0
pagesMatch/matchAdmin/group/add.less

@@ -0,0 +1,40 @@
+@import (css) "/app.wxss";
+
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            padding: 2vw;
+            border-bottom: 1px dashed var(--f1Color);
+
+            .label {
+                font-size: var(--font16Size);
+            }
+
+            .value {
+                font-size: var(--font16Size);
+                width: 65vw;
+
+                textarea {
+                    width: 100%;
+                    height: 120px;
+                }
+
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 41 - 0
pagesMatch/matchAdmin/group/add.wxml

@@ -0,0 +1,41 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id:</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">赛事id:</view>
+                    <view class="value">
+                        <input type="text" name="match_id" value="{{form.match_id}}" placeholder="请输入赛事id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">名称:</view>
+                    <view class="value">
+                        <input type="text" name="name" value="{{form.name}}" placeholder="请输入名称" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">年龄限制:</view>
+                    <view class="value">
+                        <input type="text" name="age" value="{{form.age}}" placeholder="请输入年龄限制" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">说明:</view>
+                    <view class="value">
+                        <textarea maxlength="500" name="explain" value="{{form.explain}}" placeholder="请输入说明" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 30 - 0
pagesMatch/matchAdmin/group/add.wxss

@@ -0,0 +1,30 @@
+@import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px dashed var(--f1Color);
+}
+.main .one .content .label {
+  font-size: var(--font16Size);
+}
+.main .one .content .value {
+  font-size: var(--font16Size);
+  width: 65vw;
+}
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 58 - 4
pagesMatch/matchAdmin/group/list.js

@@ -1,11 +1,57 @@
 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,
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    //添加信息,信息维护
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 删除
+    toDel: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/matchGroup/${item._id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
+    // 分页
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -27,7 +73,14 @@ Page({
         const that = this;
         wx.getStorage({
             key: 'user',
-            success: async res => { },
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                let arr = await app.$get(`/matchGroup`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: [...that.data.list, ...arr.data] })
+                    that.setData({ total: arr.total })
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
             }
@@ -40,7 +93,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 67 - 1
pagesMatch/matchAdmin/group/list.less

@@ -5,7 +5,73 @@
     background-color: var(--mainColor);
 
     .one {
-        width: 100vw;
+        display: flex;
+        flex-direction: row;
+        padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            width: 20vw;
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 96vw;
+        margin: 2vw;
+        background-color: var(--mainColor);
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            border: 2px dashed var(--f1Color);
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border-radius: 10px;
+
+            .name {
+                font-size: var(--font20Szie);
+                color: var(--redColor);
+                font-weight: bold;
+                margin: 0 0 2vw 0;
+            }
+
+            .other {
+                margin: 0 0 2vw 0;
+
+                .other_1 {
+                    font-size: var(--font16Szie);
+                    margin: 0 0 1vw 0;
+
+                    text:first-child {
+                        color: var(--f85Color);
+                    }
+                }
+            }
+
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
+            }
+        }
+
     }
 }
 

+ 33 - 1
pagesMatch/matchAdmin/group/list.wxml

@@ -1,7 +1,39 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            赛事分组
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <button type="primary" bindtap="toCommon" data-route="matchAdmin/group/add">添加</button>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="name">{{item.name}}</view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>比赛名称:</text>
+                                <text>{{item.match_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>年龄限制:</text>
+                                <text>{{item.age||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>说明:</text>
+                                <text>{{item.explain||'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toCommon" data-item="{{item}}">信息维护</button>
+                            <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">信息删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
         </view>
     </view>
 </mobile-main>

+ 55 - 1
pagesMatch/matchAdmin/group/list.wxss

@@ -4,7 +4,61 @@
   background-color: var(--mainColor);
 }
 .main .one {
-  width: 100vw;
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
+  background-color: var(--f1Color);
+  border-radius: 5px;
+}
+.main .one .one_2 {
+  width: 20vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 96vw;
+  margin: 2vw;
+  background-color: var(--mainColor);
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  border: 2px dashed var(--f1Color);
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border-radius: 10px;
+}
+.main .two .list .name {
+  font-size: var(--font20Szie);
+  color: var(--redColor);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font16Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text:first-child {
+  color: var(--f85Color);
+}
+.main .two .list .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
 }
 .scroll-view {
   position: absolute;

+ 150 - 0
pagesMatch/matchAdmin/project/add.js

@@ -0,0 +1,150 @@
+const app = getApp()
+import WxValidate from '../../../utils/wxValidate';
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
+        form: {},
+        typeList: [],
+        genderList: []
+    },
+    initValidate() {
+        const rules = { name: { required: true }, type: { required: true }, age: { required: false }, gender: { required: false }, num: { required: false }, explain: { required: false } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { name: { required: '未输入名称' }, type: { required: '未选择项目类别' }, age: { required: '未输入人数限制' }, gender: { required: '未选择性别限制' }, num: { required: '未输入人数限制' }, explain: { required: '未输入说明' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 选择性别
+    genderChange: function (e) {
+        const that = this;
+        let data = that.data.genderList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.gender': data.value });
+            that.setData({ 'form.zhGender': data.label });
+        }
+    },
+    // 项目类别
+    typeChange: function (e) {
+        const that = this;
+        let data = that.data.typeList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.type': data.value })
+            that.setData({ 'form.zhType': data.label })
+        }
+    },
+    //提交
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (params._id) { arr = await app.$post(`/matchProject/${params._id}`, params) }
+            else { arr = await app.$post(`/matchProject`, params) }
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    let arr = await app.$get(`/matchProject/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        // 项目类别
+                        let type = typeList.find(i => i.value == arr.data.type);
+                        if (type) arr.data.zhType = type.label;
+                        // 性别
+                        let gender = genderList.find(i => i.value == arr.data.gender);
+                        if (gender) arr.data.zhGender = gender.label;
+                        that.setData({ form: arr.data })
+                    }
+                };
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 查询其他信息
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 性别
+        arr = await app.$get(`/dict`, { code: 'gender' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
+        // 项目类别
+        arr = await app.$get(`/dict`, { code: 'match_project_type' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ typeList: arr.data[0].list });
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pagesMatch/matchAdmin/project/add.json

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

+ 40 - 0
pagesMatch/matchAdmin/project/add.less

@@ -0,0 +1,40 @@
+@import (css) "/app.wxss";
+
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            padding: 2vw;
+            border-bottom: 1px dashed var(--f1Color);
+
+            .label {
+                font-size: var(--font16Size);
+            }
+
+            .value {
+                font-size: var(--font16Size);
+                width: 65vw;
+
+                textarea {
+                    width: 100%;
+                    height: 120px;
+                }
+
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 69 - 0
pagesMatch/matchAdmin/project/add.wxml

@@ -0,0 +1,69 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id:</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">赛事id:</view>
+                    <view class="value">
+                        <input type="text" name="match_id" value="{{form.match_id}}" placeholder="请输入赛事id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">赛事分组id:</view>
+                    <view class="value">
+                        <input type="text" name="group_id" value="{{form.group_id}}" placeholder="请输入赛事分组id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">名称:</view>
+                    <view class="value">
+                        <input type="text" name="title" value="{{form.title}}" placeholder="请输入名称" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">项目类别:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="typeChange" name="type" value="{{form.type}}" range="{{typeList}}" range-key="label">
+                            <view class="picker">{{form.zhType||'请选择项目类别'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">年龄限制:</view>
+                    <view class="value">
+                        <input type="text" name="age" value="{{form.age}}" placeholder="请输入年龄限制" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">性别:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="genderChange" name="gender" value="{{form.gender}}" range="{{genderList}}" range-key="label">
+                            <view class="picker">{{form.zhGender||'请选择性别'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">人数限制:</view>
+                    <view class="value">
+                        <input type="number" name="num" value="{{form.num}}" placeholder="请输入人数限制" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">说明:</view>
+                    <view class="value">
+                        <textarea maxlength="500" name="explain" value="{{form.explain}}" placeholder="请输入说明" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 30 - 0
pagesMatch/matchAdmin/project/add.wxss

@@ -0,0 +1,30 @@
+@import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px dashed var(--f1Color);
+}
+.main .one .content .label {
+  font-size: var(--font16Size);
+}
+.main .one .content .value {
+  font-size: var(--font16Size);
+  width: 65vw;
+}
+.main .one .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 79 - 3
pagesMatch/matchAdmin/project/list.js

@@ -2,10 +2,60 @@ const app = getApp();
 Page({
     data: {
         frameStyle: { useTop: true, name: '组内项目', leftArrow: true, useBar: false },
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        //性别
+        genderList: [],
+        //项目类别
+        typeList: []
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    //添加信息,信息维护
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 删除
+    toDel: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/matchProject/${item._id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
+    // 分页
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -19,15 +69,40 @@ Page({
      */
     onShow: function () {
         const that = this;
+        // 查询其他信息
+        that.searchOther();
         // 监听用户是否登录
         that.watchLogin();
     },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 性别
+        arr = await app.$get(`/dict`, { code: 'gender' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
+        // 项目类别
+        arr = await app.$get(`/dict`, { code: 'match_project_type' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ typeList: arr.data[0].list });
+    },
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let genderList = that.data.genderList;
+        let typeList = that.data.typeList;
         wx.getStorage({
             key: 'user',
-            success: async res => { },
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                let arr = await app.$get(`/matchProject`, { ...info });
+                if (arr.errcode == '0') {
+                    for (const val of arr.data) {
+                        let type = typeList.find(i => i.value == val.type); if (type) val.zhType = type.label;
+                        let gender = genderList.find(i => i.value == val.gender); if (gender) val.zhGender = gender.label;
+                    }
+                    that.setData({ list: [...that.data.list, ...arr.data] })
+                    that.setData({ total: arr.total })
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
             }
@@ -40,7 +115,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 66 - 1
pagesMatch/matchAdmin/project/list.less

@@ -5,7 +5,72 @@
     background-color: var(--mainColor);
 
     .one {
-        width: 100vw;
+        display: flex;
+        flex-direction: row;
+        padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            width: 20vw;
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
+        }
+    }
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 96vw;
+        margin: 2vw;
+        background-color: var(--mainColor);
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            border: 2px dashed var(--f1Color);
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border-radius: 10px;
+
+            .name {
+                font-size: var(--font20Szie);
+                color: var(--redColor);
+                font-weight: bold;
+                margin: 0 0 2vw 0;
+            }
+
+            .other {
+                margin: 0 0 2vw 0;
+
+                .other_1 {
+                    font-size: var(--font16Szie);
+                    margin: 0 0 1vw 0;
+
+                    text:first-child {
+                        color: var(--f85Color);
+                    }
+                }
+            }
+
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
+            }
+        }
+
     }
 }
 

+ 45 - 1
pagesMatch/matchAdmin/project/list.wxml

@@ -1,7 +1,51 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            组内项目
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <button type="primary" bindtap="toCommon" data-route="matchAdmin/project/add">添加</button>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="name">{{item.name}}</view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>赛事名称:</text>
+                                <text>{{item.match_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>年龄限制:</text>
+                                <text>{{item.age||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>性别限制:</text>
+                                <text>{{item.zhGender||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>人数限制:</text>
+                                <text>{{item.num||'0'}}人</text>
+                            </view>
+                            <view class="other_1">
+                                <text>项目类别:</text>
+                                <text>{{item.zhType||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>说明:</text>
+                                <text>{{item.explain||'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toCommon" data-item="{{item}}">信息维护</button>
+                            <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">信息删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
         </view>
     </view>
 </mobile-main>

+ 55 - 1
pagesMatch/matchAdmin/project/list.wxss

@@ -4,7 +4,61 @@
   background-color: var(--mainColor);
 }
 .main .one {
-  width: 100vw;
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
+  background-color: var(--f1Color);
+  border-radius: 5px;
+}
+.main .one .one_2 {
+  width: 20vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 96vw;
+  margin: 2vw;
+  background-color: var(--mainColor);
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  border: 2px dashed var(--f1Color);
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border-radius: 10px;
+}
+.main .two .list .name {
+  font-size: var(--font20Szie);
+  color: var(--redColor);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font16Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text:first-child {
+  color: var(--f85Color);
+}
+.main .two .list .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
 }
 .scroll-view {
   position: absolute;

+ 0 - 7
pagesSchool/stuAdmin/coach/list.js

@@ -7,8 +7,6 @@ Page({
         page: 0,
         skip: 0,
         limit: 5,
-        // 性别
-        genderList: [],
         //教练等级
         levelList: [],
     },
@@ -60,9 +58,6 @@ Page({
     searchOther: async function () {
         const that = this;
         let arr;
-        // 性别
-        arr = await app.$get(`/dict`, { code: 'gender' });
-        if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
         // 教练等级
         arr = await app.$get(`/dict`, { code: 'coach_grade' });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ levelList: arr.data[0].list });
@@ -70,7 +65,6 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
-        let genderList = that.data.genderList;
         let levelList = that.data.levelList;
         wx.getStorage({
             key: 'user',
@@ -80,7 +74,6 @@ Page({
                 if (arr.errcode == '0') {
                     for (const val of arr.data) {
                         let level = levelList.find(i => i.value == val.coach_id_level); if (level) val.zhLevel = level.label;
-                        let gender = genderList.find(i => i.value == val.coach_id_gender); if (gender) val.zhGender = level.label;
                     }
                     that.setData({ list: [...that.data.list, ...arr.data] })
                     that.setData({ total: arr.total })