zs 2 vuotta sitten
vanhempi
commit
46f937d8d2

+ 6 - 11
pages/address/list.js

@@ -4,9 +4,10 @@ Page({
         frameStyle: { useTop: true, name: '比赛场地', leftArrow: true, useBar: false },
         list: [],
         total: 0,
-        limit: 5,
         page: 0,
-        skip: 0
+        skip: 0,
+        limit: 5,
+
     },
     // 返回
     back: function () {
@@ -20,18 +21,14 @@ Page({
     },
     toCommon: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         const { route } = e.currentTarget.dataset;
         if (route) wx.navigateTo({ url: `/pages/${route}` });
     },
     // 修改
     toEdit: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/address/add?id=${item._id}` })
     },
@@ -47,9 +44,7 @@ Page({
                     const arr = await app.$delete(`/newCourt/api/ground/${item._id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
-                        that.setData({ list: [] })
-                        that.setData({ skip: 0 })
-                        that.setData({ page: 0 })
+                        that.setData({ skip: 0, page: 0, list: [] })
                         that.watchLogin()
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })

+ 2 - 1
pages/home/index.js

@@ -5,10 +5,10 @@ Page({
         lingdang: '/image/lingdang.png',
         user: {},
         list: [],
+        total: 0,
         page: 0,
         skip: 0,
         limit: 5,
-        total: 0,
     },
     // 跳转菜单
     tabPath(e) {
@@ -20,6 +20,7 @@ Page({
         if (route) wx.navigateTo({ url: `/pages/${route}` });
     },
     toView: function (e) {
+        that.setData({ skip: 0, page: 0, list: [] })
         const { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/match/info?id=${item._id}` })
     },

+ 35 - 0
pages/match/achieve.less

@@ -0,0 +1,35 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            border-bottom: 1px dashed var(--f1Color);
+            padding: 2vw 0;
+            margin: 0 2vw 2vw 2vw;
+
+            .label {
+                color: var(--labelColor);
+            }
+
+            .value {
+                flex-grow: 1;
+                color: var(--txtColor);
+
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 27 - 1
pages/match/achieve.wxss

@@ -1 +1,27 @@
-/* pages/match/achieve.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.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(--labelColor);
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--txtColor);
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 105 - 17
pages/match/add.js

@@ -1,66 +1,154 @@
-// pages/match/add.js
+const app = getApp();
+import WxValidate from '../../utils/wxValidate';
+import { matchType } from '../../utils/dict';
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-
+        frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        typeList: matchType,
+    },
+    initValidate() {
+        const rules = { name: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { name: { 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 })
+    },
+    // 选择比赛类别
+    typeChange: function (e) {
+        const that = this;
+        let data = that.data.typeList[e.detail.value];
+        if (data) that.setData({ 'form.type': data.label })
+    },
+    // 选择比赛开始时间
+    startChange: function (e) {
+        const that = this;
+        that.setData({ 'form.start_time': e.detail.value });
+    },
+    // 选择比赛结束时间
+    endChange: function (e) {
+        const that = this;
+        that.setData({ 'form.end_time': 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 });
+    },
+    toSubmit: async function (e) {
+        const that = this;
+        const form = that.data.form;
+        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 (form._id) arr = await app.$post(`/newCourt/api/match/${form._id}`, params);
+            else arr = await app.$post(`/newCourt/api/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(options) {
-
+    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 => {
+                let arr;
+                if (that.data.id) {
+                    arr = await app.$get(`/newCourt/api/match/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data });
+                    }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 1
pages/match/add.json

@@ -1,3 +1,7 @@
 {
-    "usingComponents": {}
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index",
+        "vanupload": "/commpents/upload/index"
+    }
 }

+ 38 - 0
pages/match/add.less

@@ -0,0 +1,38 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            border-bottom: 1px dashed var(--f1Color);
+            padding: 2vw 0;
+            margin: 0 2vw 0 2vw;
+
+            .label {
+                color: var(--labelColor);
+            }
+
+            .value {
+                flex-grow: 1;
+                color: var(--txtColor);
+
+                textarea {
+                    width: 72vw;
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 93 - 2
pages/match/add.wxml

@@ -1,2 +1,93 @@
-<!--pages/match/add.wxml-->
-<text>pages/match/add.wxml</text>
+<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">
+                        <vanupload list="{{form.logo}}" count="{{1}}" previewSize="{{80}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></vanupload>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛类别:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="typeChange" value="{{form.type}}" name="type" range-key='value' range="{{typeList}}">
+                            <view class="input">{{form.type||'请选择比赛类别'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛名称:</view>
+                    <view class="value">
+                        <textarea name="name" value="{{form.name}}" auto-height placeholder="请输入比赛名称" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛开始时间:</view>
+                    <view class="value">
+                        <picker mode="date" name="start_time" value="{{form.start_time}}" bindchange="startChange">
+                            <view class="picker">{{form.start_time||'比赛开始时间'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛结束时间:</view>
+                    <view class="value">
+                        <picker mode="date" name="end_time" value="{{form.end_time}}" bindchange="endChange">
+                            <view class="picker">{{form.end_time||'比赛结束时间'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛地点:</view>
+                    <view class="value">
+                        <textarea name="address" value="{{form.address}}" auto-height 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}}" auto-height 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}}" auto-height placeholder="请输入报名说明" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 30 - 1
pages/match/add.wxss

@@ -1 +1,30 @@
-/* pages/match/add.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 0 2vw;
+}
+.main .one .content .label {
+  color: var(--labelColor);
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--txtColor);
+}
+.main .one .content .value textarea {
+  width: 72vw;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 0 - 0
pages/match/group.less


+ 0 - 0
pages/match/info.less


+ 90 - 16
pages/match/list.js

@@ -1,66 +1,140 @@
-// pages/match/list.js
+const app = getApp()
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
+        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;
+        that.setData({ skip: 0, page: 0, list: [] })
+        const { route } = e.currentTarget.dataset;
+        if (route) wx.navigateTo({ url: `/pages/${route}` });
+    },
+    // 修改
+    toEdit: function (e) {
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
+        let { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/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(`/newCourt/api/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 })
+                    }
+                }
+            }
+        })
+    },
+    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 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
 
     },
-
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                let arr;
+                arr = await app.$get(`/newCourt/api/match`, { ...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' })
+            }
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 4 - 1
pages/match/list.json

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

+ 103 - 0
pages/match/list.less

@@ -0,0 +1,103 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .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(--txtSize);
+                background-color: var(--f1Color);
+            }
+        }
+
+        .one_2 {
+            width: 15vw;
+
+            button {
+                width: 100%;
+                font-size: var(--btnSize);
+                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(--titleSize);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                margin: 0 0 1vw 0;
+
+                .other_1 {
+                    font-size: var(--txtSize);
+                    margin: 0 0 1vw 0;
+
+                    text {
+                        color: var(--labelColor);
+                    }
+
+                    text:last-child {
+                        color: var(--txtColor);
+                    }
+                }
+            }
+
+            .btn {
+                display: flex;
+                flex-direction: row;
+                justify-content: center;
+                text-align: center;
+                flex-wrap: wrap;
+
+                .btn_1 {
+                    width: 20vw;
+                    margin: 0 1vw 1vw 1vw;
+
+                    button {
+                        width: 100%;
+                        font-size: var(--btnSize);
+                        padding: 2vw;
+                    }
+                }
+            }
+        }
+
+        // .list:last-child {
+        //     margin: 0 2vw 0 2vw;
+        // }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 39 - 2
pages/match/list.wxml

@@ -1,2 +1,39 @@
-<!--pages/match/list.wxml-->
-<text>pages/match/list.wxml</text>
+<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.referee_name||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>备注:</text>
+                                <text>{{item.remark||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>是否启用:</text>
+                                <text>{{item.is_use=='0'?'启用':item.is_use=='1'?'禁用':'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <view class="btn_1"><button type="primary" bindtap="toEdit" data-item="{{item}}">信息维护</button></view>
+                            <view class="btn_1"><button type="warn" bindtap="toDel" data-item="{{item}}">信息删除</button></view>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 82 - 1
pages/match/list.wxss

@@ -1 +1,82 @@
-/* pages/match/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.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(--txtSize);
+  background-color: var(--f1Color);
+}
+.main .one .one_2 {
+  width: 15vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  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(--titleSize);
+  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(--txtSize);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text {
+  color: var(--labelColor);
+}
+.main .two .list .other .other_1 text:last-child {
+  color: var(--txtColor);
+}
+.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: 20vw;
+  margin: 0 1vw 1vw 1vw;
+}
+.main .two .list .btn .btn_1 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  padding: 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 5 - 9
pages/news/index.js

@@ -11,10 +11,10 @@ Page({
             ],
         },
         list: [],
+        total: 0,
         page: 0,
         skip: 0,
         limit: 5,
-        total: 0,
         typeList: news_type,
     },
     // 跳转菜单
@@ -35,19 +35,15 @@ Page({
     tabsChange: function (e) {
         const that = this;
         that.setData({ 'tabs.active': e.detail.name });
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         that.watchLogin()
     },
     // 详情
     toView: function (e) {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
-        const { id } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pages/news/info?id=${id}` })
+        that.setData({ skip: 0, page: 0, list: [] })
+        const { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/news/info?id=${item._id}` })
     },
     // 分页
     toPage: function () {

+ 6 - 11
pages/project/list.js

@@ -4,9 +4,10 @@ Page({
         frameStyle: { useTop: true, name: '比赛项目', leftArrow: true, useBar: false },
         list: [],
         total: 0,
-        limit: 5,
         page: 0,
-        skip: 0
+        skip: 0,
+        limit: 5,
+
     },
     // 返回
     back: function () {
@@ -14,18 +15,14 @@ Page({
     },
     toCommon: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         const { route } = e.currentTarget.dataset;
         if (route) wx.navigateTo({ url: `/pages/${route}` });
     },
     // 修改
     toEdit: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/project/add?id=${item._id}` })
     },
@@ -41,9 +38,7 @@ Page({
                     const arr = await app.$delete(`/newCourt/api/matchProject/${item._id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
-                        that.setData({ list: [] })
-                        that.setData({ skip: 0 })
-                        that.setData({ page: 0 })
+                        that.setData({ skip: 0, page: 0, list: [] })
                         that.watchLogin()
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })

+ 133 - 13
pages/refereeeliminate/list.js

@@ -1,66 +1,186 @@
-// pages/refereeeliminate/list.js
+const app = getApp()
+import { race_status } from "../../utils/dict";
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
+        list: [{ match_time: '2022-08-06-08:00', match_name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', grouping_name: '小组赛', project_name: '小组赛', ground_name: '场地一', status: 1, score_one: 16, player_one_name: '张三', player_two_name: '李四', is_change: 0 },
+        { match_time: '2022-08-06-08:00', match_name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', grouping_name: '小组赛', project_name: '小组赛', ground_name: '场地一', status: 1, score_one: 16, player_one_name: '张三三-张三三', player_two_name: '李四四-李四四', is_change: 0 },
+        ],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        dialog: { title: '详细信息', show: false, type: '1' },
+        form: {},
+        statusList: race_status,
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
     },
+    // 查看
+    toView: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        // const arr = await app.$get(`/newCourt/api/eliminateRace/${item._id}`);
+        // if (arr.errcode == '0') {
+        //     if (arr.data.winner) {
+        //         const user = await app.$get(`/newCourt/api/user/${arr.data.winner}`);
+        //         if (user.errcode == '0' && user.data) { arr.data.winner_name = user.data.name; }
+        //         else {
+        //             const team = await app.$get(`/newCourt/api/teamApply/${arr.data.winner}`);
+        //             if (team.errcode == '0' && team.data) { arr.data.winner_name = team.data.applyuser_name + '-' + team.data.teammate_name; }
+        //         }
+        //     }
+        //     that.setData({ form: arr.data });
+        that.setData({ form: item })
+        that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
+        // }
+    },
+    // 更换场地
+    toChange: 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.$post(`/newCourt/api/eliminateRace/${item._id}`, { is_change: '1' });
+                    // if (arr.errcode == '0') {
+                    //     wx.showToast({ title: `更换场地完成`, icon: 'error', duration: 2000 })
+                    //     that.watchLogin()
+                    // } else {
+                    //     wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    // }
+                }
+            }
+        })
 
+    },
+    // 赛事管理
+    toScore: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        // const arr = await app.$get(`/newCourt/api/eliminateRace/${item._id}`);
+        // if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+        that.setData({ form: item })
+        that.setData({ dialog: { title: '赛事管理', show: true, type: '2' } });
+    },
+    // 选择比赛状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        if (data) { that.setData({ 'form.status': data.value }) }
+    },
+    // 提交保存
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        // const arr = await app.$post(`/newCourt/api/eliminateRace/${params._id}`, params);
+        // if (arr.errcode == '0') {
+        //     wx.showToast({ title: `信息维护成功`, icon: 'error', duration: 2000 })
+        //     that.toClose()
+        // } else {
+        //     wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        // }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
+    },
+    // 分页
+    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 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
+        const that = this;
 
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        that.watchLogin()
+    },
+    watchLogin: function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async (res) => {
+                let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data.openid, status: '2' };
+                // if (searchInfo && searchInfo.name) info.name = searchInfo.name;
+                // const arr = await app.$get(`/newCourt/api/eliminateRace`, { ...info });
+                // if (arr.errcode == '0') {
+                // that.setData({ list: [...that.data.list, ...arr.data] });
+                // that.setData({ total: arr.total })
+                // } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+            },
+            fail: async (res) => {
+                wx.redirectTo({ url: '/pages/index/index' });
+            },
+        });
     },
-
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 6 - 2
pages/refereeeliminate/list.json

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

+ 123 - 0
pages/refereeeliminate/list.less

@@ -0,0 +1,123 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        padding: 2vw;
+        background-color: var(--f9Color);
+        margin: 0 0 2vw 0;
+
+        input {
+            padding: 1vw 2vw 2vw 2vw;
+            border-radius: 2px;
+            font-size: var(--txtSize);
+            background-color: var(--bgColor);
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+
+        .list {
+            background-color: var(--f9Color);
+            margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            display: flex;
+            flex-direction: column;
+
+            .name {
+                font-size: var(--titleSize);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                font-size: var(--txtSize);
+
+                .other_1 {
+                    color: var(--labelColor);
+                    margin: 2px 0 0 0;
+
+                    text:nth-child(2) {
+                        color: var(--txtColor);
+                    }
+                }
+
+                text {
+                    padding: 0 2vw 0 0;
+                }
+            }
+
+            .btn {
+                text-align: center;
+
+                button {
+                    margin: 2vw 0 0 2vw;
+                    font-size: var(--btnSize);
+                }
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}
+
+.dialog_one {
+    margin: 10px 0 0 0;
+    width: 80vw;
+
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .value {
+            flex-grow: 1;
+            color: var(--labelColor);
+
+        }
+    }
+}
+
+
+
+.dialog_two {
+    width: 80vw;
+
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .label {
+            width: 30vw;
+        }
+
+        .value {
+            flex-grow: 1;
+            color: var(--labelColor);
+
+        }
+    }
+
+    .btn {
+        margin: 2vw 0 0 0;
+        text-align: center;
+    }
+}

+ 155 - 2
pages/refereeeliminate/list.wxml

@@ -1,2 +1,155 @@
-<!--pages/refereeeliminate/list.wxml-->
-<text>pages/refereeeliminate/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="container main">
+        <view class="one">
+            <input type="text" placeholder="请输入关键词" />
+        </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.match_time}}</view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>赛事名称:</text>
+                                <text>{{item.match_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>赛事组别:</text>
+                                <text>{{item.grouping_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>组内项目:</text>
+                                <text>{{item.project_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>赛事场地:</text>
+                                <text>{{item.ground_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>比赛状态:</text>
+                                <text>{{item.status=='0'?'已安排':item.status=='1'?'待开赛':item.status=='2'?'已开赛':item.status=='3'?'已结束':'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
+                            <button type="primary" size="mini" bindtap="toScore" data-item="{{item}}">赛事管理</button>
+                            <button type="primary" size="mini" bindtap="toChange" data-item="{{item}}" wx:if="{{item.score_one==16||item.score_two==16}}">更换场地</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
+            <view class="content"  >
+                <view class="label">赛事名称:</view>
+                <view class="value">{{form.match_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">赛事组别:</view>
+                <view class="value">{{form.grouping_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">比赛项目:</view>
+                <view class="value">{{form.project_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">赛事场地:</view>
+                <view class="value">{{form.ground_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">选手1:</view>
+                <view class="value">{{form.player_one_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">选手2:</view>
+                <view class="value">{{form.player_two_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">裁判名称:</view>
+                <view class="value">{{form.referee_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">选手1的比分纪录:</view>
+                <view class="value">{{form.score_one||0}}分</view>
+            </view>
+            <view class="content"  >
+                <view class="label">选手2的比分纪录:</view>
+                <view class="value">{{form.score_two||0}}分</view>
+            </view>
+            <view class="content"  >
+                <view class="label">胜者:</view>
+                <view class="value">{{form.winner_name||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">比赛时间:</view>
+                <view class="value">{{form.match_time||'暂无'}}</view>
+            </view>
+            <view class="content"  >
+                <view class="label">比赛状态:</view>
+                <view class="value">{{form.status=='0'?'已安排':form.status=='1'?'待开赛':form.status=='2'?'已开赛':form.status=='3'?'已结束':'暂无'}}</view>
+            </view>
+        </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <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">
+                    <view class="label">比赛状态:</view>
+                    <view class="value">
+                        <picker bindchange="statusChange" name="status" value="{{form.status}}" range-key='label' range="{{statusList}}">
+                            <view class="input">{{form.status=='0'?'已安排':form.status=='1'?'待开赛':form.status=='2'?'已开赛':form.status=='3'?'已结束':'请选择'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手一比分:{{form.player_one_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手二比分:{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手二比分:{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手一比分:{{form.player_one_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">胜者:</view>
+                    <view class="value">
+                        <radio-group name="winner">
+                            <label>
+                                <radio value="{{form.player_one}}" checked="{{form.player_one==form.winner?true:false}}" />{{form.player_one_name}}
+                            </label>
+                            <label>
+                                <radio value="{{form.player_two}}" checked="{{form.player_two==form.winner?true:false}}" />{{form.player_two_name}}
+                            </label>
+                        </radio-group>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" form-type="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</e-dialog>

+ 98 - 1
pages/refereeeliminate/list.wxss

@@ -1 +1,98 @@
-/* pages/refereeeliminate/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.main .one {
+  padding: 2vw;
+  background-color: var(--f9Color);
+  margin: 0 0 2vw 0;
+}
+.main .one input {
+  padding: 1vw 2vw 2vw 2vw;
+  border-radius: 2px;
+  font-size: var(--txtSize);
+  background-color: var(--bgColor);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+}
+.main .two .list {
+  background-color: var(--f9Color);
+  margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  display: flex;
+  flex-direction: column;
+}
+.main .two .list .name {
+  font-size: var(--titleSize);
+  font-weight: bold;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other {
+  font-size: var(--txtSize);
+}
+.main .two .list .other .other_1 {
+  color: var(--labelColor);
+  margin: 2px 0 0 0;
+}
+.main .two .list .other .other_1 text:nth-child(2) {
+  color: var(--txtColor);
+}
+.main .two .list .other text {
+  padding: 0 2vw 0 0;
+}
+.main .two .list .btn {
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 2vw 0 0 2vw;
+  font-size: var(--btnSize);
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}
+.dialog_one {
+  margin: 10px 0 0 0;
+  width: 80vw;
+}
+.dialog_one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_one .content .value {
+  flex-grow: 1;
+  color: var(--labelColor);
+}
+.dialog_two {
+  width: 80vw;
+}
+.dialog_two .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_two .content .label {
+  width: 30vw;
+}
+.dialog_two .content .value {
+  flex-grow: 1;
+  color: var(--labelColor);
+}
+.dialog_two .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}

+ 137 - 12
pages/refereerace/list.js

@@ -1,66 +1,191 @@
-// pages/refereerace/list.js
+import { race_status } from "../../utils/dict";
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
+        list: [
+            { match_time: '2022-08-06-08:00', match_name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', grouping_name: '小组赛', project_name: '小组赛', ground_name: '场地一', status: 1, score_one: 16, player_one_name: '张三三-张三三', player_two_name: '李四四-李四四', is_change: 0 },
+            { match_time: '2022-08-06-08:00', match_name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', grouping_name: '小组赛', project_name: '小组赛', ground_name: '场地一', status: 1, score_one: 16, player_one_name: '张三三-张三三', player_two_name: '李四四-李四四', is_change: 1 },
+        ],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        dialog: { title: '详细信息', show: false, type: '1' },
+        form: {},
+        statusList: race_status,
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 查看
+    toView: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        // const arr = await app.$get(`/newCourt/api/race/${item._id}`)
+        // if (arr.errcode == '0') {
+        //     if (arr.data.winner) {
+        //         const user = await app.$get(`/newCourt/api/user/${arr.data.winner}`);
+        //         if (user.errcode == '0' && user.data) { arr.data.winner_name = user.data.name; }
+        //         else {
+        //             const team = await app.$get(`/newCourt/api/teamApply/${arr.data.winner}`);
+        //             if (team.errcode == '0' && team.data) { arr.data.winner_name = team.data.applyuser_name + '-' + team.data.teammate_name; }
+        //         }
+        //     }
+        // that.setData({ form: arr.data });
+        that.setData({ form: item });
+        that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
+        // }
     },
+    // 更换场地
+    toChange: 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.$post(`/newCourt/api/race/${item._id}`, { is_change: '1' });
+                    // if (arr.errcode == '0') {
+                    //     wx.showToast({ title: `更换场地完成`, icon: 'error', duration: 2000 })
+                    //     that.watchLogin()
+                    // } else {
+                    // wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    // }
+                }
+            }
+        })
 
+    },
+    // 赛事管理
+    toScore: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        // const arr = await app.$get(`/newCourt/api/race/${item._id}`);
+        // if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+        that.setData({ form: item });
+        that.setData({ dialog: { title: '赛事管理', show: true, type: '2' } });
+    },
+    // 选择比赛状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        if (data) { that.setData({ 'form.status': data.value }) }
+    },
+    // 提交保存
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        // const arr = await app.$post(`/newCourt/api/race/${params._id}`, params);
+        // if (arr.errcode == '0') {
+        //     wx.showToast({ title: `信息维护成功`, icon: 'error', duration: 2000 })
+        //     that.toClose()
+        // } else {
+        //     wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        // }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ info: {} })
+        that.setData({ form: {} })
+        that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
+        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 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
+        const that = this;
 
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        that.watchLogin()
+    },
+    watchLogin: function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async (res) => {
+                let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data.openid, status: '2' };
+                // if (searchInfo && searchInfo.name) info.name = searchInfo.name;
+                // const arr = await app.$get(`/newCourt/api/race`, { ...info });
+                // if (arr.errcode == '0') {
+                // that.setData({ list: [...that.data.list, ...arr.data] });
+                // that.setData({ total: arr.total })
+                // } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+            },
+            fail: async (res) => {
+                wx.redirectTo({ url: '/pages/index/index' });
+            },
+        });
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 6 - 2
pages/refereerace/list.json

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

+ 122 - 0
pages/refereerace/list.less

@@ -0,0 +1,122 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        padding: 2vw;
+        background-color: var(--f9Color);
+        margin: 0 0 2vw 0;
+
+        input {
+            padding: 1vw 2vw 2vw 2vw;
+            border-radius: 2px;
+            font-size: var(--txtSize);
+            background-color: var(--bgColor);
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+
+        .list {
+            background-color: var(--f9Color);
+            margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            display: flex;
+            flex-direction: column;
+
+            .name {
+                font-size: var(--titleSize);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                font-size: var(--txtSize);
+
+                .other_1 {
+                    color: var(--labelColor);
+                    margin: 2px 0 0 0;
+
+                    text:nth-child(2) {
+                        color: var(--txtColor);
+                    }
+                }
+
+                text {
+                    padding: 0 2vw 0 0;
+                }
+            }
+
+            .btn {
+                text-align: center;
+
+                button {
+                    margin: 2vw 0 0 2vw;
+                    font-size: var(--btnSize);
+                }
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}
+
+.dialog_one {
+    margin: 10px 0 0 0;
+
+
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+
+        .value {
+            flex-grow: 1;
+            color: var(--labelColor);
+
+        }
+    }
+}
+
+.dialog_two {
+    width: 80vw;
+
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .label {
+            width: 30vw;
+        }
+
+        .value {
+            flex-grow: 1;
+            color: var(--labelColor);
+
+        }
+    }
+
+    .btn {
+        margin: 2vw 0 0 0;
+        text-align: center;
+    }
+}

+ 155 - 2
pages/refereerace/list.wxml

@@ -1,2 +1,155 @@
-<!--pages/refereerace/list.wxml-->
-<text>pages/refereerace/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="container main">
+        <view class="one">
+            <input type="text" placeholder="请输入关键词" />
+        </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.match_time}}</view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>赛事名称:</text>
+                                <text>{{item.match_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>赛事组别:</text>
+                                <text>{{item.grouping_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>组内项目:</text>
+                                <text>{{item.project_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>赛事场地:</text>
+                                <text>{{item.ground_name}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>比赛状态:</text>
+                                <text>{{item.status=='0'?'已安排':item.status=='1'?'待开赛':item.status=='2'?'已开赛':item.status=='3'?'已结束':'暂无'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
+                            <button type="primary" size="mini" bindtap="toScore" data-item="{{item}}">赛事管理</button>
+                            <button type="primary" size="mini" bindtap="toChange" data-item="{{item}}" wx:if="{{item.score_one==16||item.score_two==16}}">更换场地</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
+            <view class="content">
+                <view class="label">赛事名称:</view>
+                <view class="value">{{form.match_name||'暂无'}}</view>
+            </view>
+            <view class="content">
+                <text class="label">赛事组别:</text>
+                <text class="value">{{form.grouping_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">比赛项目:</text>
+                <text class="value">{{form.project_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">赛事场地:</text>
+                <text class="value">{{form.ground_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">选手1:</text>
+                <text class="value">{{form.player_one_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">选手2:</text>
+                <text class="value">{{form.player_two_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">裁判名称:</text>
+                <text class="value">{{form.referee_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">选手1的比分纪录:</text>
+                <text class="value">{{form.score_one||0}}分</text>
+            </view>
+            <view class="content">
+                <text class="label">选手2的比分纪录:</text>
+                <text class="value">{{form.score_two||0}}分</text>
+            </view>
+            <view class="content">
+                <text class="label">胜者:</text>
+                <text class="value">{{form.winner_name||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">比赛时间:</text>
+                <text class="value">{{form.match_time||'暂无'}}</text>
+            </view>
+            <view class="content">
+                <text class="label">比赛状态:</text>
+                <text class="value">{{form.status=='0'?'已安排':form.status=='1'?'待开赛':form.status=='2'?'已开赛':form.status=='3'?'已结束':'暂无'}}</text>
+            </view>
+        </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <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">
+                    <view class="label">比赛状态:</view>
+                    <view class="value">
+                        <picker bindchange="statusChange" name="status" value="{{form.status}}" range-key='label' range="{{statusList}}">
+                            <view class="input">{{form.status=='0'?'已安排':form.status=='1'?'待开赛':form.status=='2'?'已开赛':form.status=='3'?'已结束':'请选择'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手一比分:{{form.player_one_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='0'}}">
+                    <view class="label">选手二比分:{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手二比分:{{form.player_two_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_two" maxlength="2" value="{{form.score_two}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="content" wx:if="{{form.is_change=='1'}}">
+                    <view class="label">选手一比分:{{form.player_one_name}}</view>
+                    <view class="value">
+                        <input type="number" name="score_one" maxlength="2" value="{{form.score_one}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">胜者:</view>
+                    <view class="value">
+                        <radio-group name="winner">
+                            <label>
+                                <radio value="{{form.player_one}}" checked="{{form.player_one==form.winner?true:false}}" />{{form.player_one_name}}
+                            </label>
+                            <label>
+                                <radio value="{{form.player_two}}" checked="{{form.player_two==form.winner?true:false}}" />{{form.player_two_name}}
+                            </label>
+                        </radio-group>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" form-type="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</e-dialog>

+ 97 - 1
pages/refereerace/list.wxss

@@ -1 +1,97 @@
-/* pages/refereerace/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.main .one {
+  padding: 2vw;
+  background-color: var(--f9Color);
+  margin: 0 0 2vw 0;
+}
+.main .one input {
+  padding: 1vw 2vw 2vw 2vw;
+  border-radius: 2px;
+  font-size: var(--txtSize);
+  background-color: var(--bgColor);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+}
+.main .two .list {
+  background-color: var(--f9Color);
+  margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  display: flex;
+  flex-direction: column;
+}
+.main .two .list .name {
+  font-size: var(--titleSize);
+  font-weight: bold;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other {
+  font-size: var(--txtSize);
+}
+.main .two .list .other .other_1 {
+  color: var(--labelColor);
+  margin: 2px 0 0 0;
+}
+.main .two .list .other .other_1 text:nth-child(2) {
+  color: var(--txtColor);
+}
+.main .two .list .other text {
+  padding: 0 2vw 0 0;
+}
+.main .two .list .btn {
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 2vw 0 0 2vw;
+  font-size: var(--btnSize);
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}
+.dialog_one {
+  margin: 10px 0 0 0;
+}
+.dialog_one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_one .content .value {
+  flex-grow: 1;
+  color: var(--labelColor);
+}
+.dialog_two {
+  width: 80vw;
+}
+.dialog_two .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_two .content .label {
+  width: 30vw;
+}
+.dialog_two .content .value {
+  flex-grow: 1;
+  color: var(--labelColor);
+}
+.dialog_two .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}

+ 2 - 5
pages/topic/index.js

@@ -3,11 +3,10 @@ Page({
     data: {
         frameStyle: { useTop: true, name: '话题', leftArrow: false, useBar: true },
         list: [],
-        //分页
+        total: 0,
         skip: 0,
         page: 0,
         limit: 5,
-        total: 0
     },
     // 跳转菜单
     tabPath(e) {
@@ -25,9 +24,7 @@ Page({
     },
     toView: function (e) {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/topic/info?id=${item._id}` })
     },

+ 1 - 4
pages/user/info.js

@@ -6,9 +6,7 @@ Page({
         form: {}
     },
     back: function () {
-        wx.navigateBack({
-            delta: 1,
-        })
+        wx.navigateBack({ delta: 1 })
     },
 
     /**
@@ -54,7 +52,6 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
     },
 
     /**

+ 19 - 15
pages/user/list.js

@@ -2,32 +2,36 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '用户管理', leftArrow: true, useBar: false },
-        oldList: [],
         list: [],
-        limit: 5,
-        skip: 0,
+        total: 0,
         page: 0,
+        skip: 0,
+        limit: 5,
     },
     back: function () {
-        wx.navigateBack({
-            delta: 1,
-        })
+        wx.navigateBack({ delta: 1 })
     },
     // 详细信息
     toView: function (e) {
         const that = this;
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/user/info?openid=${item.openid}` })
     },
     // 分页
-    upcroll: function () {
+    toPage: function () {
         const that = this;
-        let page = that.data.page + 1;
-        that.setData({ page })
-        const skip = page * that.data.limit;
-        that.setData({ skip });
-        that.watchLogin()
+        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 }) }
     },
     /**
      * 生命周期函数--监听页面加载
@@ -44,8 +48,8 @@ Page({
                 let arr;
                 arr = await app.$get(`/newCourt/api/user`, { ...info });
                 if (arr.errcode == '0') {
-                    if (arr.data && arr.data.length > 0) that.setData({ list: [...that.data.list, ...arr.data] })
-                    else wx.showToast({ title: `没有更多数据`, icon: 'success', duration: 2000 })
+                    that.setData({ list: [...that.data.list, ...arr.data] })
+                    that.setData({ total: arr.total })
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
             },

+ 1 - 1
pages/user/list.wxml

@@ -6,7 +6,7 @@
             </view>
         </view>
         <view class="two">
-            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="upcroll">
+            <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>

+ 12 - 0
utils/dict.js

@@ -120,4 +120,16 @@ export const match_project = [
 export const is_show_project = [
     { label: '公开', value: '0' },
     { label: '不公开', value: '1' },
+]
+// 赛事类别
+export const matchType = [
+    { label: '团体赛', value: '团体赛' },
+    { label: '单项赛', value: '单项赛' },
+];
+// 赛程状态
+export const race_status = [
+    { label: '已安排', value: '0' },
+    { label: '待开赛', value: '1' },
+    { label: '已开赛', value: '2' },
+    { label: '已结束', value: '3' },
 ]