guhongwei 2 years ago
parent
commit
be2276f93e

+ 25 - 53
pages/home/index.js

@@ -2,54 +2,37 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '首页', leftArrow: false, useBar: true },
+        lingdang: '/image/lingdang.png',
         user: {},
-        //查询条件
-        searchInfo: {},
         list: [
-            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼' },
-            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼' },
-            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼' },
-            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼' },
+            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
+            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
+            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
+            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
+            { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼', logo: [{ url: '/image/lingdang.png' }] },
+
         ],
-        page: 1,
+        page: 0,
         skip: 0,
-        limit: 4,
-        total: 0,
+        limit: 5,
     },
     // 跳转菜单
     tabPath(e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
-    // 查询
-    search: function (e) {
-        const that = this;
-        that.setData({ 'searchInfo.name': e.detail.value });
-        that.watchLogin()
-    },
     toView: function (e) {
         const { item } = e.currentTarget.dataset;
-        // wx.navigateTo({ url: `/pages/matchInfo/index?id=${item._id}` })
-    },
-    // 公共方法
-    toCommon: function (e) {
-        const { route } = e.currentTarget.dataset;
-        // wx.navigateTo({ url: route })
+        wx.navigateTo({ url: `/pages/match/info?id=${item._id}` })
     },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-        const that = this;
-
-    },
-
+    onLoad: function (options) { },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady: function () {
-
-    },
+    onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
      */
@@ -61,23 +44,18 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
-        // let searchInfo = that.data.searchInfo;
-        // wx.getStorage({
-        //     key: 'user',
-        //     success: async (res) => {
-        //         that.setData({ user: res.data })
-        let info = { skip: that.data.skip, limit: that.data.limit };
-        // 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 })
-            // that.setData({total:res.data.length})
-        } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
-        //     },
-        //     fail: async (res) => {
-        //         wx.redirectTo({ url: '/pages/index/index' });
-        //     },
-        // });
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                // let info = { skip: that.data.skip, limit: that.data.limit };
+                // const arr = await app.$get(`/newCourt/api/match`, { ...info });
+                // if (arr.errcode == '0') { that.setData({ list: arr.data }) }
+                // else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
     /**
      * 页面上拉触底事件的处理函数
@@ -92,13 +70,7 @@ Page({
             let skip = (page - 1) * limit;
             that.setData({ skip: skip })
             wx.hideLoading();
-        } else {
-            wx.showToast({
-                title: '没有更多数据了',
-                icon: 'none',
-                duration: 2000,
-            })
-        }
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
         that.watchLogin();
     },
     /**

+ 33 - 51
pages/home/index.less

@@ -1,73 +1,65 @@
 .main {
-    height: 83vh;
+    height: var(--thrHeight);
     background-color: var(--bgColor);
-    padding: 0 2vw;
-
 
     .one {
         display: flex;
         flex-direction: row;
-        width: 92vw;
+        width: 96vw;
         padding: 2vw;
+        margin: 0 0 2vw 0;
+        background-color: var(--f1Color);
 
         .one_1 {
-            flex-grow: 1;
+            width: 10vw;
+            text-align: center;
 
-            input {
-                padding: 1vw 2vw 1.6vw 2vw;
-                border-radius: 2px;
-                font-size: var(--txtSize);
-                background-color: var(--f1Color);
+            image {
+                width: 7vw;
+                height: 7vw;
+                position: relative;
+                top: 1vw;
             }
         }
 
         .one_2 {
-            width: 13vw;
-
-            button {
-                width: 100%;
-                font-size: var(--btnSize);
-                padding: 2vw;
-            }
+            flex-grow: 1;
 
-            image {
-                width: 30px;
+            input {
+                padding: 1vw 2vw 1.6vw 2vw;
+                border-radius: 2px;
+                font-size: var(--txtSize);
+                background-color: var(--bgColor);
             }
         }
     }
 
     .two {
         flex-grow: 1;
-        width: 100%;
         position: relative;
 
         .list {
-            border: 1px solid #cccccc;
+            background-color: var(--f9Color);
+            margin: 0 2vw 2vw 2vw;
             padding: 2vw;
             display: flex;
             flex-direction: row;
-            justify-content: space-between;
-            background-color: var(--bgColor);
-            margin: 0 0 1vh 0;
-            border-radius: 10px;
-
 
             .list_1 {
-                padding: 7vw 0 0 0;
+                width: 30vw;
+                padding: 8vw 0 0 0;
                 text-align: center;
 
                 .image {
-                    width: 70px;
-                    height: 70px;
+                    width: 100%;
+                    height: 14vw;
                     border-radius: 10px;
                     border: 1px solid #cccccc;
                 }
             }
 
             .list_2 {
-                display: flex;
-                flex-direction: column;
-                width: 75vw;
+                flex-grow: 1;
                 padding: 0 0 0 2vw;
 
                 .name {
@@ -81,30 +73,20 @@
                     word-break: break-all;
                     display: -webkit-box;
                     -webkit-box-orient: vertical;
-
-                    .status {
-                        background-color: #ff0000;
-                        color: #fff;
-                        padding: 0 2vw;
-                        font-size: var(--txtSize);
-                        margin: 0 2vw 0 0;
-                        border-radius: 5px;
-                    }
                 }
 
                 .other {
+                    margin: 0 0 1vw 0;
+
                     .other_1 {
+                        font-size: var(--txtSize);
                         margin: 0 0 1vw 0;
-                        color: var(--labelColor);
-                        font-size: var(--btnSize);
-                        overflow: hidden;
-                        text-overflow: ellipsis;
-                        -webkit-line-clamp: 2;
-                        word-break: break-all;
-                        display: -webkit-box;
-                        -webkit-box-orient: vertical;
-
-                        text:nth-child(2) {
+
+                        text {
+                            color: var(--labelColor);
+                        }
+
+                        text:last-child {
                             color: var(--txtColor);
                         }
                     }

+ 5 - 6
pages/home/index.wxml

@@ -1,20 +1,19 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
     <view slot="info" class="container main">
         <view class="one">
-            <view class="one_2">
-                <image src="/image/lingdang.png" mode="widthFix"></image>
-            </view>
             <view class="one_1">
+                <image src="{{lingdang}}"></image>
+            </view>
+            <view class="one_2">
                 <input type="text" placeholder="请输入关键词" />
             </view>
         </view>
         <view class="two">
             <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="onReachBottom">
-                <view class="list-scroll-view" >
+                <view class="list-scroll-view">
                     <view class="list" wx:for="{{list}}" wx:key="item" bindtap="toView" data-item="{{item}}">
                         <view class="list_1">
-                            <!-- <image class="image" src="{{item.logo&&item.logo.length>0?item.logo[0].url:''}}"></image> -->
-                            <image class="image" src="/image/lingdang.png"></image>
+                            <image class="image" src="{{item.logo&&item.logo.length>0?item.logo[0].url:''}}"></image>
                         </view>
                         <view class="list_2">
                             <view class="name">

+ 29 - 43
pages/home/index.wxss

@@ -1,63 +1,58 @@
 .main {
-  height: 83vh;
+  height: var(--thrHeight);
   background-color: var(--bgColor);
-  padding: 0 2vw;
 }
 .main .one {
   display: flex;
   flex-direction: row;
-  width: 92vw;
+  width: 96vw;
   padding: 2vw;
+  margin: 0 0 2vw 0;
+  background-color: var(--f1Color);
 }
 .main .one .one_1 {
+  width: 10vw;
+  text-align: center;
+}
+.main .one .one_1 image {
+  width: 7vw;
+  height: 7vw;
+  position: relative;
+  top: 1vw;
+}
+.main .one .one_2 {
   flex-grow: 1;
 }
-.main .one .one_1 input {
+.main .one .one_2 input {
   padding: 1vw 2vw 1.6vw 2vw;
   border-radius: 2px;
   font-size: var(--txtSize);
-  background-color: var(--f1Color);
-}
-.main .one .one_2 {
-  width: 13vw;
-}
-.main .one .one_2 button {
-  width: 100%;
-  font-size: var(--btnSize);
-  padding: 2vw;
-}
-.main .one .one_2 image {
-  width: 30px;
+  background-color: var(--bgColor);
 }
 .main .two {
   flex-grow: 1;
-  width: 100%;
   position: relative;
 }
 .main .two .list {
-  border: 1px solid #cccccc;
+  background-color: var(--f9Color);
+  margin: 0 2vw 2vw 2vw;
   padding: 2vw;
   display: flex;
   flex-direction: row;
-  justify-content: space-between;
-  background-color: var(--bgColor);
-  margin: 0 0 1vh 0;
-  border-radius: 10px;
 }
 .main .two .list .list_1 {
-  padding: 7vw 0 0 0;
+  width: 30vw;
+  padding: 8vw 0 0 0;
   text-align: center;
 }
 .main .two .list .list_1 .image {
-  width: 70px;
-  height: 70px;
+  width: 100%;
+  height: 14vw;
   border-radius: 10px;
   border: 1px solid #cccccc;
 }
 .main .two .list .list_2 {
-  display: flex;
-  flex-direction: column;
-  width: 75vw;
+  flex-grow: 1;
   padding: 0 0 0 2vw;
 }
 .main .two .list .list_2 .name {
@@ -72,26 +67,17 @@
   display: -webkit-box;
   -webkit-box-orient: vertical;
 }
-.main .two .list .list_2 .name .status {
-  background-color: #ff0000;
-  color: #fff;
-  padding: 0 2vw;
-  font-size: var(--txtSize);
-  margin: 0 2vw 0 0;
-  border-radius: 5px;
+.main .two .list .list_2 .other {
+  margin: 0 0 1vw 0;
 }
 .main .two .list .list_2 .other .other_1 {
+  font-size: var(--txtSize);
   margin: 0 0 1vw 0;
+}
+.main .two .list .list_2 .other .other_1 text {
   color: var(--labelColor);
-  font-size: var(--btnSize);
-  overflow: hidden;
-  text-overflow: ellipsis;
-  -webkit-line-clamp: 2;
-  word-break: break-all;
-  display: -webkit-box;
-  -webkit-box-orient: vertical;
 }
-.main .two .list .list_2 .other .other_1 text:nth-child(2) {
+.main .two .list .list_2 .other .other_1 text:last-child {
   color: var(--txtColor);
 }
 .scroll-view {

+ 40 - 19
pages/user/info.js

@@ -1,66 +1,87 @@
-// pages/user/info.js
+const app = getApp()
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-
+        frameStyle: { useTop: true, name: '用户管理', leftArrow: true, useBar: false },
+        openid: '',
+        form: {}
+    },
+    back: function () {
+        wx.navigateBack({
+            delta: 1,
+        })
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ openid: options.openid || '' });
+        that.watchLogin()
     },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        // 监听用户是否登录,
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                const arr = await app.$get(`/newCourt/api/user/${that.data.openid}`);
+                if (arr.errcode == '0') {
+                    that.setData({ form: arr.data })
+                }
+                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 () { },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
-
+    onPullDownRefresh: function () {
+        console.log('1');
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
-
+    onReachBottom: function () {
+        console.log('2');
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 2
pages/user/info.json

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

+ 20 - 0
pages/user/info.less

@@ -0,0 +1,20 @@
+.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;
+
+            .value {
+                flex-grow: 1;
+                color: var(--labelColor);
+
+            }
+        }
+    }
+}

+ 44 - 2
pages/user/info.wxml

@@ -1,2 +1,44 @@
-<!--pages/user/info.wxml-->
-<text>pages/user/info.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form>
+                <view class="content">
+                    <view class="label">头像:</view>
+                    <view class="value">
+                        <image src="{{form.icon&&form.icon.length>0?form.icon[0].url:''}}" style="width:66px;height: 66px;"></image>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">姓名:</view>
+                    <view class="value">
+                        <input type="text" name="name" value="{{form.name}}" placeholder="请输入姓名" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">身份证号:</view>
+                    <view class="value">
+                        <input type="text" name="card" value="{{form.card}}" placeholder="请输入身份证号" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">性别:</view>
+                    <view class="value">
+                        {{form.gender=='0'?'男':form.gender=='1'?'女':form.gender=='2'?'未知':'暂无'}}
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">手机号:</view>
+                    <view class="value">
+                        <input type="text" name="phone" value="{{form.phone}}" placeholder="请输入手机号" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">用户类型:</view>
+                    <view class="value">
+                        {{form.type=='-1'?'管理员':form.type=='0'?'普通用户':form.type=='1'?'裁判用户':'暂无'}}
+                    </view>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 15 - 1
pages/user/info.wxss

@@ -1 +1,15 @@
-/* pages/user/info.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 .value {
+  flex-grow: 1;
+  color: var(--labelColor);
+}

+ 3 - 1
pages/user/list.js

@@ -15,8 +15,10 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        const that = this;
+        that.setData({ list: [] })
         let { item } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pages/user/info?id=${item._id}` })
+        wx.navigateTo({ url: `/pages/user/info?openid=${item.openid}` })
     },
     // 分页
     upcroll: function () {