浏览代码

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

guhongwei 2 年之前
父节点
当前提交
84fa86eee6

+ 3 - 0
app.json

@@ -102,8 +102,11 @@
                 "matchAdmin/referee/add",
                 "matchAdmin/profit/list",
                 "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;

+ 199 - 0
pagesMatch/matchAdmin/match/add.js

@@ -0,0 +1,199 @@
+const app = getApp();
+import WxValidate from '../../../utils/wxValidate'
+
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '比赛信息', leftArrow: true, useBar: false },
+        id: '',
+        form: { logo: [] },
+        // 状态列表
+        statusList: [],
+    },
+    initValidate() {
+        const rules = {
+            logo: { required: true },
+            name: { required: true },
+            startDate: { required: true },
+            startTime: { required: true },
+            endDate: { required: true },
+            endTime: { required: true },
+            address: { required: true },
+            sign_end_time: { required: true }, money_remark: { required: true }, money_mode: { required: true }, contact: { required: true }, explain: { required: true }, regular: { required: true }, status: { required: true }
+        }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = {
+            logo: { required: '请上传logo' }, name: { required: '请输入比赛名称' },
+            startDate: { required: '比赛开始日期' },
+            startTime: { required: '比赛开始时间' },
+            endDate: { required: '比赛结束日期' },
+            endTime: { required: '比赛结束时间' },
+            address: { required: '请输入比赛地点' }, sign_end_time: { required: '报名截止时间' }, money_remark: { required: '请输入报名费用说明' }, money_mode: { required: '请输入付款方式' }, contact: { required: '请输入联系方式' }, explain: { required: '请输入报名说明' }, regular: { required: '请输入赛事规程' }, status: { required: '请选择比赛状态' },
+        };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () { wx.navigateBack({ delta: 1 }) },
+    // 上传照片
+    imgUpl: function (e) {
+        const that = this;
+        let data = that.data.form.logo;
+        data.push(e.detail)
+        that.setData({ 'form.logo': data })
+    },
+    // 删除图片
+    imgDel: function (e) {
+        const that = this;
+        let list = that.data.form.logo;
+        let arr = list.filter((i, index) => index != e.detail.index)
+        that.setData({ 'form.logo': arr })
+    },
+    // 选择比赛开始日期
+    startChangedate: function (e) {
+        const that = this;
+        that.setData({ 'form.startDate': e.detail.value });
+    },
+    // 选择比赛开始时间
+    startChange: function (e) {
+        const that = this;
+        that.setData({ 'form.startTime': e.detail.value });
+    },
+    // 选择比赛结束日期
+    endChangedate: function (e) {
+        const that = this;
+        that.setData({ 'form.endDate': e.detail.value });
+    },
+    // 选择比赛结束时间
+    endChange: function (e) {
+        const that = this;
+        that.setData({ 'form.endTime': e.detail.value });
+    },
+    // 选择报名截止日期
+    dateChange: function (e) {
+        const that = this;
+        that.setData({ 'form.sign_date': e.detail.value });
+    },
+    // 选择报名截止时间
+    timeChange: function (e) {
+        const that = this;
+        that.setData({ 'form.sign_time': e.detail.value });
+    },
+    // 选择状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.status': data.value });
+            that.setData({ 'form.zhstatus': data.label });
+        }
+    },
+    //赛事规程
+    inputChange: function (e) {
+        const that = this;
+        let html = e.detail.html;
+        that.setData({ "form.regular": html });
+    },
+    toSubmit: async function (e) {
+        const that = this;
+        const form = that.data.form;
+        const params = e.detail.value;
+        params.start_time = params.startDate + ' ' + params.startTime;
+        params.end_time = params.endDate + ' ' + params.endTime;
+        params.sign_end_time = params.sign_date + ' ' + params.sign_time;
+        params.logo = form.logo;
+        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 (form._id) arr = await app.$post(`/match/${form._id}`, params);
+            else arr = await app.$post(`/match`, 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: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                const aee = await app.$get(`/dict`, { code: "match_status" });
+                if (aee.errcode == '0' && aee.total > 0) that.setData({ statusList: aee.data[0].list });
+                if (that.data.id) {
+                    const arr = await app.$get(`/match/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        // 比赛状态
+                        let status = statusList.find(i => i.value == arr.data.status)
+                        if (status) arr.data.zhStatus = status.label;
+                        // 开始时间
+                        arr.data.startDate = arr.data.start_time.slice(0, 10);
+                        arr.data.startTime = arr.data.start_time.slice(11, arr.data.time_start.length);
+                        // 结束时间
+                        arr.data.endDate = arr.data.end_time.slice(0, 10);
+                        arr.data.endTime = arr.data.end_time.slice(11, arr.data.time_end.length);
+                        // 截止时间
+                        arr.data.sign_date = arr.data.sign_end_time.slice(0, 10);
+                        arr.data.sign_time = arr.data.sign_end_time.slice(11, arr.data.sign_end_time.length);
+                        that.setData({ form: arr.data });
+                    }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 8 - 0
pagesMatch/matchAdmin/match/add.json

@@ -0,0 +1,8 @@
+{
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index",
+      "upload": "/commpents/upload/index",
+      "hg-editor": "/commpents/hg-editor/hg-editor"
+    }
+  }

+ 53 - 0
pagesMatch/matchAdmin/match/add.less

@@ -0,0 +1,53 @@
+@import (css) "/app.wxss";
+
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            border-bottom: 1px dashed var(--f1Color);
+            padding: 2vw 0;
+            margin: 0 2vw 2vw 2vw;
+
+            .label {
+                color: var(--f85Color);
+            }
+
+            .value {
+                flex-grow: 1;
+                color: var(--blackColor);
+
+                textarea {
+                    position: static;
+                    width: 72vw;
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 114 - 0
pagesMatch/matchAdmin/match/add.wxml

@@ -0,0 +1,114 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="toSubmit">
+                <view class="content">
+                    <view class="label">logo:</view>
+                    <view class="value">
+                        <upload list="{{form.logo}}" count="{{1}}" previewSize="{{30}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛名称:</view>
+                    <view class="value">
+                        <textarea name="name" value="{{form.name}}" maxlength="500" placeholder="请输入比赛名称" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛开始日期:</view>
+                    <view class="value">
+                        <picker mode="date" name="startDate" value="{{form.startDate}}" bindchange="startChangedate">
+                            <view class="picker">{{form.startDate||'比赛开始日期'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛开始时间:</view>
+                    <view class="value">
+                        <picker mode="time" name="startTime" value="{{form.startTime}}" bindchange="startChange">
+                            <view class="picker">{{form.startTime||'比赛开始时间'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛结束日期:</view>
+                    <view class="value">
+                        <picker mode="date" name="endDate" value="{{form.endDate}}" bindchange="endChangedate">
+                            <view class="picker">{{form.endDate||'比赛结束日期'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛结束时间:</view>
+                    <view class="value">
+                        <picker mode="time" name="endTime" value="{{form.endTime}}" bindchange="endChange">
+                            <view class="picker">{{form.endTime||'比赛结束时间'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛地点:</view>
+                    <view class="value">
+                        <textarea name="address" value="{{form.address}}" maxlength="500" placeholder="请输入比赛地点" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">报名截止日期:</view>
+                    <view class="value">
+                        <picker mode="date" name="sign_date" value="{{form.sign_date}}" bindchange="dateChange">
+                            <view class="picker">{{form.sign_date||'报名截止日期'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">报名截止时间:</view>
+                    <view class="value">
+                        <picker mode="time" name="sign_time" value="{{form.sign_time}}" bindchange="timeChange">
+                            <view class="picker">{{form.sign_time||'报名截止时间'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">报名费用说明:</view>
+                    <view class="value">
+                        <textarea name="money_remark" value="{{form.money_remark}}" maxlength="500" placeholder="请输入费用说明" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">付款方式:</view>
+                    <view class="value">
+                        <input type="text" name="money_mode" value="{{form.money_mode}}" placeholder="请输入付款方式" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">联系方式:</view>
+                    <view class="value">
+                        <input type="text" name="contact" value="{{form.contact}}" placeholder="请输入联系方式" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">报名说明:</view>
+                    <view class="value">
+                        <textarea name="explain" value="{{form.explain}}" maxlength="500" placeholder="请输入报名说明" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="value">
+                        <hg-editor placeholder="请输入赛事规程" name="{{form.regular}}" bind:ready="onEditorReady" bind:input="inputChange"> </hg-editor>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛状态:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="statusChange" name="status" value="{{form.status}}" range="{{statusList}}" range-key="label">
+                            <view class="picker">{{form.zhstatus||'请选择状态'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 42 - 0
pagesMatch/matchAdmin/match/add.wxss

@@ -0,0 +1,42 @@
+@import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .label {
+  color: var(--f85Color);
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .content .value textarea {
+  position: static;
+  width: 72vw;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 72 - 3
pagesMatch/matchAdmin/match/list.js

@@ -1,11 +1,51 @@
 const app = getApp();
+
 Page({
     data: {
         frameStyle: { useTop: true, name: '比赛信息', leftArrow: true, useBar: false },
+        list: [{}],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        statusList: [],
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    toCommon: function (e) {
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
+        const { route } = e.currentTarget.dataset;
+        if (route) wx.navigateTo({ url: `/pagesMatch/matchAdmin/${route}` });
+    },
+    // 修改
+    toEdit: function (e) {
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
+        let { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pagesMatch/matchAdmin/match/add?id=${item._id}` })
+    },
+    // 删除
+    toDel: async 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(`/match/${item._id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.setData({ skip: 0, page: 0, list: [] })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -22,12 +62,40 @@ Page({
         // 监听用户是否登录
         that.watchLogin();
     },
+    // 分页
+    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 }) }
+    },
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
         wx.getStorage({
             key: 'user',
-            success: async res => { },
+            success: async res => {
+                const aee = await app.$get(`/dict`, { code: "match_status" });
+                if (aee.errcode == '0' && aee.total > 0) that.setData({ statusList: aee.data[0].list });
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                const arr = await app.$get(`/match`, { ...info });
+                if (arr.errcode == '0') {
+                    for (const val of arr.data) {
+                        let status = that.data.statusList.find(i => i.value == val.status)
+                        if (status) val.zhstatus = status.label;
+                    }
+                    that.setData({ list: [...that.data.list, ...arr.data] });
+                    that.setData({ total: arr.total });
+                }
+            },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
             }
@@ -40,7 +108,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 79 - 0
pagesMatch/matchAdmin/match/list.less

@@ -5,10 +5,89 @@
     background-color: var(--mainColor);
 
     .one {
+        display: flex;
+        flex-direction: row;
+        width: 96vw;
+        padding: 2vw;
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 2vw 2vw 2vw;
+                border-radius: 2px;
+                font-size: var(--font16Size);
+                background-color: var(--f1Color);
+            }
+        }
+
+        .one_2 {
+            width: 15vw;
+
+            button {
+                width: 100%;
+                font-size: var(--font14Size);
+                padding: 2vw;
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
         width: 100vw;
+
+        .list {
+            background-color: var(--f9Color);
+            padding: 2vw;
+            margin: 0 2vw 2vw 2vw;
+
+            .name {
+                font-size: var(--font18Szie);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                margin: 0 0 1vw 0;
+
+                .other_1 {
+                    font-size: var(--font16Size);
+                    margin: 0 0 1vw 0;
+
+                    text {
+                        color: var(--f85Color);
+                    }
+
+                    text:last-child {
+                        color: var(--blackColor);
+                    }
+                }
+            }
+
+            .btn {
+                display: flex;
+                flex-direction: row;
+                justify-content: center;
+                text-align: center;
+                flex-wrap: wrap;
+
+                .btn_1 {
+                    width: 25vw;
+                    margin: 0 1vw 1vw 1vw;
+
+                    button {
+                        width: 100%;
+                        font-size: var(--font14Size);
+                        padding: 1vw 2vw;
+                    }
+                }
+            }
+        }
     }
 }
 
+
 .scroll-view {
     position: absolute;
     top: 0;

+ 41 - 1
pagesMatch/matchAdmin/match/list.wxml

@@ -1,7 +1,47 @@
 <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="match/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.start_time||'2020-08-08'}}-{{item.end_time||'12:00'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>比赛地点:</text>
+                                <text>{{item.address}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>比赛状态:</text>
+                                <text>{{item.zhstatus||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>报名截止时间:</text>
+                                <text>{{item.sign_end_time||'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <view class="btn_1">
+                                <button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">信息维护</button>
+                            </view>
+                            <view class="btn_1">
+                                <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">赛事删除</button>
+                            </view>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
         </view>
     </view>
 </mobile-main>

+ 64 - 0
pagesMatch/matchAdmin/match/list.wxss

@@ -4,8 +4,72 @@
   background-color: var(--mainColor);
 }
 .main .one {
+  display: flex;
+  flex-direction: row;
+  width: 96vw;
+  padding: 2vw;
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 2vw 2vw 2vw;
+  border-radius: 2px;
+  font-size: var(--font16Size);
+  background-color: var(--f1Color);
+}
+.main .one .one_2 {
+  width: 15vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  font-size: var(--font14Size);
+  padding: 2vw;
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
   width: 100vw;
 }
+.main .two .list {
+  background-color: var(--f9Color);
+  padding: 2vw;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .two .list .name {
+  font-size: var(--font18Szie);
+  font-weight: bold;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font16Size);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text {
+  color: var(--f85Color);
+}
+.main .two .list .other .other_1 text:last-child {
+  color: var(--blackColor);
+}
+.main .two .list .btn {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  text-align: center;
+  flex-wrap: wrap;
+}
+.main .two .list .btn .btn_1 {
+  width: 25vw;
+  margin: 0 1vw 1vw 1vw;
+}
+.main .two .list .btn .btn_1 button {
+  width: 100%;
+  font-size: var(--font14Size);
+  padding: 1vw 2vw;
+}
 .scroll-view {
   position: absolute;
   top: 0;

+ 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="name" value="{{form.name}}" 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 })