123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
- <view class="my-box">
- <view class="my-content">
- <view class="my-top"></view>
- <image class="my-avatar" @click="$navigateTo('/pageMy/myDetail/myDetail')" :src="user.portrait"
- mode="aspectFill"></image>
- <view class="name" @click="$navigateTo('/pageMy/myDetail/myDetail')">{{user.userName || '登录/注册'}}</view>
- <view class="organization" v-if="user.organizedName">{{user.organizedName}}</view>
- <view class="my-tab">
- <view class="tab-box">
- <view class="tab-item" @click="$navigateTo('/pageMy/myHouse/myHouse')">
- <view class="tab-number">{{fansCount.roomCount}}</view>
- <view class="tab-text">房源</view>
- </view>
- <view class="tab-item" @click="$navigateTo('/pageMy/fans/fans')">
- <view class="tab-number">{{fansCount.fansCount}}</view>
- <view class="tab-text">粉丝</view>
- </view>
- <view class="tab-item" @click="$navigateTo('/pageMy/attention/attention')">
- <view class="tab-number">{{fansCount.attentionCount}}</view>
- <view class="tab-text">关注</view>
- </view>
- </view>
- </view>
- <view class="my-list">
- <view class="my-list-box">
- <view class="my-item" @click="$navigateTo('/pageMy/collect/collect')">
- <view class="my-icon bg1">
- <uni-icons custom-prefix="iconfont" type="icon-wodeshoucangshixin" color="#fff" size="20">
- </uni-icons>
- </view>
- <view class="item-content">
- 我的收藏
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- <view class="my-item" @click="$navigateTo('/pageMy/client/client')">
- <view class="my-icon bg2">
- <uni-icons custom-prefix="iconfont" type="icon-wodekehu" color="#fff" size="20">
- </uni-icons>
- </view>
- <view class="item-content">
- 我的客户
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- <view class="my-item" @click="$navigateTo('/pageMy/myReservation/myReservation')">
- <view class="my-icon bg5">
- <uni-icons custom-prefix="iconfont" type="icon-kefuzhongxin" color="#fff" size="24">
- </uni-icons>
- </view>
- <view class="item-content">
- 我的预约
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- <view class="my-item" @click="$navigateTo('/pageMy/organization/organization')">
- <view class="my-icon bg3">
- <uni-icons custom-prefix="iconfont" type="icon-wodegongsi-gaoliang" color="#fff" size="22">
- </uni-icons>
- </view>
- <view class="item-content">
- 我的公司
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- <view class="my-item" @click="$navigateTo('/pageMy/dataCenter/dataCenter')">
- <view class="my-icon bg4">
- <uni-icons custom-prefix="iconfont" type="icon-wenjian" color="#fff" size="20">
- </uni-icons>
- </view>
- <view class="item-content">
- 数据中心
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- <view class="my-item" @click="$navigateTo('/pageMy/download/download')">
- <view class="my-icon bg5">
- <uni-icons custom-prefix="iconfont" type="icon-wodexiazaizhongxin" color="#fff" size="18">
- </uni-icons>
- </view>
- <view class="item-content">
- 我的下载
- </view>
- <view class="my-forward">
- <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getMyCount,
- getUserInfoById
- } from '@/request/api/my.js'
- export default {
- data() {
- return {
- fansCount: {
- attentionCount: 0,
- fansCount: 0,
- roomCount: 0
- },
- user: {}
- }
- },
- onShow() {
- if (!uni.getStorageSync('token')) {
- this.user = {};
- this.fansCount = {
- attentionCount: 0,
- fansCount: 0,
- roomCount: 0
- }
- } else {
- this.user = this.$store.getters.user;
- this.user.organizedName = this.$store.getters.organization && this.$store.getters.organization.name;
- this.init();
- }
- },
- methods: {
- init() {
- getMyCount().then(res => {
- if (res.code === 200) {
- this.fansCount = res.data;
- }
- })
- getUserInfoById(this.user.userId).then(res => {
- if (res.code === 200) {
- this.user = res.data;
- this.user['userName'] = res.data.name;
- this.user['userId'] = res.data.id;
- this.user.organizedName = res.data.mgrOrganization && res.data.mgrOrganization.name;
- this.$store.dispatch('app/changeUser', res.data);
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .my-box {
- height: 100vh;
- background: #fff;
- overflow-y: auto;
- .my-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-bottom: 80rpx;
- }
- .my-top {
- height: 260rpx;
- background-image: url('https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyMDUzMDJ8MHwxfHNlYXJjaHw1fHxhYnN0cmFjdHxlbnwxfHx8fDE2NTI4OTYzNTU&ixlib=rb-1.2.1&q=80&w=1080');
- background-position: center center;
- background-size: cover;
- background-repeat: no-repeat;
- width: 100%;
- }
- .my-avatar {
- width: 200rpx;
- height: 200rpx;
- border-radius: 50%;
- margin-top: -100rpx;
- border: 6rpx solid #fff;
- background: #eee;
- }
- .name {
- font-size: 20px;
- font-weight: 700;
- margin: 10rpx 0;
- }
- .organization {
- color: $uni-secondary-color;
- font-weight: 300;
- }
- .my-tab {
- width: 100%;
- padding: 0 30rpx;
- box-sizing: border-box;
- margin: 40rpx 0;
- .tab-box {
- height: 160rpx;
- border-radius: 24rpx;
- box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
- display: flex;
- align-items: center;
- }
- .tab-item {
- flex: 1;
- text-align: center;
- }
- .tab-number {
- font-size: 40rpx;
- font-weight: 600;
- }
- .tab-text {
- font-size: 24rpx;
- font-weight: 300;
- margin-top: 10rpx;
- }
- }
- .my-list {
- width: 100%;
- padding: 0 30rpx;
- box-sizing: border-box;
- .my-list-box {
- border-radius: 24rpx;
- box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
- overflow: hidden;
- }
- .my-item {
- display: flex;
- align-items: center;
- padding: 20rpx 30rpx;
- }
- .my-item:active {
- background: $uni-background-color;
- }
- .my-icon {
- width: 80rpx;
- height: 80rpx;
- border-radius: 16rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 20rpx;
- background: #c1c0c8;
- &.bg1 {
- background: #88d498;
- }
- &.bg2 {
- background: #ffb997;
- }
- &.bg3 {
- background: #7ad9ff;
- }
- &.bg4 {
- background: #9ac0cd;
- }
- &.bg5 {
- background: #40e0d0;
- }
- }
- .my-forward {
- height: 40rpx;
- }
- .item-content {
- flex: 1;
- width: 0;
- overflow: hidden;
- font-weight: 700;
- }
- }
- }
- </style>
|