Explorar o código

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

YY %!s(int64=2) %!d(string=hai) anos
pai
achega
5870c4dc28

+ 2 - 1
app.json

@@ -108,7 +108,8 @@
                 "matchAdmin/project/list",
                 "matchAdmin/project/add",
                 "matchAdmin/teamapply/list",
-                "test/index"
+                "test/index",
+                "match/info"
             ]
         }
     ],

+ 5 - 0
pages/match/index.js

@@ -41,6 +41,11 @@ Page({
         })
 
     },
+    // 详情
+    toView: function (e) {
+        const { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pagesMatch/match/info?id=${item._id}` })
+    },
     // 选择类型
     typeChange: function (e) {
         const that = this;

+ 1 - 1
pages/match/index.wxml

@@ -25,7 +25,7 @@
         <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="index">
+                    <view class="list" wx:for="{{list}}" wx:key="index" bindtap="toView" data-item="{{item}}">
                         <view class="list_1">
                             <image class="image" src="{{item.logo&&item.logo.length>0?item.logo[0].url:''}}"></image>
                         </view>

+ 113 - 0
pagesMatch/match/info.js

@@ -0,0 +1,113 @@
+const app = getApp();
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '赛事信息', leftArrow: true, useBar: false },
+        fileUrl: app.globalData.fileUrl,
+        id: '',
+        info: {},
+        user: {},
+        // 选项卡
+        tabs: {
+            active: 'a',
+            menu: [
+                { title: '规程', active: 'a' },
+                { title: '选手', active: 'b' },
+                { title: '秩序册', active: 'c' },
+                { title: '赛况', active: 'd' },
+                { title: '成绩册', active: 'e' },
+            ],
+        },
+        // 状态
+        statusList: []
+    },
+    // 返回
+    back: function () { wx.navigateBack({ delta: 1 }) },
+    // 选项卡
+    tabsChange: function (e) {
+        const that = this;
+        that.setData({ 'tabs.active': e.detail.active });
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' });
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: async function () {
+        const that = this;
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 状态
+        arr = await app.$get(`/dict`, { code: "match_status" });
+        if (arr.errcode == '0' && arr.total > 0) { that.setData({ statusList: arr.data[0].list }); }
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        const statusList = that.data.statusList;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data })
+                let arr;
+                // 比赛信息
+                arr = await app.$get(`/match/${that.data.id}`, {}, 'race');
+                if (arr.errcode == '0') {
+                    let status = statusList.find(i => i.value == arr.data.status)
+                    if (status) arr.data.zhStatus = status.label;
+                    let regular = arr.data.regular.replace(/\<img/gi, '<img style="width:100%;height:auto;margin: 5px 0"');
+                    if (regular) arr.data.zhRegular = regular;
+                    that.setData({ info: 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 () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pagesMatch/match/info.json

@@ -0,0 +1,7 @@
+{
+  "component": true,
+  "usingComponents": {
+    "mobile-main": "/commpents/mobile-frame/index",
+    "s-tab": "/commpents/tabs/index"
+  }
+}

+ 112 - 0
pagesMatch/match/info.less

@@ -0,0 +1,112 @@
+@import (css) "/app.wxss";
+
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        width: 100vw;
+    }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+
+        .a {
+            height: 83vh;
+
+            .a_1 {
+                width: 96vw;
+                display: flex;
+                flex-direction: column;
+                background-color: var(--mainColor);
+                position: relative;
+                margin: 2vw;
+
+                .image {
+                    width: 96vw;
+                    height: 160px;
+                }
+
+                .a_1_info {
+                    position: absolute;
+                    top: 30vw;
+                    width: 92vw;
+                    margin: 0 2vw;
+
+                    .a_1_1 {
+                        background-color: var(--mainColor);
+                        margin: 0 0 3vw 0;
+                        border-radius: 5px;
+                        padding: 2vw;
+                        box-shadow: 0 0 1vw var(--fcColor);
+
+                        .name {
+                            font-size: var(--font18Szie);
+                            font-weight: bold;
+                            margin: 0 0 2vw 0;
+                        }
+
+                        .status {
+                            margin: 0 0 2vw 0;
+
+                            text {
+                                display: inline-block;
+                                background-color: var(--redColor);
+                                color: var(--whiteColor);
+                                padding: 1vw 3vw;
+                                border-radius: 5px;
+                            }
+                        }
+
+                        .other {
+                            .other_1 {
+                                margin: 0 0 1vw 0;
+                                font-size: var(--font16Szie);
+                                color: var(--f85Color);
+
+                                .icon {
+                                    margin: 0 2vw 0 0;
+                                }
+
+                                text:nth-child(3) {
+                                    color: var(--blackColor);
+                                }
+                            }
+                        }
+                    }
+
+                    .a_1_2 {
+                        .a_1_2t {
+                            margin: 0 0 1vw 0;
+
+                            .txt {
+                                font-size: var(--font16Szie);
+                                margin: 0 0 1vw 0;
+                            }
+
+                            .cont {
+                                font-size: var(--font14Szie);
+                                color: var(--f85Color);
+                                text-indent: 1rem;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 60 - 0
pagesMatch/match/info.wxml

@@ -0,0 +1,60 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
+        </view>
+        <view class="two">
+            <view wx:if="{{tabs.active=='a'}}" class="a">
+                <scroll-view scroll-y="true" class="scroll-view">
+                    <view class="list-scroll-view">
+                        <view class="a_1">
+                            <image class="image" src="{{fileUrl}}/files/court/elimg/20220729140648.png"></image>
+                            <view class="a_1_info">
+                                <view class="a_1_1">
+                                    <view class="name">{{info.name}}</view>
+                                    <view class="status"><text>{{info.zhStatus}}</text></view>
+                                    <view class="other">
+                                        <view class="other_1">
+                                            <text>报名截止时间:</text>
+                                            <text>{{info.sign_time}}</text>
+                                        </view>
+                                        <view class="other_1">
+                                            <text>比赛时间:</text>
+                                            <text>{{info.start_time}}-{{info.end_time}}</text>
+                                        </view>
+                                        <view class="other_1">
+                                            <text>比赛地点:</text>
+                                            <text>{{info.address}}</text>
+                                        </view>
+                                        <view class="other_1">
+                                            <text>报名费用说明:</text>
+                                            <text>{{info.money_remark}}</text>
+                                        </view>
+                                        <view class="other_1">
+                                            <text>付款方式:</text>
+                                            <text>{{info.money_mode}}</text>
+                                        </view>
+                                    </view>
+                                </view>
+                                <view class="a_1_1 a_1_2">
+                                    <view class="a_1_2t">
+                                        <view class="txt">报名说明:</view>
+                                        <view class="cont">{{info.explain}}</view>
+                                    </view>
+                                    <view class="a_1_2t">
+                                        <view class="txt">赛事规程:</view>
+                                        <rich-text nodes="{{info.zhRegular}}"></rich-text>
+                                    </view>
+                                </view>
+                            </view>
+                        </view>
+                    </view>
+                </scroll-view>
+            </view>
+            <view wx:if="{{tabs.active=='b'}}" class="b">选手</view>
+            <view wx:if="{{tabs.active=='c'}}" class="c">秩序册</view>
+            <view wx:if="{{tabs.active=='d'}}" class="d">赛况</view>
+            <view wx:if="{{tabs.active=='e'}}" class="e">成绩册</view>
+        </view>
+    </view>
+</mobile-main>

+ 89 - 0
pagesMatch/match/info.wxss

@@ -0,0 +1,89 @@
+@import "/app.wxss";
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 100vw;
+}
+.main .two {
+  position: relative;
+  flex-grow: 1;
+}
+.main .two .a {
+  height: 83vh;
+}
+.main .two .a .a_1 {
+  width: 96vw;
+  display: flex;
+  flex-direction: column;
+  background-color: var(--mainColor);
+  position: relative;
+  margin: 2vw;
+}
+.main .two .a .a_1 .image {
+  width: 96vw;
+  height: 160px;
+}
+.main .two .a .a_1 .a_1_info {
+  position: absolute;
+  top: 30vw;
+  width: 92vw;
+  margin: 0 2vw;
+}
+.main .two .a .a_1 .a_1_info .a_1_1 {
+  background-color: var(--mainColor);
+  margin: 0 0 3vw 0;
+  border-radius: 5px;
+  padding: 2vw;
+  box-shadow: 0 0 1vw var(--fcColor);
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .name {
+  font-size: var(--font18Szie);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .status {
+  margin: 0 0 2vw 0;
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .status text {
+  display: inline-block;
+  background-color: var(--redColor);
+  color: var(--whiteColor);
+  padding: 1vw 3vw;
+  border-radius: 5px;
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .other .other_1 {
+  margin: 0 0 1vw 0;
+  font-size: var(--font16Szie);
+  color: var(--f85Color);
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .other .other_1 .icon {
+  margin: 0 2vw 0 0;
+}
+.main .two .a .a_1 .a_1_info .a_1_1 .other .other_1 text:nth-child(3) {
+  color: var(--blackColor);
+}
+.main .two .a .a_1 .a_1_info .a_1_2 .a_1_2t {
+  margin: 0 0 1vw 0;
+}
+.main .two .a .a_1 .a_1_info .a_1_2 .a_1_2t .txt {
+  font-size: var(--font16Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .a .a_1 .a_1_info .a_1_2 .a_1_2t .cont {
+  font-size: var(--font14Szie);
+  color: var(--f85Color);
+  text-indent: 1rem;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}