guhongwei 2 years ago
parent
commit
7e93640bc0

+ 2 - 1
app.json

@@ -15,9 +15,9 @@
         "pages/my/userInfo",
         "pages/matchInfo/index",
         "pages/matchInfo/sign",
+        "pages/match/mess",
         "pages/matchInfo/achieve",
         "pages/user/index",
-        "pages/match/mess",
         "pages/match/matchadd",
         "pages/match/matchgroup",
         "pages/match/sign",
@@ -48,6 +48,7 @@
         "pages/orderbook/teamAdd",
         "pages/orderbook/raceAdd",
         "pages/orderbook/autoAdd",
+        "pages/referee/match",
         "pages/test/index",
         "pages/match/index",
         "pages/f6test/index",

+ 1 - 1
app.wxss

@@ -15,4 +15,4 @@
     white-space: nowrap;
 }
 
-@import "/icon/icon.wxss";
+/* @import "/icon/icon.wxss"; */

+ 2 - 2
commpents/match-achieve/personal.wxml

@@ -3,7 +3,7 @@
     <view class="tr bg-w">
         <view class="th" wx:for="{{top}}" wx:key="index">{{item}}</view>
     </view>
-    <block wx:for="{{ownintegralList}}" wx:key="item" wx:for-index="index">
+    <block wx:for="{{ownintegralList}}" wx:key="item" wx:for-index="index" wx:key="item">
         <view class="tr bg-g" wx:if="{{index % 2 == 0}}">
             <view class="td">
                 <text wx:for="{{item.person}}" wx:for-item="person">{{person.name}}/</text>
@@ -14,7 +14,7 @@
         </view>
         <view class="tr" wx:else>
             <view class="td">
-                <text wx:for="{{item.person}}" wx:for-item="person">{{person.name}}/</text>
+                <text wx:for="{{item.person}}" wx:for-item="person" wx:key="item">{{person.name}}/</text>
             </view>
             <!-- <view class="td">{{item.address||'--'}}</view> -->
             <view class="td">{{item.integral}}</view>

+ 24 - 1
pages/match/mess.js

@@ -1,5 +1,6 @@
 import { match_status } from '../../utils/dict';
 const app = getApp()
+import QRCode from '../../utils/weapp-qrcode.js';
 
 Page({
 
@@ -12,7 +13,7 @@ Page({
         searchInfo: {},
         dialog: { title: '赛事状态', show: false, type: '1' },
         form: {},
-        statusList: match_status
+        statusList: match_status,
     },
     // 跳转菜单
     back(e) {
@@ -33,6 +34,28 @@ Page({
         const { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/matchInfo/index?id=${item._id}` })
     },
+    // 分享
+    toShare: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        that.setData({ form: item });
+        // 生成二维码
+        that.makeQRCode();
+        that.setData({ dialog: { title: '赛事分享', show: true, type: '2' } });
+    },
+    makeQRCode(template = 0) {
+        const that = this;
+        const url = `${app.globalData.publicUrl}/courtapp?id=${that.data.form.id}`;
+        var qrcode = new QRCode(`myQrcode`, {
+            text: url,
+            width: 110,
+            height: 110,
+            padding: 3,
+            colorDark: "#000000",
+            colorLight: "#ffffff",
+            correctLevel: QRCode.CorrectLevel.L,
+        });
+    },
     // 修改
     toEdit: function (e) {
         const { item } = e.currentTarget.dataset;

+ 27 - 0
pages/match/mess.less

@@ -165,4 +165,31 @@
         margin: 2vw 0 0 0;
         text-align: center;
     }
+}
+
+.dialog_2 {
+    .name {
+        text-align: center;
+        font-size: 18px;
+        font-weight: bold;
+        margin: 3vw 0;
+    }
+
+    .image {
+        text-align: center;
+        height: 18vh;
+        overflow: hidden;
+
+        .qrcode {
+            height: 22vh;
+            position: absolute;
+            left: 30vw;
+        }
+    }
+
+    .remark {
+        text-align: center;
+        font-size: 15px;
+        margin: 0 0 4vw 0;
+    }
 }

+ 10 - 0
pages/match/mess.wxml

@@ -42,6 +42,7 @@
                             <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="default" size="mini" bindtap="toShare" data-item="{{item}}">赛事分享</button>
                             <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">赛事删除</button>
                         </view>
                     </view>
@@ -73,5 +74,14 @@
                 </view>
             </form>
         </view>
+        <view class="dialog_2" wx:elif="{{dialog.type=='2'}}">
+            <view class="name">{{form.name}}</view>
+            <view class="image">
+                <canvas class="qrcode" canvas-id="myQrcode"></canvas>
+            </view>
+            <view class="remark">
+                用户可臊面二维码查看赛事详细信息
+            </view>
+        </view>
     </view>
 </e-dialog>

+ 21 - 0
pages/match/mess.wxss

@@ -136,3 +136,24 @@
   margin: 2vw 0 0 0;
   text-align: center;
 }
+.dialog_2 .name {
+  text-align: center;
+  font-size: 18px;
+  font-weight: bold;
+  margin: 3vw 0;
+}
+.dialog_2 .image {
+  text-align: center;
+  height: 18vh;
+  overflow: hidden;
+}
+.dialog_2 .image .qrcode {
+  height: 22vh;
+  position: absolute;
+  left: 30vw;
+}
+.dialog_2 .remark {
+  text-align: center;
+  font-size: 15px;
+  margin: 0 0 4vw 0;
+}

+ 28 - 24
pages/matchInfo/index.js

@@ -95,6 +95,7 @@ Page({
         that.setData({ id: options.id || '62e388d4fd61d871861b80af' });
         // 监听用户是否登录
         that.watchLogin();
+        that.search()
     },
     watchLogin: function () {
         const that = this;
@@ -102,35 +103,38 @@ Page({
             key: 'user',
             success: async (res) => {
                 that.setData({ user: res.data })
-                if (that.data.id) {
-                    let arr;
-                    // 比赛信息
-                    arr = await app.$get(`/newCourt/api/match/${that.data.id}`);
-                    if (arr.errcode == '0') {
-                        arr.data.statusZh = that.getStatusZh(arr.data.status);
-                        that.setData({ info: arr.data })
-                    } else { wx.showToast({ title: `${res.errmsg}`, icon: 'fail', duration: 2000 }); }
-                    // 选手信息
-                    arr = await app.$get(`/newCourt/api/view/groupProjectUser?match_id=${that.data.id}`);
-                    if (arr.errcode == '0') { that.setData({ groupList: arr.data }) };
-                    // 查询场地信息
-                    arr = await app.$get(`/newCourt/api/ground`, { is_use: '0' });
-                    let ground = [{ title: '全部场地', name: 0 }]
-                    if (arr.errcode == '0') {
-                        for (const [index, val] of arr.data.entries()) {
-                            ground.push({ title: val.name, name: index + 1, _id: val._id })
-                        }
-                    }
-                    that.setData({ 'dtabs.list': ground })
-                    // 赛程信息
-                    that.searchOrder();
-                }
             },
             fail: async (res) => {
-                wx.redirectTo({ url: '/pages/index/index' });
+                wx.showToast({ title: `暂无登陆信息`, icon: 'fail', duration: 2000 });
             },
         });
     },
+    search: async function () {
+        const that = this;
+        if (that.data.id) {
+            let arr;
+            // 比赛信息
+            arr = await app.$get(`/newCourt/api/match/${that.data.id}`);
+            if (arr.errcode == '0') {
+                arr.data.statusZh = that.getStatusZh(arr.data.status);
+                that.setData({ info: arr.data })
+            } else { wx.showToast({ title: `${res.errmsg}`, icon: 'fail', duration: 2000 }); }
+            // 选手信息
+            arr = await app.$get(`/newCourt/api/view/groupProjectUser?match_id=${that.data.id}`);
+            if (arr.errcode == '0') { that.setData({ groupList: arr.data }) };
+            // 查询场地信息
+            arr = await app.$get(`/newCourt/api/ground`, { is_use: '0' });
+            let ground = [{ title: '全部场地', name: 0 }]
+            if (arr.errcode == '0') {
+                for (const [index, val] of arr.data.entries()) {
+                    ground.push({ title: val.name, name: index + 1, _id: val._id })
+                }
+            }
+            that.setData({ 'dtabs.list': ground })
+            // 赛程信息
+            that.searchOrder();
+        }
+    },
     // 查询赛程信息
     searchOrder: async function () {
         wx.showLoading({ title: '加载中', mask: true })

+ 4 - 4
pages/matchInfo/index.wxml

@@ -59,19 +59,19 @@
                     <view class="list-scroll-view">
                         <view class="b_1">
                             <van-collapse value="{{ bActive }}" accordion bind:change="bChange">
-                                <van-collapse-item name="{{index}}" class="groupList" wx:for="{{groupList}}" wx:for-item="item" wx:for-index="index">
+                                <van-collapse-item name="{{index}}" class="groupList" wx:for="{{groupList}}" wx:key="item" wx:for-item="item" wx:for-index="index">
                                     <view slot="title" class="title">
                                         <view>{{item.name}}({{item.age}},{{item.gender}})</view>
                                         <view>{{item.total}}人</view>
                                     </view>
                                     <view class="project">
-                                        <view class="projectList" wx:for="{{item.project}}" wx:for-item="tag">
+                                        <view class="projectList" wx:for="{{item.project}}" wx:for-item="tag" wx:key="tag">
                                             <view class="project_1">
                                                 <view class="project_1_1">组内项目:{{tag.name}}</view>
                                                 <view class="project_1_1">{{tag.total}}人</view>
                                             </view>
                                             <view class="user">
-                                                <view class="userList" wx:for="{{tag.user}}" wx:for-item="qwe">
+                                                <view class="userList" wx:for="{{tag.user}}" wx:for-item="qwe" wx:key="qwe">
                                                     <image class="icon" src="{{qwe.icon[0].url}}"></image>
                                                     <view class="name">{{qwe.name}}</view>
                                                 </view>
@@ -172,7 +172,7 @@
                 </scroll-view>
             </view>
         </view>
-        <view class="zero two" wx:if="{{user.type=='0'}}">
+        <view class="zero two" wx:if="{{user&&user.type=='0'}}">
             <view class="two_1">
                 <button type="default" bindtap="toCommon" data-route="home">更多赛事</button>
             </view>

+ 90 - 0
pages/referee/match.js

@@ -0,0 +1,90 @@
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '我的赛事', leftArrow: true, useBar: false },
+        searchInfo: {},
+        list: []
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    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: 0, limit: 1000, referee_id: res.data.opneid || 'oH0y05QJCvBQQpoobbtHTkpL4z4I' };
+                // if (searchInfo && searchInfo.name) info.name = searchInfo.name;
+                const arr = await app.$get(`/newCourt/api/race`, { ...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' });
+            },
+        });
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/referee/match.json

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

+ 82 - 0
pages/referee/match.less

@@ -0,0 +1,82 @@
+.main {
+    height: 88.8vh;
+
+    .zero {
+        width: 96vw;
+        margin: 0 0 2vw 0;
+
+    }
+
+    .zero:last-child {
+        margin: 0;
+    }
+
+    .one {
+        background-color: #f1f1f1;
+        width: 92vw;
+        padding: 2vw;
+    }
+
+    .two {
+        flex-grow: 1;
+        width: 96vw;
+        position: relative;
+
+        .scroll-view {
+            position: absolute;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+
+            .list-scroll-view {
+                display: flex;
+                flex-direction: column;
+
+                .list {
+                    background-color: #ffffff;
+                    border-bottom: 1px solid #cccccc;
+                    width: 96vw;
+                    padding: 2vw;
+
+                    .name {
+                        font-size: 18px;
+                        margin: 0 0 1vw 0;
+                        font-weight: bold;
+                    }
+
+                    .other {
+                        margin: 0 0 1vw 0;
+
+                        .other_1 {
+                            margin: 0 0 1vw 0;
+                            font-size: 15px;
+
+                            text {
+                                color: #000000;
+                            }
+
+                            text:nth-child(1) {
+                                color: #858585;
+                            }
+
+                        }
+                    }
+
+                    .btn {
+                        text-align: center;
+
+                        button {
+                            margin: 0 2vw;
+                            font-size: 14px;
+                        }
+                    }
+                }
+
+                .list:last-child {
+                    border-bottom: none;
+                }
+            }
+        }
+    }
+}

+ 41 - 0
pages/referee/match.wxml

@@ -0,0 +1,41 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="container main">
+        <view class="zero one">
+            <input type="text" value="{{searchInfo.name}}" bindconfirm="search" placeholder="请输入关键词" />
+        </view>
+        <view class="zero two">
+            <scroll-view scroll-y="true" class="scroll-view">
+                <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">赛事比分</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 65 - 0
pages/referee/match.wxss

@@ -0,0 +1,65 @@
+.main {
+  height: 88.8vh;
+}
+.main .zero {
+  width: 96vw;
+  margin: 0 0 2vw 0;
+}
+.main .zero:last-child {
+  margin: 0;
+}
+.main .one {
+  background-color: #f1f1f1;
+  width: 92vw;
+  padding: 2vw;
+}
+.main .two {
+  flex-grow: 1;
+  width: 96vw;
+  position: relative;
+}
+.main .two .scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.main .two .scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}
+.main .two .scroll-view .list-scroll-view .list {
+  background-color: #ffffff;
+  border-bottom: 1px solid #cccccc;
+  width: 96vw;
+  padding: 2vw;
+}
+.main .two .scroll-view .list-scroll-view .list .name {
+  font-size: 18px;
+  margin: 0 0 1vw 0;
+  font-weight: bold;
+}
+.main .two .scroll-view .list-scroll-view .list .other {
+  margin: 0 0 1vw 0;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 {
+  margin: 0 0 1vw 0;
+  font-size: 15px;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 text {
+  color: #000000;
+}
+.main .two .scroll-view .list-scroll-view .list .other .other_1 text:nth-child(1) {
+  color: #858585;
+}
+.main .two .scroll-view .list-scroll-view .list .btn {
+  text-align: center;
+}
+.main .two .scroll-view .list-scroll-view .list .btn button {
+  margin: 0 2vw;
+  font-size: 14px;
+}
+.main .two .scroll-view .list-scroll-view .list:last-child {
+  border-bottom: none;
+}

+ 0 - 1
pages/topic/index.js

@@ -50,7 +50,6 @@ Page({
             const arr = await app.$get(`/newCourt/api/topic`, { ...info });
             if (arr.errcode == '0') {
                that.setData({ list: arr.data })
-               console.log(arr.data);
             }
             else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
          },

+ 5 - 5
utils/dict.js

@@ -109,11 +109,11 @@ export const myBtn = [
     {
         type: '1',
         btn: [
-            // {
-            //     title: '我的赛事',
-            //     route: 'usermymatch/index',
-            //     routeList: []
-            // },
+            {
+                title: '我的赛事',
+                route: 'referee/match',
+                routeList: []
+            },
             {
                 title: '账号管理',
                 routeList: [

File diff suppressed because it is too large
+ 426 - 0
utils/weapp-qrcode.js