guhongwei 2 jaren geleden
bovenliggende
commit
4f62913313
14 gewijzigde bestanden met toevoegingen van 481 en 24 verwijderingen
  1. 1 0
      app.json
  2. 2 0
      app.wxss
  3. 49 0
      icon/icon.wxss
  4. 7 11
      pages/school/index.js
  5. 1 2
      pages/school/index.json
  6. 1 1
      pages/school/index.less
  7. 2 9
      pages/school/index.wxml
  8. 1 1
      pages/school/index.wxss
  9. 88 0
      pages/smy/index.js
  10. 6 0
      pages/smy/index.json
  11. 138 0
      pages/smy/index.less
  12. 39 0
      pages/smy/index.wxml
  13. 116 0
      pages/smy/index.wxss
  14. 30 0
      utils/dict.js

+ 1 - 0
app.json

@@ -3,6 +3,7 @@
         "pages/index/index",
         "pages/register/index",
         "pages/school/index",
+        "pages/smy/index",
         "pages/club/index",
         "pages/match/index",
         "pages/other/agree",

+ 2 - 0
app.wxss

@@ -13,6 +13,8 @@
     white-space: nowrap;
 }
 
+@import "/icon/icon.wxss";
+
 /* 系统颜色字体配置 */
 page {
     /* 窗口可用高度 */

File diff suppressed because it is too large
+ 49 - 0
icon/icon.wxss


+ 7 - 11
pages/school/index.js

@@ -2,22 +2,16 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '羽校', leftArrow: false, useBar: true },
-        dialog: { title: '弹框标题', show: false, type: '1' }
+        user: {}
     },
     // 跳转菜单
     tabPath(e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
-    // 打开弹框
+    // 进入系统
     toJoin: function () {
-        const that = this;
-        that.setData({ dialog: { title: '弹框标题', show: true, type: '1' } });
-    },
-    // 关闭弹框
-    toClose: function () {
-        const that = this;
-        that.setData({ dialog: { title: '弹框标题', show: false, type: '1' } });
+        wx.navigateTo({ url: `/pages/smy/index` })
     },
     /**
      * 生命周期函数--监听页面加载
@@ -40,9 +34,11 @@ Page({
         const that = this;
         wx.getStorage({
             key: 'user',
-            success: async res => { },
+            success: async res => {
+                that.setData({ user: res.data })
+            },
             fail: async res => {
-                // wx.redirectTo({ url: '/pages/index/index' })
+                wx.redirectTo({ url: '/pages/index/index' })
             }
         })
     },

+ 1 - 2
pages/school/index.json

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

+ 1 - 1
pages/school/index.less

@@ -30,6 +30,6 @@
     }
 
     .two {
-        background-color: #0000ff;
+        background-color: #ffffff;
     }
 }

+ 2 - 9
pages/school/index.wxml

@@ -4,7 +4,7 @@
             <view class="one_1">
                 <input type="text" placeholder="请输入关键词" />
             </view>
-            <view class="one_2">
+            <view class="one_2" wx:if="{{user&&user._id}}">
                 <button type="primary" bindtap="toJoin">进入系统</button>
             </view>
         </view>
@@ -12,11 +12,4 @@
             学校
         </view>
     </view>
-</mobile-main>
-<dialog dialog="{{dialog}}" bind:toClose="toClose">
-    <view slot="info" class="dialog">
-        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
-            类型一
-        </view>
-    </view>
-</dialog>
+</mobile-main>

+ 1 - 1
pages/school/index.wxss

@@ -25,5 +25,5 @@
   font-size: var(--font14Size);
 }
 .main .two {
-  background-color: #0000ff;
+  background-color: #ffffff;
 }

+ 88 - 0
pages/smy/index.js

@@ -0,0 +1,88 @@
+const app = getApp();
+import { school_menu, school_sysmenu } from "../../utils/dict";
+
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '系统首页', leftArrow: true, useBar: false },
+        user: {},
+        list: []
+    },
+    // 返回
+    back: function () { wx.navigateBack({ delta: 1 }) },
+    // 功能跳转
+    toCommon: function (e) {
+        const { route, type } = e.currentTarget.dataset;
+        if (type && type == 'logout') {
+            // 退出登录
+            try { wx.clearStorage(); wx.redirectTo({ url: '/pages/index/index' }) }
+            catch (e) { console.log(e); }
+        } else {
+            wx.navigateTo({ url: `/pages/${route}` });
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) { },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data })
+                let btnData = school_menu.find((i) => i.type == res.data.type);
+                that.setData({ list: [...btnData.menu, ...school_sysmenu] })
+                // const arr = await app.$get(`/newCourt/api/user/${res.data._id}`);
+                // if (arr.errcode == '0') { that.setData({ user: arr.data }) }
+                // else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
+
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/smy/index.json

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

+ 138 - 0
pages/smy/index.less

@@ -0,0 +1,138 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        position: relative;
+        width: 100vw;
+        height: 120px;
+        border-bottom: 1px solid var(--fcColor);
+        margin: 0 0 2vw 0;
+
+        .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: 92vw;
+            height: 86px;
+            margin: 0 2vw;
+            padding: 2vw;
+            background-color: var(--whiteColor);
+            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(--font16Size);
+                    }
+
+                    .info:nth-child(1) {
+                        font-weight: bold;
+                        font-size: var(--font18Size);
+                    }
+
+                    .info:nth-child(2) {
+                        color: var(--f85Color);
+                        font-size: var(--font15Size);
+                    }
+                }
+            }
+
+            .r {
+                padding: 8vw 0;
+                font-size: var(--font16Size);
+                color: var(--f85Color);
+            }
+        }
+    }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+
+        .list {
+            margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            background-color: var(--f9Color);
+
+            .list_1 {
+                font-size: var(--font16Size);
+                margin: 0 0 2vw 0;
+
+                text {
+                    padding: 0 2vw 0 0;
+                }
+            }
+
+            .list_2 {
+                display: flex;
+                flex-direction: row;
+                justify-content: flex-start;
+                flex-wrap: wrap;
+
+                .btn {
+                    width: 28vw;
+                    margin: 0 4vw 2vw 0;
+                    padding: 2vw 0;
+                    background-color: var(--whiteColor);
+                    text-align: center;
+                    border-radius: 5px;
+
+                    .iconfont {
+                        display: inline-block;
+                        font-size: 25px;
+                        margin: 0 0 2vw 0;
+                    }
+
+                    .btn_1 {
+                        font-size: var(--font14Size);
+                    }
+                }
+
+                .btn:nth-child(3n) {
+                    margin: 0 0 2vw 0;
+                }
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 39 - 0
pages/smy/index.wxml

@@ -0,0 +1,39 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">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>
+                </view>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="list_1">
+                            <text class="iconfont {{item.icon}}"></text>
+                            <text class="title">{{item.title}}</text>
+                        </view>
+                        <view class="list_2">
+                            <view class="btn" wx:for="{{item.btn}}" wx:for-item="tag" wx:key="tagIndex" bindtap="toCommon" data-route="{{tag.route}}" data-type="{{tag.type}}">
+                                <text class="iconfont {{tag.icon}}"></text>
+                                <view class="btn_1 textOver">{{tag.title}}</view>
+                            </view>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 116 - 0
pages/smy/index.wxss

@@ -0,0 +1,116 @@
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  position: relative;
+  width: 100vw;
+  height: 120px;
+  border-bottom: 1px solid var(--fcColor);
+  margin: 0 0 2vw 0;
+}
+.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: 92vw;
+  height: 86px;
+  margin: 0 2vw;
+  padding: 2vw;
+  background-color: var(--whiteColor);
+  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(--font16Size);
+}
+.main .one .one_2 .l .l_2 .info:nth-child(1) {
+  font-weight: bold;
+  font-size: var(--font18Size);
+}
+.main .one .one_2 .l .l_2 .info:nth-child(2) {
+  color: var(--f85Color);
+  font-size: var(--font15Size);
+}
+.main .one .one_2 .r {
+  padding: 8vw 0;
+  font-size: var(--font16Size);
+  color: var(--f85Color);
+}
+.main .two {
+  position: relative;
+  flex-grow: 1;
+}
+.main .two .list {
+  margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  background-color: var(--f9Color);
+}
+.main .two .list .list_1 {
+  font-size: var(--font16Size);
+  margin: 0 0 2vw 0;
+}
+.main .two .list .list_1 text {
+  padding: 0 2vw 0 0;
+}
+.main .two .list .list_2 {
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-start;
+  flex-wrap: wrap;
+}
+.main .two .list .list_2 .btn {
+  width: 28vw;
+  margin: 0 4vw 2vw 0;
+  padding: 2vw 0;
+  background-color: var(--whiteColor);
+  text-align: center;
+  border-radius: 5px;
+}
+.main .two .list .list_2 .btn .iconfont {
+  display: inline-block;
+  font-size: 25px;
+  margin: 0 0 2vw 0;
+}
+.main .two .list .list_2 .btn .btn_1 {
+  font-size: var(--font14Size);
+}
+.main .two .list .list_2 .btn:nth-child(3n) {
+  margin: 0 0 2vw 0;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 30 - 0
utils/dict.js

@@ -9,4 +9,34 @@ export const gender = [
     { label: '男', value: '0' },
     { label: '女', value: '1' },
     { label: '未知', value: '2' },
+];
+// 羽校系统菜单
+// -1: 管理员,0:普通用户,1:管理员,2:教练
+// 系统默认菜单
+export const school_sysmenu = [
+    {
+        title: '账号管理',
+        icon: 'icon-zhanghaoguanli',
+        btn: [
+            { title: '资料修改', route: 'setting/basic', icon: 'icon-weibiaoti1' },
+            { title: '联系我们', route: 'setting/contact', icon: 'icon-lianxiwomen' },
+            { title: '退出登录', route: '', type: 'logout', icon: 'icon-tuichudenglu' },
+        ]
+    },
+];
+export const school_menu = [
+    {
+        type: '-1',
+        menu: [
+            {
+                title: '用户管理',
+                icon: 'icon-yonghu',
+                btn: [
+                    { title: '管理用户', route: 'sadmin/list', icon: 'icon-xitongguanli-yonghuchaxun' },
+                    { title: '教练用户', route: 'scoach/list', icon: 'icon-jiaolian1' },
+                    { title: '普通用户', route: 'suser/list', icon: 'icon-putongyonghu' },
+                ]
+            },
+        ]
+    }
 ]