guhongwei 2 tahun lalu
induk
melakukan
ba6c996cf9

+ 2 - 1
app.json

@@ -83,7 +83,8 @@
                 "superAdmin/coach/list",
                 "superAdmin/coach/add",
                 "superAdmin/student/list",
-                "superAdmin/student/add"
+                "superAdmin/student/add",
+                "user/basic"
             ]
         },
         {

+ 88 - 0
pagesSchool/user/basic.js

@@ -0,0 +1,88 @@
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
+        icon: '/image/icon.jpg',
+        form: {},
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                const arr = await app.$get(`/user/${res.data._id}`);
+                if (arr.errcode == '0') {
+                    that.setData({ form: arr.data });
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pagesSchool/user/basic.json

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

+ 33 - 0
pagesSchool/user/basic.less

@@ -0,0 +1,33 @@
+@import (css) "/app.wxss";
+
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        width: 96vw;
+
+        .content {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            align-items: center;
+            margin: 0 10px;
+            padding: 10px 5px;
+            border-bottom: 1px solid var(--fcColor);
+
+            .label {
+                font-size: var(--font16Size);
+            }
+
+            .value {
+                color: var(--f85Color);
+                font-size: var(--font18Szie);
+
+                .img {
+                    height: 15vw;
+                    width: 15vw;
+                }
+            }
+        }
+    }
+}

+ 30 - 0
pagesSchool/user/basic.wxml

@@ -0,0 +1,30 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">用户名</view>
+                    <view class="value">{{form.name||'未知'}}</view>
+                </view>
+                <view class="content">
+                    <view class="label">用户头像</view>
+                    <view class="value">
+                        <image class="img" src="{{form.icon&&form.icon.length>0?form.icon[0].url:''}}"></image>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">性别</view>
+                    <view class="value">{{form.gender||'未知'}}</view>
+                </view>
+                <view class="content">
+                    <view class="label">身份证</view>
+                    <view class="value">{{form.card||'未知'}}</view>
+                </view>
+                <view class="content">
+                    <view class="label">手机号</view>
+                    <view class="value">{{form.phone||'未知'}}</view>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 27 - 0
pagesSchool/user/basic.wxss

@@ -0,0 +1,27 @@
+@import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 96vw;
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin: 0 10px;
+  padding: 10px 5px;
+  border-bottom: 1px solid var(--fcColor);
+}
+.main .one .content .label {
+  font-size: var(--font16Size);
+}
+.main .one .content .value {
+  color: var(--f85Color);
+  font-size: var(--font18Szie);
+}
+.main .one .content .value .img {
+  height: 15vw;
+  width: 15vw;
+}