zs 2 år sedan
förälder
incheckning
970f6bd6a5

+ 2 - 1
app.json

@@ -1,12 +1,13 @@
 {
     "pages": [
+        "pages/my/index",
         "pages/index/index",
         "pages/login/index",
         "pages/register/index",
         "pages/home/index",
         "pages/news/index",
         "pages/topic/index",
-        "pages/my/index",
+
         "pages/test/index",
         "pages/other/agree",
         "pages/logs/logs"

+ 1 - 1
pages/index/index.less

@@ -1,5 +1,5 @@
 .main {
-    height: 91vh;
+    height: var(--twoHeight);
     background-color: var(--bgColor);
 
     .one {

+ 1 - 1
pages/index/index.wxss

@@ -1,5 +1,5 @@
 .main {
-  height: 91vh;
+  height: var(--twoHeight);
   background-color: var(--bgColor);
 }
 .main .one {

+ 28 - 10
pages/my/index.js

@@ -1,29 +1,47 @@
 const app = getApp()
+import { myBtn } from "../../utils/dict";
 Page({
     data: {
         frameStyle: { useTop: true, name: '我的', leftArrow: false, useBar: true },
+        user: {},
+        btnList: [],
     },
     // 跳转菜单
     tabPath(e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
+    toCommon: function (e) {
+        const { route } = e.currentTarget.dataset;
+        if (route) { wx.navigateTo({ url: `/pages/${route}` }) };
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) { },
     // 监听用户是否登录
     watchLogin: async function () {
-        // 监听用户是否登录,
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-                // if (res.data) wx.redirectTo({ url: '/pages/home/index' })
-            },
-            fail: async res => {
-                // wx.redirectTo({ url: '/pages/home/index' })
-            }
-        })
+        const that = this;
+        let user = { icon: [{ url: '/image/wechat.png' }], name: '张爽', phone: '12345678901', type: '-1' };
+        that.setData({ user: user });
+        let btnData = myBtn.find((i) => i.type == user.type);
+        that.setData({ btnList: btnData.btn })
+        // wx.getStorage({
+        //     key: 'user',
+        //     success: async (res) => {
+        //         const arr = await app.$get(`/newCourt/api/user/${res.data.openid}`);
+        //         if (arr.errcode == '0') {
+        //             let user = arr.data;
+        //             that.setData({ user: user });
+        //             let btnData = myBtn.find((i) => i.type == user.type);
+        //             that.setData({ btnList: btnData.btn })
+
+        //         } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+        //     },
+        //     fail: async (res) => {
+        //         wx.redirectTo({ url: '/pages/index/index' });
+        //     },
+        // });
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 137 - 14
pages/my/index.less

@@ -1,17 +1,140 @@
 .main {
-    height: 83vh;
-    background-color: #ffffff;
-}
-
-.scroll-view {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-
-    .list-scroll-view {
-        display: flex;
-        flex-direction: column;
+    height: var(--thrHeight);
+
+    .zero {
+        margin: 0 2vw 2vw 2vw;
+    }
+
+    .one {
+        position: relative;
+        height: 120px;
+
+        .one_1 {
+            height: 80px;
+            background-color: #216EC7;
+            border-bottom-left-radius: 10px;
+            border-bottom-right-radius: 10px;
+            color: transparent;
+        }
+
+        .one_2 {
+            position: absolute;
+            top: 5vw;
+            width: 86vw;
+            height: 86px;
+            margin: 0 3vw;
+            padding: 2vw;
+            background-color: var(--bgColor);
+            display: flex;
+            justify-content: space-between;
+
+            .l {
+                display: flex;
+                justify-content: start;
+                width: 72vw;
+
+                .l_1 {
+                    padding: 3vw 0;
+
+                    .icon {
+                        width: 60px;
+                        height: 60px;
+                        border-radius: 90px;
+                    }
+                }
+
+                .l_2 {
+                    width: 56vw;
+                    padding: 4vw 0 0 0;
+
+                    .info {
+                        margin: 0 0 2vw 0;
+                        padding: 0 2vw;
+                        font-size: var(--txtSize);
+                    }
+
+                    .info:nth-child(1) {
+                        font-weight: bold;
+                        font-size: var(--titleSize);
+                    }
+
+                    .info:nth-child(2) {
+                        color: var(--labelColor);
+                        font-size: 15px;
+                    }
+                }
+            }
+
+            .r {
+                padding: 8vw 0;
+                font-size: var(--txtSize);
+                color: var(--labelColor);
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+
+        .scroll-view {
+            position: absolute;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+
+            .list-scroll-view {
+                display: flex;
+                flex-wrap: wrap;
+                align-content: flex-start;
+                justify-content: space-between;
+
+                .list {
+                    display: flex;
+                    flex-direction: row;
+                    justify-content: space-between;
+                    background-color: var(--bgColor);
+                    width: 96vw;
+                    margin: 0 0 1.5vw 0;
+                    padding: 2vw;
+
+                    .list_1 {
+
+                        .icon {
+                            margin: 0 2vw 0 0;
+                        }
+
+                        .title {
+                            font-size: var(--txtSize);
+                        }
+                    }
+
+                    .list_2 {
+                        display: flex;
+                        flex-direction: row;
+                        justify-content: space-between;
+                        flex-wrap: wrap;
+
+                        .routeList {
+                            width: 26vw;
+                            padding: 2vw;
+
+                            .route_1 {
+                                display: flex;
+                                flex-direction: column;
+                                justify-content: center;
+
+                                .title {
+                                    font-size: var(--txtSize);
+                                    padding: 1vw 0 0 0;
+                                    text-align: center;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 }

+ 39 - 1
pages/my/index.wxml

@@ -1,5 +1,43 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
     <view slot="info" class="container main">
-        我的
+        <view class="zero one">
+            <view class="one_1"></view>
+            <view class="one_2">
+                <view class="l">
+                    <view class="l_1">
+                        <image class="icon" src="{{user.icon&&user.icon.length>0?user.icon[0].url:''}}"></image>
+                    </view>
+                    <view class="l_2">
+                        <view class="info textOver">{{user.name}}</view>
+                        <view class="info textOver">{{user.phone}}</view>
+                    </view>
+                </view>
+                <view class="r">
+                    <text bindtap="toCommon" data-route="my/userInfo">详细</text>
+                    <van-icon name="arrow" />
+                </view>
+            </view>
+        </view>
+        <view class="zero two">
+            <scroll-view scroll-y="true" class="scroll-view">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{btnList}}" wx:key="item" bindtap="toCommon" data-route="{{item.route}}">
+                        <view class="list_1 textOver">
+                            <view>
+                                <van-icon class="icon" name="like-o" /><text class="title">{{item.title}}</text>
+                            </view>
+                            <view class="list_2" wx:if="{{item.routeList&&item.routeList.length>0}}">
+                                <view class="routeList" wx:for="{{item.routeList}}" wx:for-item="tag" wx:key="tagIndex" bindtap="toCommon" data-route="{{tag.route}}">
+                                    <view class="route_1 textOver">
+                                        <van-icon name="smile-o" />
+                                        <text class="title">{{tag.title}}</text>
+                                    </view>
+                                </view>
+                            </view>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
     </view>
 </mobile-main>

+ 104 - 4
pages/my/index.wxss

@@ -1,15 +1,115 @@
 .main {
-  height: 83vh;
-  background-color: #ffffff;
+  height: var(--thrHeight);
 }
-.scroll-view {
+.main .zero {
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one {
+  position: relative;
+  height: 120px;
+}
+.main .one .one_1 {
+  height: 80px;
+  background-color: #216EC7;
+  border-bottom-left-radius: 10px;
+  border-bottom-right-radius: 10px;
+  color: transparent;
+}
+.main .one .one_2 {
+  position: absolute;
+  top: 5vw;
+  width: 86vw;
+  height: 86px;
+  margin: 0 3vw;
+  padding: 2vw;
+  background-color: var(--bgColor);
+  display: flex;
+  justify-content: space-between;
+}
+.main .one .one_2 .l {
+  display: flex;
+  justify-content: start;
+  width: 72vw;
+}
+.main .one .one_2 .l .l_1 {
+  padding: 3vw 0;
+}
+.main .one .one_2 .l .l_1 .icon {
+  width: 60px;
+  height: 60px;
+  border-radius: 90px;
+}
+.main .one .one_2 .l .l_2 {
+  width: 56vw;
+  padding: 4vw 0 0 0;
+}
+.main .one .one_2 .l .l_2 .info {
+  margin: 0 0 2vw 0;
+  padding: 0 2vw;
+  font-size: var(--txtSize);
+}
+.main .one .one_2 .l .l_2 .info:nth-child(1) {
+  font-weight: bold;
+  font-size: var(--titleSize);
+}
+.main .one .one_2 .l .l_2 .info:nth-child(2) {
+  color: var(--labelColor);
+  font-size: 15px;
+}
+.main .one .one_2 .r {
+  padding: 8vw 0;
+  font-size: var(--txtSize);
+  color: var(--labelColor);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+}
+.main .two .scroll-view {
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
 }
-.scroll-view .list-scroll-view {
+.main .two .scroll-view .list-scroll-view {
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  justify-content: space-between;
+}
+.main .two .scroll-view .list-scroll-view .list {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  background-color: var(--bgColor);
+  width: 96vw;
+  margin: 0 0 1.5vw 0;
+  padding: 2vw;
+}
+.main .two .scroll-view .list-scroll-view .list .list_1 .icon {
+  margin: 0 2vw 0 0;
+}
+.main .two .scroll-view .list-scroll-view .list .list_1 .title {
+  font-size: var(--txtSize);
+}
+.main .two .scroll-view .list-scroll-view .list .list_2 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  flex-wrap: wrap;
+}
+.main .two .scroll-view .list-scroll-view .list .list_2 .routeList {
+  width: 26vw;
+  padding: 2vw;
+}
+.main .two .scroll-view .list-scroll-view .list .list_2 .routeList .route_1 {
   display: flex;
   flex-direction: column;
+  justify-content: center;
+}
+.main .two .scroll-view .list-scroll-view .list .list_2 .routeList .route_1 .title {
+  font-size: var(--txtSize);
+  padding: 1vw 0 0 0;
+  text-align: center;
 }

+ 46 - 13
pages/topic/index.js

@@ -2,28 +2,51 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '话题', leftArrow: false, useBar: true },
+        searchInfo: {},
+        list: [{
+            title: '【单项】2022年运城市青少年羽毛球比赛', create_time: '2022-09-02', brief: '【单项】2022年运城市青少年羽毛球比赛就要开始了,在你心中的最强王者会是谁?'
+        },
+        {
+            title: '【单项】2022年运城市青少年羽毛球比赛', create_time: '2022-09-02', brief: '【单项】2022年运城市青少年羽毛球比赛就要开始了,在你心中的最强王者会是谁?'
+        }],
+        //分页
+        page: 1,
+        limit: 10,
     },
     // 跳转菜单
     tabPath(e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
+    // 查询
+    search: function (e) {
+        const that = this;
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) { },
     // 监听用户是否登录
     watchLogin: async function () {
-        // 监听用户是否登录,
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-                // if (res.data) wx.redirectTo({ url: '/pages/home/index' })
-            },
-            fail: async res => {
-                // wx.redirectTo({ url: '/pages/home/index' })
-            }
-        })
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        // wx.getStorage({
+        //     key: 'user',
+        //     success: async (res) => {
+        //         let info = { skip: 0, limit: 1000 };
+        //         if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+        //         const arr = await app.$get(`/newCourt/api/topic`, { ...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' });
+        //     },
+        // });
     },
     /**
      * 生命周期函数--监听页面初次渲染完成
@@ -31,7 +54,6 @@ Page({
     onReady: function () {
 
     },
-
     /**
      * 生命周期函数--监听页面显示
      */
@@ -58,8 +80,19 @@ Page({
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh: function () {
-
+    onPullDownRefresh: async function () {
+        const that = this;
+        let page = that.data.page;
+        let searchInfo = that.data.searchInfo;
+        let info = { skip: (page - 1) * that.data.limit, limit: that.data.limit };
+        if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+        const arr = await app.$get(`/newCourt/api/topic`, { ...info });
+        if (arr.errcode == '0') {
+            that.setData({ list: arr.data })
+            that.setData({ page: page + 1 })
+            wx.showToast({ title: '刷新成功', icon: 'success' })
+        }
+        else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
     },
 
     /**

+ 6 - 5
pages/topic/index.json

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

+ 80 - 13
pages/topic/index.less

@@ -1,17 +1,84 @@
 .main {
-    height: 83vh;
-    background-color: #ffffff;
-}
-
-.scroll-view {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-
-    .list-scroll-view {
+    height: var(--thrHeight);
+
+    .zero {
+        margin: 0 2vw 2vw 2vw;
+    }
+
+    .one {
         display: flex;
-        flex-direction: column;
+        flex-direction: row;
+        justify-content: space-between;
+        padding: 2vw;
+        background-color: var(--footColor);
+
+        input {
+            font-size: var(--txtSize);
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+
+        .scroll-view {
+            position: absolute;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+
+            .list-scroll-view {
+                display: flex;
+                flex-wrap: wrap;
+                align-content: flex-start;
+                justify-content: space-between;
+
+                .list {
+                    background-color: var(--bgColor);
+                    margin: 0 0 2vw 0;
+                    padding: 2vw;
+                    display: flex;
+                    flex-direction: column;
+
+                    .list_1 {
+                        display: flex;
+                        flex-direction: row;
+                        justify-content: space-between;
+                        font-size: 14px;
+                        margin: 0 0 1vw 0;
+                        color: var(--labelColor);
+
+                        .name {
+                            width: 65vw;
+                        }
+                    }
+
+                    .list_2 {
+                        margin: 0 0 3vw 0;
+                        font-size: var(--titleSize);
+                        font-weight: bold;
+                    }
+
+                    .list_3 {
+                        display: flex;
+                        flex-direction: row;
+                        justify-content: space-between;
+                        font-size: 14px;
+                        color: var(--labelColor);
+
+                        .btn {
+                            color: #334790;
+                            font-size: 14px;
+                            font-weight: 700;
+                        }
+                    }
+                }
+
+                .list:last-child {
+                    margin: 0;
+                }
+            }
+        }
     }
 }

+ 20 - 1
pages/topic/index.wxml

@@ -1,5 +1,24 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
     <view slot="info" class="container main">
-        话题
+        <view class="zero one">
+            <input type="text" value="{{searchInfo.title}}" 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" bindtap="toJoin" data-id="{{item._id}}">
+                        <view class="list_1">
+                            <view class="name textOver">{{item.title}}</view>
+                            <view>{{item.create_time}}</view>
+                        </view>
+                        <view class="list_2">{{item.brief}}</view>
+                        <view class="list_3">
+                            <view>已发布{{item.stick.length||0}}个帖子</view>
+                            <view class="btn">加入话题>>></view>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
     </view>
 </mobile-main>

+ 60 - 4
pages/topic/index.wxss

@@ -1,15 +1,71 @@
 .main {
-  height: 83vh;
-  background-color: #ffffff;
+  height: var(--thrHeight);
 }
-.scroll-view {
+.main .zero {
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding: 2vw;
+  background-color: var(--footColor);
+}
+.main .one input {
+  font-size: var(--txtSize);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+}
+.main .two .scroll-view {
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
 }
-.scroll-view .list-scroll-view {
+.main .two .scroll-view .list-scroll-view {
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  justify-content: space-between;
+}
+.main .two .scroll-view .list-scroll-view .list {
+  background-color: var(--bgColor);
+  margin: 0 0 2vw 0;
+  padding: 2vw;
   display: flex;
   flex-direction: column;
 }
+.main .two .scroll-view .list-scroll-view .list .list_1 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  font-size: 14px;
+  margin: 0 0 1vw 0;
+  color: var(--labelColor);
+}
+.main .two .scroll-view .list-scroll-view .list .list_1 .name {
+  width: 65vw;
+}
+.main .two .scroll-view .list-scroll-view .list .list_2 {
+  margin: 0 0 3vw 0;
+  font-size: var(--titleSize);
+  font-weight: bold;
+}
+.main .two .scroll-view .list-scroll-view .list .list_3 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  font-size: 14px;
+  color: var(--labelColor);
+}
+.main .two .scroll-view .list-scroll-view .list .list_3 .btn {
+  color: #334790;
+  font-size: 14px;
+  font-weight: 700;
+}
+.main .two .scroll-view .list-scroll-view .list:last-child {
+  margin: 0;
+}

+ 2 - 2
project.config.json

@@ -52,9 +52,9 @@
     "libVersion": "2.19.4",
     "appid": "wx34436977cd1e02e4",
     "projectname": "mobile-template",
-    "condition": {},
     "editorSetting": {
         "tabIndent": "insertSpaces",
         "tabSize": 4
-    }
+    },
+    "condition": {}
 }

+ 102 - 0
utils/dict.js

@@ -5,6 +5,108 @@ export const system = [
     { title: '话题', normal: '/image/tabs/topic.png', active: '/image/tabs/topic_1.png', route: 'pages/topic/index', type: '0' },
     { title: '我的', normal: '/image/tabs/my.png', active: '/image/tabs/my_1.png', route: 'pages/my/index', type: '0' },
 ]
+// 我的页面,功能按钮
+// -1:管理员,0:普通用户,1:裁判用户
+export const myBtn = [
+    {
+        type: '-1',
+        btn: [
+            {
+                title: '用户管理',
+                route: 'user/index',
+                routeList: []
+            },
+            {
+                title: '赛事管理',
+                routeList: [
+                    { title: '信息管理', route: 'match/mess' },
+                    { title: '报名管理', route: 'match/sign' },
+                    { title: '组队信息管理', route: 'match/shteam' },
+                    { title: '赛事组管理', route: 'raceteam/index' },
+                    { title: '小组赛管理', route: 'race/index' },
+                    { title: '淘汰赛管理', route: 'eliminate/index' },
+                ]
+            },
+            {
+                title: '新闻管理',
+                routeList: [
+                    { title: '资讯信息管理', route: 'news/mess' },
+                    { title: '话题信息管理', route: 'topic/mess' },
+                ]
+            },
+            {
+                title: '订单管理',
+                route: 'order/index',
+                routeList: []
+            },
+            {
+                title: '字典管理',
+                routeList: [
+                    { title: '比赛项目管理', route: 'dictionary/project' },
+                    { title: '比赛场地管理', route: 'dictionary/address' },
+                ]
+            },
+            {
+                title: '账号管理',
+                routeList: [
+                    { title: '资料修改', route: 'setting/basic' },
+                    { title: '联系我们', route: 'setting/contact' },
+                ]
+            },
+        ]
+    },
+    {
+        type: '0',
+        btn: [
+            {
+                title: '我的赛事',
+                route: 'usermymatch/index',
+                routeList: []
+            },
+            {
+                title: '我的报名',
+                route: 'usermysign/index',
+                routeList: []
+            },
+            {
+                title: '组队信息',
+                route: 'usermyteam/index',
+                routeList: []
+            },
+            {
+                title: '我的订单',
+                route: 'usermyorder/index',
+                routeList: []
+            },
+            {
+                title: '账号管理',
+                routeList: [
+                    { title: '资料修改', route: 'setting/basic' },
+                    { title: '联系我们', route: 'setting/contact' },
+                ]
+            },
+        ]
+    },
+    {
+        type: '1',
+        btn: [
+            {
+                title: '我的赛事',
+                routeList: [
+                    { title: '小组赛管理', route: 'referee/group' },
+                    { title: '淘汰赛管理', route: 'referee/eliminate' },
+                ]
+            },
+            {
+                title: '账号管理',
+                routeList: [
+                    { title: '资料修改', route: 'setting/basic' },
+                    { title: '联系我们', route: 'setting/contact' },
+                ]
+            },
+        ]
+    }
+]
 // 性别
 export const gender = [
     { label: '男', value: '0' },