123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <template>
- <view class="container column-detail">
- <view :class="['position-regular', scrollTopNumber != 0 && 'position-content-bg']" :style="{ 'background-image': scrollTopNumber <= 0 ? `url(${authorDetail.BgImg})` : '' }">
- <view class="nav-bar-wrap" :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }">
- <view class="content-box" :style="{ color: scrollTopNumber <= 0 ? '#fff' : '#333' }">
- <text v-if="scrollTopNumber != 0">专栏详情</text>
- <view class="arrow-left-icon">
- <van-icon name="arrow-left" size="20px" @click="goHandler" />
- </view>
- </view>
- </view>
- <view class="name-author">
- <view class="author-img">
- <view class="img-box">
- <image :src="authorDetail.HeadImg"></image>
- </view>
- <view class="set-btn" @click="followAuthor">{{ authorDetail.IsFollow == 1 ? "取消关注" : "+ 关注" }}</view>
- </view>
- <view class="name-box" :style="{ color: scrollTopNumber <= 0 ? '#fff' : '#333' }">
- <text>{{ authorDetail.SpecialName }}</text>
- <text>{{ authorDetail.NickName }}</text>
- </view>
- </view>
- </view>
- <view class="info-lable-card" :style="{ 'background-image': `url(${authorDetail.BgImgDown})` }">
- <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>
- <view class="column-list-content" v-if="specialList && specialList.length > 0">
- <column-list-content :authorDetail="authorDetail" :mySpecialList="specialList" @upDateCollectHandler="upDateCollectHandler" />
- </view>
- <view class="nodata" v-else>
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
- <text>还没有发布过内容</text>
- </view>
- <Loading />
- </view>
- </template>
- <script>
- import ColumnListContent from "../components/columnListContent.vue";
- import infoCard from "../components/infoCard.vue";
- import { purchaserApi } from "@/config/api";
- export default {
- components: { infoCard, ColumnListContent },
- data() {
- return {
- navBarStyle: {
- height: 60 + "px",
- paddingTop: 40 + "px",
- paddingBottom: "4px",
- },
- scrollTopNumber: 0,
- authorDetail: {},
- specialList: [],
- detailUserId: 0,
- };
- },
- methods: {
- initNavBar() {
- let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
- this.navBarStyle = {
- height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
- paddingTop: menuButtonInfo.top - 4 + "px",
- paddingBottom: "4px",
- };
- },
- // 获取作者详情
- async getAuthorDetail() {
- const res = await purchaserApi.yanxuanSpecialAuthorDetail({ UserId: this.detailUserId });
- if (res.Ret === 200) {
- this.authorDetail = res.Data || {};
- this.getColumnList();
- }
- },
- // 获取专栏列表
- async getColumnList() {
- const res = await purchaserApi.yanxuanSpecialList({ UserId: this.authorDetail.UserId });
- if (res.Ret === 200) {
- this.specialList = res.Data.List || [];
- }
- },
- // 数据处理
- dataProcessing(item) {
- return item ? item.split(",") : [];
- },
- // 点击关注作者
- async followAuthor() {
- await this.$store.dispatch("checkHandle");
- if (!this.$store.state.isAuth && !this.$store.state.isBind) {
- //已授权已绑定
- let Status = this.authorDetail.IsFollow == 1 ? 2 : 1;
- const res = await purchaserApi.yanxuanSpecialFollow({
- FollowUserId: this.authorDetail.UserId,
- Status,
- });
- if (res.Ret === 200) {
- this.authorDetail.IsFollow = Status;
- Status == 1 &&
- uni.showModal({
- title: "已关注专栏",
- content: "请关注【查研观向小助手】 公众号,及时获取专栏下内容更新提醒",
- confirmText: "知道了",
- showCancel: false,
- confirmColor: "#376cbb",
- });
- }
- }
- },
- // 左上角的返回按钮
- goHandler() {
- uni.navigateBack({
- fail() {
- uni.switchTab({
- url: "/pages/index/index",
- });
- },
- });
- },
- // 更新收藏
- upDateCollectHandler(item) {
- this.specialList.forEach((key) => {
- if (key.Id === item.Id) {
- key.CollectNum = item.IsCollect == 1 ? item.CollectNum - 1 : item.CollectNum + 1;
- key.IsCollect = item.IsCollect == 1 ? 0 : 1;
- }
- });
- },
- },
- onLoad(opacity) {
- this.detailUserId = Number(opacity.id) || 0;
- this.initNavBar();
- this.getAuthorDetail();
- },
- onPageScroll(e) {
- this.scrollTopNumber = e.scrollTop;
- },
- /** 用户点击分享 */
- onShareAppMessage: function (res) {
- return {
- title: this.authorDetail.SpecialName,
- path: "/pages-purchaser/columnDetail/columnDetail?id=" + this.detailUserId,
- };
- },
- };
- </script>
- <style lang="scss" scope>
- .column-detail {
- position: relative;
- background-color: $uni-bg-color;
- .scroll-top-content,
- .position-content-bg {
- background-color: #fff;
- }
- .position-regular {
- position: sticky;
- height: 350rpx;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 99;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- .name-author {
- z-index: 99;
- display: flex;
- height: 178rpx;
- padding: 20rpx 40rpx;
- .author-img {
- position: relative;
- display: flex;
- justify-content: center;
- width: 126rpx;
- height: 138rpx;
- text-align: center;
- .img-box {
- width: 110rpx;
- height: 110rpx;
- border-radius: 50%;
- overflow: hidden;
- image {
- width: 110rpx;
- height: 110rpx;
- }
- }
- .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;
- font-size: 24rpx;
- }
- }
- .name-box {
- color: #fff;
- 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;
- }
- }
- }
- }
- .nav-bar-wrap {
- width: 100%;
- display: flex;
- align-items: center;
- z-index: 99;
- .content-box {
- position: relative;
- display: flex;
- align-items: center;
- width: 100%;
- justify-content: center;
- color: #fff;
- font-size: 34rpx;
- .arrow-left-icon {
- position: absolute;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 40rpx;
- height: 40rpx;
- left: 39rpx;
- top: 50%;
- transform: translateY(-50%);
- z-index: 99;
- }
- }
- }
- .column-list-content {
- // position: absolute;
- width: 682rpx;
- margin: 30rpx auto 0;
- border-radius: 12rpx 12rpx 0 0;
- // top: 580rpx;
- // right: 50%;
- // transform: translateX(50%);
- // z-index: 9;
- overflow: hidden;
- }
- .info-lable-card {
- background-size: 100% 100%;
- background-repeat: no-repeat;
- padding: 0 30rpx 35rpx;
- .info-card-lable {
- display: flex;
- flex-wrap: wrap;
- text {
- display: flex;
- align-items: center;
- height: 45rpx;
- padding: 0 12rpx;
- border-radius: 150rpx;
- background-color: rgba(255, 255, 255, 0.4);
- margin: 20rpx 20rpx 0rpx 0;
- color: #fff;
- font-size: 28rpx;
- }
- }
- .info-card-fans {
- padding-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;
- color: #fff;
- }
- }
- }
- }
- </style>
|