123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <view class="info-card-detail" :style="{ 'background-image': pagesType == '专栏详情' ? 'url(' + authorDetail.BgImg + ')' : '' }">
- <view class="name-author">
- <view class="author-img">
- <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
- <image :src="authorDetail.HeadImg"></image>
- <image @click="onChooseAvatar" v-if="authorDetail.HasChangeHeadImg == 0" class="is-photo" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/photo_icon.png"></image>
- </button>
- <view class="set-btn" v-if="pagesType == '专栏详情'" @click.stop="editMyColumn"> 编辑专栏</view>
- </view>
- <view class="name-box">
- <text>{{ authorDetail.SpecialName }}</text>
- <text>{{ authorDetail.NickName }}</text>
- </view>
- </view>
- <view class="info-card-lable">
- <text v-for="item in dataProcessing(authorDetail.Label)" :key="item">{{ item }}</text>
- </view>
- <view class="info-card-fans">
- <text>{{ authorDetail.SpecialArticleNum }}</text>
- <text>文章</text>
- <text>{{ authorDetail.CollectNum }}</text>
- <text>被收藏</text>
- <text>{{ authorDetail.FollowNum }}</text>
- <text>粉丝</text>
- </view>
- <view style="color: #fff; margin-top: 20rpx"> {{ authorDetail.Introduction }}</view>
- </view>
- </template>
- <script>
- import { purchaserApi, uploadurl } from "@/config/api";
- export default {
- props: {
- authorDetail: {
- type: Object,
- default: {},
- },
- pagesType: {
- type: String,
- default: "",
- },
- },
- data() {
- return {};
- },
- methods: {
- // 数据处理
- dataProcessing(item) {
- return item ? item.split(",") : [];
- },
- //点击了头像
- onChooseAvatar(e) {
- let token = this.$db.get("access_token");
- let authHeader = token || "";
- let that = this;
- uni.uploadFile({
- url: uploadurl,
- filePath: e.detail.avatarUrl,
- header: {
- "Content-Type": "multipart/form-data",
- Authorization: authHeader,
- },
- name: "file",
- success: async (resImg) => {
- let data = JSON.parse(resImg.data);
- const resUp = await purchaserApi.yanxuanSpecialAuthorImg({
- HeadImg: data.Data.ResourceUrl,
- UserId: that.authorDetail.UserId,
- });
- if (resUp.Ret === 200) {
- that.$parent.authorDetail.HeadImg = data.Data.ResourceUrl;
- that.$parent.authorDetail.HasChangeHeadImg = 1;
- }
- },
- });
- },
- editMyColumn() {
- if (this.pagesType == "专栏详情") {
- uni.navigateTo({ url: "/pages-purchaser/editSpecialColumn/editSpecialColumn" });
- }
- },
- },
- };
- </script>
- <style lang="scss" scope>
- .info-card-detail {
- border-radius: 16rpx;
- background-size: 100% 100%;
- // 上面的那个盒子用就把上面的样式去掉
- width: 100%;
- padding: 40rpx 35rpx;
- background-repeat: no-repeat;
- color: #fff;
- .name-author {
- display: flex;
- background: rgba(0, 0, 0, 0);
- .author-img {
- position: relative;
- display: flex;
- justify-content: center;
- width: 126rpx;
- height: 138rpx;
- text-align: center;
- background: rgba(0, 0, 0, 0);
- .avatar-wrapper {
- background: rgba(0, 0, 0, 0);
- }
- .is-photo {
- position: absolute;
- top: (calc(50% - 15rpx));
- left: 50%;
- width: 60rpx;
- height: 60rpx;
- z-index: 9;
- transform: translate(-50%, -50%);
- }
- image {
- background: rgba(0, 0, 0, 0);
- width: 111rpx;
- height: 111rpx;
- border-radius: 50%;
- }
- .set-btn {
- position: absolute;
- display: flex;
- justify-content: center;
- align-items: center;
- left: 0;
- bottom: 0;
- width: 126rpx;
- height: 48rpx;
- border-radius: 150rpx;
- background-color: #376cbb;
- color: #fff;
- z-index: 9;
- font-size: 24rpx;
- }
- }
- .name-box {
- margin-left: 20rpx;
- text:nth-child(1) {
- font-size: 36rpx;
- font-weight: 500;
- line-height: 50rpx;
- padding: 20rpx 0;
- }
- text:nth-child(2) {
- font-size: 28rpx;
- font-weight: 400;
- line-height: 39rpx;
- }
- }
- }
- .info-card-lable {
- display: flex;
- flex-wrap: wrap;
- text {
- display: flex;
- align-items: center;
- height: 45rpx;
- padding: 0 12rpx;
- border-radius: 150rpx;
- background-color: #8994a1;
- margin: 20rpx 20rpx 0rpx 0;
- }
- }
- .info-card-fans {
- margin-top: 20rpx;
- display: flex;
- align-items: center;
- text:nth-child(2n + 1) {
- color: #ffe8a8;
- font-size: 38rpx;
- font-weight: 500;
- }
- text:nth-child(2n) {
- margin: 0 40rpx 0 5rpx;
- }
- }
- }
- </style>
|