Explorar el Código

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

guhongwei hace 2 años
padre
commit
7a0890bd61
Se han modificado 5 ficheros con 222 adiciones y 7 borrados
  1. 45 1
      pages/user/index.js
  2. 2 1
      pages/user/index.json
  3. 73 1
      pages/user/index.less
  4. 43 3
      pages/user/index.wxml
  5. 59 1
      pages/user/index.wxss

+ 45 - 1
pages/user/index.js

@@ -6,17 +6,61 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '用户管理', leftArrow: true, useBar: false },
+        //查询条件
+        searchName: '',
+        list: [],
+        dialog: { title: '详细信息', show: false, type: '1' },
+        info: {},
     },
     // 跳转菜单
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 查询信息
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ searchName: e.detail });
+        that.watchLogin();
+    },
+    // 查看
+    toView: async function (e) {
+        const that = this;
+        const { openid } = e.currentTarget.dataset;
+        const arr = await app.$get(`/newCourt/api/user/${openid}`);
+        if (arr.errcode == '0') {
+            that.setData({ info: arr.data })
+            that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
+        }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
         const that = this;
-
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = {};
+                if (that.data.searchName) info.name = that.data.searchName;
+                const arr = await app.$get(`/newCourt/api/user/`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: arr.data })
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 2 - 1
pages/user/index.json

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

+ 73 - 1
pages/user/index.less

@@ -1,4 +1,76 @@
 .main {
     height: 88vh;
-    background-color: #ff0000;
+
+    .one {
+        width: 100%;
+    }
+
+    .two {
+        width: 96vw;
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            padding: 10px;
+            background-color: #ffffff;
+            margin: 2px 0 0 0;
+
+            .name {
+                font-size: 14px;
+                font-weight: bold;
+                margin: 0 0 5px 0;
+            }
+
+            .other {
+                font-size: 12px;
+                margin: 0 0 5px 0;
+
+                .other_1 {
+                    padding: 2px 0;
+                }
+
+                .other_1 text:nth-child(1) {
+                    color: #666;
+                }
+            }
+
+            .btn {
+                text-align: center;
+
+                button {
+                    color: #216EC7;
+                }
+            }
+        }
+    }
+}
+
+.dialog_one {
+    margin: 10px 0 0 0;
+
+    .one_1 {
+        display: flex;
+        flex-direction: row;
+        justify-content: space-between;
+        border: 1px solid #ccc;
+        border-radius: 5px;
+        margin: 0 0 10px 0;
+        padding: 10px;
+
+        .text {
+            width: 20vw;
+            color: #666;
+            font-size: 14px;
+        }
+
+        .text1 {
+            font-size: 14px;
+            color: #000;
+        }
+
+        .image {
+            width: 15vw;
+            height: 15vw;
+        }
+    }
 }

+ 43 - 3
pages/user/index.wxml

@@ -1,10 +1,50 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            查询
+            <van-search value="{{ searchName }}" input-align="center" bind:search="onSearch" placeholder="请输入用户名称" />
         </view>
         <view class="two">
-            列表
+            <view class="list" wx:for="{{list}}" wx:key="item">
+                <view class="name textOver">{{item.name||'暂无昵称'}}</view>
+                <view class="other">
+                    <view class="other_1"><text>用户类型:</text><text>{{item.type=='-1'?'管理员':item.type=='0'?'个人用户':item.type=='1'?'团队创建人':'暂无'}}</text></view>
+                    <view class="other_1"><text>手机:</text><text>{{item.phone||'暂无'}}</text></view>
+                    <view class="other_1"><text>邮箱:</text><text>{{item.email||'暂无'}}</text></view>
+                </view>
+                <view class="btn">
+                    <button size="mini" type="default" bindtap="toView" data-openid="{{item.openid}}">详情</button>
+                </view>
+            </view>
         </view>
     </view>
-</mobile-main>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
+            <view class="one_1">
+                <text class="text">头像:</text>
+                <image class="image" src="{{info.icon[0].url}}"></image>
+            </view>
+            <view class="one_1">
+                <text class="text">用户名:</text>
+                <text class="text1">{{info.name||'暂无昵称'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">电话:</text>
+                <text class="text1">{{info.phone||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">性别:</text>
+                <text class="text1">{{info.gender||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">身份证号:</text>
+                <text class="text1">{{info.card||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">邮箱:</text>
+                <text class="text1">{{info.email||'暂无'}}</text>
+            </view>
+        </view>
+    </view>
+</e-dialog>

+ 59 - 1
pages/user/index.wxss

@@ -1,4 +1,62 @@
 .main {
   height: 88vh;
-  background-color: #ff0000;
+}
+.main .one {
+  width: 100%;
+}
+.main .two {
+  width: 96vw;
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  padding: 10px;
+  background-color: #ffffff;
+  margin: 2px 0 0 0;
+}
+.main .two .list .name {
+  font-size: 14px;
+  font-weight: bold;
+  margin: 0 0 5px 0;
+}
+.main .two .list .other {
+  font-size: 12px;
+  margin: 0 0 5px 0;
+}
+.main .two .list .other .other_1 {
+  padding: 2px 0;
+}
+.main .two .list .other .other_1 text:nth-child(1) {
+  color: #666;
+}
+.main .two .list .btn {
+  text-align: center;
+}
+.main .two .list .btn button {
+  color: #216EC7;
+}
+.dialog_one {
+  margin: 10px 0 0 0;
+}
+.dialog_one .one_1 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  border: 1px solid #ccc;
+  border-radius: 5px;
+  margin: 0 0 10px 0;
+  padding: 10px;
+}
+.dialog_one .one_1 .text {
+  width: 20vw;
+  color: #666;
+  font-size: 14px;
+}
+.dialog_one .one_1 .text1 {
+  font-size: 14px;
+  color: #000;
+}
+.dialog_one .one_1 .image {
+  width: 15vw;
+  height: 15vw;
 }