zhaoxiaohai 3 yıl önce
ebeveyn
işleme
71c7749ce4

+ 4 - 0
README.md

@@ -2,6 +2,8 @@
 
 ​	login -- 进入系统
 
+​	userCenter -- 用户中心
+
 # 自定义组件:
 
 ​	My_Background -- 背景图片 //登录页面背景
@@ -14,6 +16,8 @@
 
 ​	My_inputPromptd -- input输入框提示
 
+​	My_GeneralTemplate -- 通用模板 个人主页 个人信息 团队管理 产品管理
+
 # 缓存
 
 userData -- 用户基本数据 -- 保存数据:index-用户列表下标,token,fisadministrator--是否主账号,tagentsid,tenterpriseid,userid

+ 3 - 1
app.json

@@ -1,6 +1,8 @@
 {
     "pages": [
-        "pages/login/index"
+        "pages/login/index",
+        "pages/userCenter/index",
+        "pages/tabbar-pages/user/index"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",

+ 1 - 0
app.wxss

@@ -1,3 +1,4 @@
 page {
     font-family: PingFangSC-Medium, PingFang SC;
+    background-color: #F6F7F8;
 }

+ 26 - 0
components/My_GeneralTemplate/index.js

@@ -0,0 +1,26 @@
+// components/My_GeneralTemplate/index.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        /* 盒子下内边距 */
+        padBot:{
+            type:String
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+
+    }
+})

+ 4 - 0
components/My_GeneralTemplate/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 5 - 0
components/My_GeneralTemplate/index.wxml


+ 23 - 0
components/My_GeneralTemplate/index.wxss

@@ -0,0 +1,23 @@
+
+/* 容器 */
+.container {
+    width: 702rpx;
+    background: #FFFFFF;
+    border-radius: 40px;
+    padding-top: 40rpx;
+    box-sizing: border-box;
+    margin: 252rpx auto 0;
+}
+
+/* 顶部背景图片 */
+.backImg {
+    position: fixed;
+    width: 100vw;
+    top: 0;
+    left: 0;
+    z-index: -999;
+}
+
+.backImg>image {
+    width: 100%;
+}

+ 128 - 0
pages/tabbar-pages/user/index.js

@@ -0,0 +1,128 @@
+import {
+    ApiModel
+} from "../../../utils/api";
+const _Http = new ApiModel();
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        /* 宫格列表 */
+        gridList: [{
+            id: '001',
+            text: '商户管理',
+            icon: '/static/login/Phone.png'
+        }, {
+            id: '002',
+            text: '产品管理',
+            icon: '/static/login/identity.png'
+        }, {
+            id: '003',
+            text: '合作商家',
+            icon: '/static/login/username.png'
+        }, {
+            id: '004',
+            text: '团队管理',
+            icon: '/static/login/verificationcode.png'
+        }],
+        userMessage: {}, //用户信息
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+
+    },
+    /* 宫格展示区跳转 */
+    gridJumpPage(e) {
+        const {
+            name
+        } = e.target.dataset
+        console.log(name)
+    },
+    /* 跳转用户信息 */
+    toUserCenter() {
+        const data = JSON.stringify(this.data.userMessage)
+        wx.navigateTo({
+            url: '/pages/userCenter/index?data=' + data,
+        })
+    },
+    /* 退出登录 */
+    userLogout() {
+        _Http.logout({
+            "accesstoken": wx.getStorageSync('userData').token
+        }).then(res => {
+            if (res.status == "ok") {
+                wx.showToast({
+                    title: '退出成功',
+                })
+                // wx.setStorageSync('userData', {}) //清空用户数据
+                setTimeout(() => {
+                    wx.reLaunch({
+                        url: '/pages/login/index',
+                    })
+                }, 500)
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        // 获取用户信息
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.usercenter.usermsg.usermsg",
+            "method": "query_usermsg",
+            "content": {}
+        }).then(res => {
+            if (res.msg == '成功') return this.setData({
+                userMessage: res.data[0]
+            })
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pages/tabbar-pages/user/index.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "My_GeneralTemplate": "../../../components/My_GeneralTemplate/index",
+    "van-grid": "@vant/weapp/grid/index",
+    "van-grid-item": "@vant/weapp/grid-item/index"
+  }
+}

+ 38 - 0
pages/tabbar-pages/user/index.wxml

@@ -0,0 +1,38 @@
+<My_GeneralTemplate padBot="20rpx">
+    <!-- 用户头部 -->
+    <view class="user_header">
+        <view class="user_header_msg">
+            <!-- 头像 -->
+            <view class="user_headPortrait">
+                <image wx:if="{{userMessage.attinfos[0].fobsurl}}" src="{{userMessage.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+                <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
+            </view>
+            <!-- 信息 -->
+            <view class="user_message" bindtap="toUserCenter">
+                <!-- 用户名 -->
+                <view class="user_name">
+                    {{userMessage.fname}}<text>{{userMessage.frole}}</text>
+                </view>
+                <view class="user_nubmer">
+                    {{userMessage.fphonenumber}}
+                </view>
+            </view>
+            <!-- 箭头 -->
+            <view class="user_arrows" bindtap="toUserCenter">
+                <van-icon name="arrow" color="#333333" size="34rpx" />
+            </view>
+        </view>
+        <view style="height: 2rpx; width: 100%; background-color: #979797;"></view>
+    </view>
+    <!-- 宫格 -->
+    <view class="grid_box">
+        <van-grid border="{{false}}" bindtap="gridJumpPage">
+            <van-grid-item wx:for="{{gridList}}" data-name="{{item.text}}" icon="{{item.icon}}" text="{{item.text}}" text-class="grid_text-class" />
+        </van-grid>
+    </view>
+</My_GeneralTemplate>
+
+<!-- 注销按钮 -->
+<view class="logout">
+    <van-button bindtap="userLogout" custom-class="custom-class" round size="normal" color="rgba(103, 207, 220, 0.15);">退出登录</van-button>
+</view>

+ 100 - 0
pages/tabbar-pages/user/index.wxss

@@ -0,0 +1,100 @@
+/* 用户头部 */
+.user_header {
+    width: 100%;
+    padding: 0 16rpx;
+    box-sizing: border-box;
+}
+
+.user_header_msg {
+    display: flex;
+    width: 100%;
+    height: 130rpx;
+    padding: 0 24rpx;
+    margin-bottom: 40rpx;
+    box-sizing: border-box;
+}
+
+/* 头像 */
+.user_headPortrait {
+    width: 130rpx;
+    height: 100%;
+    border-radius: 50%;
+    margin-right: 30rpx;
+}
+
+.user_headPortrait>image {
+    width: 100%;
+    height: 100%;
+    border-radius: 50%;
+}
+
+/* 文本信息 */
+.user_message {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-around;
+    flex: 1;
+    height: 100%;
+}
+
+.user_name {
+    font-size: 36rpx;
+    font-weight: 500;
+    color: #000000;
+}
+
+.user_name>text {
+    display: inline-block;
+    height: 42rpx;
+    line-height: 42rpx;
+    font-size: 28rpx;
+    color: #FFFFFF;
+    border-radius: 15rpx;
+    background-color: #4BBECF;
+    margin-left: 20rpx;
+    padding: 0 26rpx;
+}
+
+.user_nubmer {
+    font-size: 32rpx;
+    color: #000000;
+}
+
+/* 箭头 */
+.user_arrows {
+    display: flex;
+    align-items: center;
+}
+
+/* 宫格样式 */
+.grid_box {
+    width: 100%;
+    padding: 0 30rpx;
+    box-sizing: border-box;
+    margin-top: 5rpx;
+}
+
+.grid_text-class {
+    font-family: PingFangSC-Regular, PingFang SC !important;
+    font-size: 28rpx !important;
+    color: #000000 !important;
+}
+
+/* 退出登录 */
+.logout {
+    width: 240rpx;
+    height: 88rpx;
+    border-radius: 44rpx;
+    box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.1);
+    border: 2rpx solid #4BBECF;
+    margin: 60rpx auto 0;
+    box-sizing: border-box;
+}
+
+.custom-class {
+    width: 100% !important;
+    font-size: 32rpx !important;
+    color: #4BBECF !important;
+    font-family: PingFangSC-Medium, PingFang SC !important;
+    font-weight: 500 !important;
+}

+ 70 - 0
pages/userCenter/index.js

@@ -0,0 +1,70 @@
+// pages/userCenter/index.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        userMessage: {}, //用户数据列表
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const userMessage = JSON.parse(options.data);
+        console.log(userMessage)
+        this.setData({
+            userMessage
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 5 - 0
pages/userCenter/index.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "My_GeneralTemplate": "../../components/My_GeneralTemplate/index"
+  }
+}

+ 5 - 0
pages/userCenter/index.wxml

@@ -0,0 +1,5 @@
+<My_GeneralTemplate>
+    <view>
+        
+    </view>
+</My_GeneralTemplate>

+ 1 - 0
pages/userCenter/index.wxss

@@ -0,0 +1 @@
+/* pages/userCenter/index.wxss */

+ 30 - 0
project.private.config.json

@@ -0,0 +1,30 @@
+{
+    "setting": {},
+    "condition": {
+        "plugin": {
+            "list": []
+        },
+        "game": {
+            "list": []
+        },
+        "gamePlugin": {
+            "list": []
+        },
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "个人信息",
+                    "pathName": "pages/userCenter/index",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "用户",
+                    "pathName": "pages/tabbar-pages/user/index",
+                    "query": "",
+                    "scene": null
+                }
+            ]
+        }
+    }
+}

+ 7 - 0
utils/api.js

@@ -23,6 +23,13 @@ class ApiModel extends HTTP {
             data
         })
     }
+    /* 注销登录 */
+    logout(data) {
+        return this.request({
+            url: "/logout",
+            data
+        })
+    }
 }
 export {
     ApiModel

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor