guhongwei 2 tahun lalu
induk
melakukan
1d4409c5ac

File diff ditekan karena terlalu besar
+ 94 - 1
pages/match/matchadd.js


+ 2 - 1
pages/match/matchadd.json

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

+ 35 - 1
pages/match/matchadd.less

@@ -1,4 +1,38 @@
 .main {
     height: 88.8vh;
-    background-color: #ff0000;
+
+    .one {
+        width: 96vw;
+
+        .content {
+            background-color: #ffffff;
+            border-bottom: 1px solid #cccccc;
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            padding: 2vw;
+            width: 92vw;
+
+            .label {
+                width: 25vw;
+                text-align: left;
+                font-size: 14px;
+            }
+
+            .value {
+                width: 65vw;
+                text-align: right;
+                font-size: 14px;
+
+                textarea {
+                    width: 65vw;
+                }
+            }
+        }
+
+        .btn {
+            margin: 2vw 0 0 0;
+            text-align: center;
+        }
+    }
 }

+ 87 - 1
pages/match/matchadd.wxml

@@ -1,5 +1,91 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-        赛事信息
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">logo</view>
+                    <view class="value">
+                        <vanupload list="{{logo}}" count="{{1}}" previewSize="{{50}}" 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">
+                        <input type="text" name="name" value="{{form.name}}" 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">
+                        <input type="text" name="address" value="{{form.address}}" placeholder="请输入比赛地点" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">报名截止时间</view>
+                    <view class="value">
+                        <picker mode="date" name="sign_end_time" value="{{form.sign_end_time}}" bindchange="signendChange">
+                            <view class="picker">{{form.sign_end_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="content">
+                    <view class="label">赛事规程</view>
+                    <view class="value">
+                        <textarea name="regular" value="{{form.regular}}" auto-height placeholder="请输入赛事规程" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" form-type="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
     </view>
 </mobile-main>

+ 29 - 1
pages/match/matchadd.wxss

@@ -1,4 +1,32 @@
 .main {
   height: 88.8vh;
-  background-color: #ff0000;
+}
+.main .one {
+  width: 96vw;
+}
+.main .one .content {
+  background-color: #ffffff;
+  border-bottom: 1px solid #cccccc;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding: 2vw;
+  width: 92vw;
+}
+.main .one .content .label {
+  width: 25vw;
+  text-align: left;
+  font-size: 14px;
+}
+.main .one .content .value {
+  width: 65vw;
+  text-align: right;
+  font-size: 14px;
+}
+.main .one .content .value textarea {
+  width: 65vw;
+}
+.main .one .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
 }

+ 56 - 13
pages/match/mess.js

@@ -6,31 +6,72 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
-        list: [
-            {
-                status: '0',
-                icon: [{ url: "http://broadcast.waityou24.cn/files/court/elimg/20220728102205.jpg" }],
-                name: '2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛',
-                sign_end_time: '2021/10/12-2022/07/15',
-                start_time: '2021/10/12',
-                end_time: '2021/10/12',
-                address: '吉林省长春市朝阳区前进大街1244号'
-            },
-        ]
+        list: [],
+        searchInfo: {}
     },
     // 跳转菜单
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    search: function (e) {
+        const that = this;
+        that.setData({ 'searchInfo.name': e.detail.value });
+        that.watchLogin()
+    },
     toAdd: function () {
         wx.navigateTo({ url: `/pages/match/matchadd` })
     },
+    toView: function (e) {
+        const { item } = e.currentTarget.dataset;
+        console.log(item);
+    },
+    toEdit: function (e) {
+        const { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/matchadd?id=${item._id}` })
+    },
+    toDel: async function (e) {
+        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.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 });
+                    }
+                }
+            }
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
         const that = this;
-
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    watchLogin: function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async (res) => {
+                let info = {};
+                if (searchInfo && searchInfo.name) info.name = searchInfo.name;
+                const arr = await app.$get(`/newCourt/api/match`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: arr.data })
+                } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+            },
+            fail: async (res) => {
+                wx.redirectTo({ url: '/pages/index/index' });
+            },
+        });
     },
     /**
      * 生命周期函数--监听页面初次渲染完成
@@ -43,7 +84,9 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
 
     /**

+ 2 - 1
pages/match/mess.less

@@ -34,6 +34,7 @@
 
             button {
                 font-size: 14px;
+            
             }
         }
     }
@@ -118,7 +119,7 @@
                         text-align: center;
 
                         button {
-                            margin: 0 2vw;
+                            margin: 0 2vw 2vw 2vw;
                             font-size: 14px;
                         }
                     }

+ 8 - 6
pages/match/mess.wxml

@@ -2,7 +2,7 @@
     <view slot="info" class="container main">
         <view class="zero one">
             <view class="one_1">
-                <input type="text" value="{{searchInfo.name}}" placeholder="请输入比赛名称" />
+                <input type="text" value="{{searchInfo.name}}" bindconfirm="search" placeholder="请输入比赛名称" />
             </view>
             <view class="one_2">
                 <button type="primary" size="mini" bindtap="toAdd">添加</button>
@@ -14,11 +14,11 @@
                     <view class="list" wx:for="{{list}}" wx:key="item">
                         <view class="info">
                             <view class="list_1">
-                                <image class="image" src="{{item.icon&&item.icon.length>0?item.icon[0].url:''}}"></image>
+                                <image class="image" src="{{item.logo&&item.logo.length>0?item.logo[0].url:''}}"></image>
                             </view>
                             <view class="list_2">
                                 <view class="name">
-                                    <text class="status">{{item.status=='0'?'报名中':''}}</text>
+                                    <text class="status">{{item.status=='0'?'报名中':'暂无'}}</text>
                                     <text>{{item.name}}</text>
                                 </view>
                                 <view class="other">
@@ -38,9 +38,11 @@
                             </view>
                         </view>
                         <view class="btn">
-                            <button type="default" size="mini">详情</button>
-                            <button type="primary" size="mini">维护</button>
-                            <button type="warn" size="mini">删除</button>
+                            <button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">信息维护</button>
+                            <button type="primary" size="mini" bindtap="toGroup" data-item="{{item}}">赛事组别</button>
+                            <button type="primary" size="mini" bindtap="toStatus" data-item="{{item}}">赛事状态</button>
+                            <button type="default" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
+                            <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">赛事删除</button>
                         </view>
                     </view>
                 </view>

+ 1 - 1
pages/match/mess.wxss

@@ -102,6 +102,6 @@
   text-align: center;
 }
 .main .two .scroll-view .list-scroll-view .list .btn button {
-  margin: 0 2vw;
+  margin: 0 2vw 2vw 2vw;
   font-size: 14px;
 }

+ 6 - 0
utils/dict.js

@@ -15,6 +15,12 @@ export const match_status = [
     { label: '4', value: '比赛中' },
     { label: '5', value: '比赛结束' },
 ]
+// 赛事类别
+export const matchType = [
+    { label: '团体赛', value: '团体赛' },
+    { label: '单项赛', value: '单项赛' },
+
+]
 // 我的页面,功能按钮
 // -1:管理员,0:普通用户,1:裁判用户
 export const myBtn = [