Sfoglia il codice sorgente

feat:增加tabbar与个人信息页面

lvkun 3 anni fa
parent
commit
1a3a1960fd

+ 36 - 0
src/pages.json

@@ -11,6 +11,23 @@
 				}
 			}
 		},
+		{
+			"path": "pages/me/index",
+			"style": {
+				"navigationBarTitleText": "代理商",
+				"navigationStyle": "custom",
+				"usingComponents":{
+					"van-button": "/wxcomponents/button/index",
+					"van-overlay": "/wxcomponents/overlay/index"
+				}
+			}
+		},
+		{
+			"path": "pages/setting/index",
+			"style": {
+				"navigationBarTitleText": "设置"
+			}
+		},
 		{
 			"path": "pages/index/index",
 			"style": {
@@ -138,5 +155,24 @@
 			"van-field": "/wxcomponents/field/index",
 			"van-overlay": "/wxcomponents/overlay/index"
 		}
+	},
+	"tabBar": {
+		"color": "#999",
+		"borderStyle": "white",
+		"selectedColor": "#1677FF",
+		"list": [
+			{
+				"pagePath": "pages/user/index",
+				"text": "首页",
+				"iconPath": "/static/tabbar/home.png",
+				"selectedIconPath": "/static/tabbar/homeSelect.png"
+			},
+			{
+				"pagePath": "pages/me/index",
+				"text": "我的",
+				"iconPath": "/static/tabbar/message.png",
+				"selectedIconPath": "/static/tabbar/messageSelect.png"
+			}
+		]
 	}
 }

+ 205 - 0
src/pages/me/index.vue

@@ -0,0 +1,205 @@
+<template>
+    <view class="me">
+        <custom-navbar class="custom-navbar" />
+        <!-- 背景图片 -->
+        <image class="bg-img" :src="require('@/static/me/bg.png')" @click="goEditUserPage"/>
+        <!-- 用户信息 -->
+        <view class="user" >
+            <view class="user-ava" >
+              <open-data  type="userAvatarUrl" />
+            </view>
+            
+            <view class="user-info">
+                <view class="user-name van-ellipsis">
+                   {{userInfoData.name || '请登录'}}
+                </view>
+                
+                <view class="user-auth" @click="goOptionsPage({id: 3})" >  <!-- @click="goRolePage" -->
+                    <image class="user-auth-ava" :src="staticImg.authFlag" />
+                    <text> 代理商</text>
+                </view>
+            </view>
+        </view>
+        <!-- 各种分类 -->
+        <view class="category">
+            <view class="category-item" 
+                v-for="item in categoryList" 
+                :key="item.id"
+                @click="goSettingPage"
+            >
+                <view class="left">
+                    <image class="category-ava" mode="aspectFill"  :src="item.ava" />
+                    <text>{{item.label}}</text>
+                </view>
+                <view class="right">
+                    <van-icon name="arrow" size="24rpx" color="#999" />
+                </view>
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+import CustomNavbar from '@/components/CustomNavbar/index'
+import { getUserInfo } from '@/api/user'
+const categoryList = Object.freeze([
+              {
+                  id: 4,
+                  ava: require('@/static/me/setting.png'),
+                  label: '我的设置'
+              },
+          ])
+
+export default {
+  name: 'Me',
+  components: {
+    CustomNavbar
+  },
+  computed: {
+  },
+  onLoad () {
+    this.getUserInfo()
+  },
+  data () {
+      return {
+        categoryList,
+        staticImg: {
+            authFlag: require('@/static/me/auth-flag.png'),
+        },
+        userInfoData: {},
+      }
+  },
+  methods: {
+    goSettingPage () {
+      uni.navigateTo({
+        url: '/pages/setting/index'
+      })
+    },
+    //   获取个人信息
+    async getUserInfo () {
+       const {status, data} = await getUserInfo()
+       if (status === 200) {
+          
+           this.userInfoData = Object.freeze(data)
+       }
+    },
+  }
+
+}
+</script>
+<style scoped lang="less">
+.me {
+    .custom-navbar {
+        visibility: hidden;
+    }
+    .bg-img {
+        width: 490rpx;
+        height: 320rpx;
+        position: fixed;
+        top: 0;
+        left: 0;
+        z-index: -1;
+    }
+    .user {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        padding: 0 64rpx;
+        box-sizing: border-box;
+        margin-top: 72rpx;
+        &-ava {
+            width: 160rpx;
+            height: 160rpx;
+            border: 6rpx solid #FFFFFF;
+            box-sizing: border-box;
+            border-radius: 50%;
+            margin-right: 56rpx;
+            overflow: hidden;
+        }
+        &-info {
+            flex: 1;
+            .user-name {
+                width: 406rpx;
+                font-size: 44rpx;
+                font-weight: 600;
+                color: #333333;
+            }
+            .user-auth {
+                font-size: 24rpx;
+                font-weight: 400;
+                color: #999999;
+                margin-top: 16rpx;
+                display: flex;
+                align-items: center;
+                .user-auth-ava {
+                    width: 20rpx;
+                    height: 20rpx;
+                    margin-right: 10rpx;
+                    display: block;
+                }
+                text {
+                    margin-right: 10rpx;
+                }
+            }
+        }
+    }
+    .attention {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        padding: 0rpx 88rpx 0rpx 90rpx;
+        box-sizing: border-box;
+        margin-top: 64rpx;
+        .attention-item {
+            display: flex;
+            flex-direction: column;
+            align-items: center;
+            .label {
+                font-size: 24rpx;
+                font-weight: 400;
+                color: #999999;
+                margin-bottom: 26rpx;
+                display: block;
+            }
+            .num {
+                font-size: 40rpx;
+                font-weight: 600;
+                color: #333333;
+                display: block;
+            }
+        }
+         
+    }
+
+    .category {
+        margin-top: 60rpx;
+        &-item {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            padding: 0rpx 64rpx 0rpx 86rpx;
+            box-sizing: border-box;
+            height: 124rpx;
+            .left {
+                display: flex;
+                align-items: center;
+                .category-ava {
+                    width: 40rpx;
+                    height: 44rpx;
+                    margin-right: 30rpx;
+                    display: block;
+                }
+                text {
+                    font-size: 30rpx;
+                    font-weight: 400;
+                    color: #333333;
+                }
+            }
+            .right {
+                width: 24rpx;
+                height: 24rpx;
+            }
+        }
+    }
+}
+</style>

+ 120 - 0
src/pages/setting/index.vue

@@ -0,0 +1,120 @@
+<template>
+    <view class="opinion">
+        <!-- 反馈 -->
+        <view class="list">
+            <button class="item" :open-type="item.id === 0 ? 'feedback' : '' " v-for="item in opinionList" :key="item.id" @click="clickOpinion(item)">
+                <text>{{ item.label }}</text>
+                <van-icon name="arrow" size="22rpx"/>
+            </button>
+        </view>
+        <!-- 退出登录 -->
+        <view class="login-out" @click="outLogin">
+            退出登录
+        </view>
+    </view>
+</template>
+
+<script>
+import Tip from '@/utils/tip'
+const opinionList = Object.freeze([
+    {
+        id: 0,
+        label: '意见反馈'
+    }
+])
+export default {
+  name: 'setting',
+  onUnload () {
+      clearTimeout(this.time)
+  },
+  data () {
+      return {
+          opinionList,
+          time: ''
+      }
+  },
+  methods: {
+
+      clickOpinion(records) {
+          console.log(records);
+          switch (records.id) {
+              case 0:
+                  uni.
+                  break;
+          
+              default:
+                  break;
+          }
+      },
+
+      outLogin () {
+          Tip.confirm('确定要退出吗?').then(res => {
+              if (res) {
+                Tip.loading('正在退出')
+                this.time = setTimeout( () => {
+                    Tip.loaded()
+                    uni.clearStorageSync()
+                    uni.reLaunch({
+                        url: '/pages/index/index'
+                    })
+                }, 1000)
+              }
+          }) 
+      }
+  },
+}
+</script>
+<style scoped lang="less">
+.opinion {
+    width: 100vw;
+    height: 100vh;
+    background: #F9F7F7;
+    overflow: hidden;
+    font-size: 28rpx;
+    font-weight: 600;
+    color: #161616;
+    .list {
+        width: 686rpx;
+        background: #FFFFFF;
+        box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(235, 235, 235, 0.5);
+        margin: 0 auto;
+        border-radius: 20rpx;
+        overflow: hidden;
+        margin-top: 24rpx;
+        .item {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            height: 100rpx;
+            padding: 0rpx 24rpx 0rpx 32rpx;
+            box-sizing: border-box;
+            border: none;
+            background-color: #fff;
+            text {
+                font-size: 32rpx;
+                font-weight: 500;
+                color: #333333;
+            }
+        }
+        .item::after {
+            border: none;
+        }
+    }
+    .login-out {
+      width: 534rpx;
+      height: 92rpx;
+      background: #1677FF;
+      box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(235, 235, 235, 0.5);
+      border-radius: 46rpx;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      font-size: 28rpx;
+      font-family: PingFangSC-Medium, PingFang SC;
+      font-weight: 500;
+      color: #FFFFFF;
+      margin: 0 auto;
+      margin-top: 80rpx;
+    }
+}
+</style>

BIN
src/static/me/auth-flag.png


BIN
src/static/me/bg.png


BIN
src/static/me/setting.png


BIN
src/static/tabbar/home.png


BIN
src/static/tabbar/homeSelect.png


BIN
src/static/tabbar/message.png


BIN
src/static/tabbar/messageSelect.png