123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="my-box">
- <view class="my-content">
- <view class="my-top"></view>
- <image class="my-avatar" @tap="$navigateTo('/subPages/myPage/myDetail/myDetail')" :src="user.portrait" mode="aspectFill"></image>
- <view class="name" @tap="$navigateTo('/subPages/myPage/myDetail/myDetail')">{{user.userName || '登录/注册'}}</view>
- <view class="organization" v-if="user.organizedName">{{user.organizedName}}</view>
- <view class="my-list">
- <view class="my-list-box">
- <view class="my-item" @tap="$navigateTo('/subPages/myPage/organization/organization')">
- <view class="my-icon bg3">
- <uv-icon name="home-fill" color="#fff" size="56"></uv-icon>
- </view>
- <view class="item-content">
- 我的公司
- </view>
- <view class="my-forward">
- <uv-icon name="arrow-right" color="#c1c0c8" size="32"></uv-icon>
- </view>
- </view>
- <view class="my-item" @tap="$navigateTo('/subPages/myPage/download/download')">
- <view class="my-icon bg5">
- <uv-icon name="grid-fill" color="#fff" size="56"></uv-icon>
- </view>
- <view class="item-content">
- 我的下载
- </view>
- <view class="my-forward">
- <uv-icon name="arrow-right" color="#c1c0c8" size="32"></uv-icon>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- 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;
- }
- },
- 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 {
- font-weight: 300;
- }
- .my-list {
- width: 100%;
- padding: 60rpx 30rpx 30rpx 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-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;
- }
- }
- .item-content {
- flex: 1;
- width: 0;
- overflow: hidden;
- font-weight: 700;
- }
- }
- }
- </style>
|