123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <template>
- <view class="discussion-page">
- <!-- 项目卡片 -->
- <view class="project-card">
- <image class="project-img" :src="articleInfo.main_image" />
- <view class="project-info">
- <view class="project-title two-omit">{{ articleInfo.title }}</view>
- </view>
- </view>
- <view class="tabs">
- <view class="tab-item" @click="checkTab(item.id)" v-for="(item, index) in cate" :key="index">
- <view class="tab" :class="{ active: tab === item.id }">
- <text class="left">{{ item.name }}</text>
- <view class="line"></view>
- </view>
- </view>
- </view>
-
- <view v-if="tab === 1" class="update-list">
- <block v-for="(item, idx) in projectUpdate" :key="idx">
- <view class="update-item" @click="goPages('/pages/crowdFunding/projectUpdateDetails?id=' + item.id)">
- <view class="update-title">第{{ item.numb }}次更新</view>
- <view class="update-content" >{{ item.title }}</view>
- <view class="update-user">
- <image class="avatar" :src="articleInfo.creator_avatar" />
- <text class="nickname">{{ articleInfo.creator_nickname }}</text>
- </view>
- <image class="update-img" :src="item.image" mode="widthFix" />
- <view class="update-footer">
- <text class="update-time">{{ item.create_time }}</text>
- <view class="update-like">
- <!-- <image :src="item.liked ? '/static/icon/icon-18.png' : '/static/icon/icon-19.png'"
- class="like-icon" />
- <text class="like-num">{{ item.likeNum }}</text> -->
- </view>
- </view>
- </view>
- </block>
- </view>
- <!-- 评论区域 -->
- <CommentSection v-else-if=" articleInfo&&articleInfo.is_like != 'undefined'" class="comment" ref="commentSection" :articleId="id"
- @totalNumberOfComments="totalNumberOfComments" :articleInfo="articleInfo" :myInfo="myInfo" :author="author"
- find="crowdfund" type="crowdfund">
- </CommentSection>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tab: 1,
- id: 0,
- projectUpdate: [
- ],
- cate: [
- {
- name: "项目更新",
- id: 1,
- },
- {
- name: "项目讨论",
- id: 2,
- },
- ],
- myInfo: {
- user_id: getApp().globalData.user_id, // 用户id
- user_name: getApp().globalData.nickname, // 用户名
- user_avatar: getApp().globalData.avator, // 用户头像地址
- },
- articleInfo: {},
- type: 'crowdfund',
- find: 'crowdfund',
- author: {
- }
- }
- },
- onLoad(options) {
- if (options.tags) {
- this.tab = options.tags === 'update' ? 1 : options.tags === 'comment' ? 2 : 1;
- }
- if (options.id) {
- this.id = options.id;
- }
- this.getDetails()
- },
- methods: {
- checkTab(tab) {
- this.tab = tab;
- },
- totalNumberOfComments(tableTotal) {
- this.tableTotal = tableTotal;
- },
- getDetails() {
- uni.request({
- url: this.$apiHost + '/crowdfund/detail',
- method: 'GET',
- data: {
- id: this.id,
- uuid: getApp().globalData.uuid,
- skey: getApp().globalData.skey
- },
- success: (res) => {
- if (res.data && res.data.success === 'yes' && res.data.data) {
- this.articleInfo = res.data.data
- this.author = {
- "id": res.data.data.creator_id,
- "nickname": res.data.data.creator_nickname,
- "avator": res.data.data.creator_avatar,
- }
- }
- }
- });
- uni.request({
- url: this.$apiHost + '/crowdfund/articles',
- method: 'GET',
- data: {
- crowdfund_id: this.id,
- uuid: getApp().globalData.uuid,
- skey: getApp().globalData.skey
- },
- success: (res) => {
- if (res.data && res.data.success === 'yes' && res.data.data) {
- if (Array.isArray(res.data.data.list)) {
- this.projectUpdate = res.data.data.list.map(item => ({
- ...item,
- create_time: item.create_time.replace(/-/g, '.').slice(0, 16)
- }));
-
- }
- }
- }
- });
- uni.request({
- url: this.$apiHost + '/crowdfund/favorite/status',
- method: 'GET',
- data: {
- crowdfund_id: this.id,
- uuid: getApp().globalData.uuid,
- skey: getApp().globalData.skey
- },
- success: (res) => {
- if (res.data && res.data.success === 'yes' && res.data.data) {
- console.log(res.data.data, "收藏");
- console.log( res.data.data.is_favorited ,89798789);
-
- this.articleInfo.is_like= res.data.data.is_favorited;
-
- // 可根据接口返回字段设置isFavorite等
- }
- }
- });
- },
- goPages(url) {
- uni.navigateTo({
- url: url
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .discussion-page {
- min-height: 100vh;
- background: #f2f6f2;
- padding-bottom: 40rpx;
- .project-card {
- display: flex;
- align-items: center;
- background: #fff;
- width: 100vw;
- height: 184rpx;
- border-bottom: 1px solid #F2F6F2;
- padding: 28rpx;
- .project-img {
- width: 128rpx;
- height: 128rpx;
- border-radius: 6rpx;
- margin-right: 16rpx;
- }
- .project-title {
- font-size: 28rpx;
- font-weight: bold;
- color: #222;
- max-width: 500rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- line-height: 2;
- }
- }
- .tabs {
- display: flex;
- height: 72rpx;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- background: #fff;
- margin-bottom: 6rpx;
- .tab-item {
- width: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- .tab {
- position: relative;
- // width: 96rpx;
- width: 130rpx;
- height: 48rpx;
- font-size: 32rpx;
- font-family: "PingFang SC-Bold";
- color: #999;
- font-weight: 400;
- transition: all .5s;
- ::after {
- content: "";
- position: absolute;
- right: -15rpx;
- top: 0;
- width: 96rpx;
- height: 48rpx;
- background-image: url("../../static/me/wd_img_qiehuan.png");
- background-size: auto 100%;
- background-repeat: no-repeat;
- opacity: 0;
- }
- &.active {
- color: #1f1f1f;
- text {
- font-family: "PingFang SC-Bold";
- }
- ::after {
- opacity: 0.7;
- }
- }
- }
- }
- }
- .update-list {
- padding: 0 24rpx;
- .update-item {
- background: #fff;
- border-radius: 16rpx;
- margin-bottom: 24rpx;
- padding: 18rpx 20rpx 12rpx 20rpx;
- .update-title {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 8rpx;
- }
- .update-content {
- font-size: 28rpx;
- color: #222;
- margin-bottom: 12rpx;
- }
- .update-user {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- .avatar {
- width: 36rpx;
- height: 36rpx;
- border-radius: 50%;
- margin-right: 8rpx;
- }
- .nickname {
- font-size: 22rpx;
- color: #999;
- }
- }
- .update-img {
- width: 100%;
- height: 160rpx;
- border-radius: 12rpx;
- object-fit: cover;
- margin-bottom: 10rpx;
- }
- .update-footer {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .update-time {
- font-size: 22rpx;
- color: #999;
- }
- .update-like {
- display: flex;
- align-items: center;
- .like-icon {
- width: 28rpx;
- height: 28rpx;
- margin-right: 4rpx;
- }
- .like-num {
- font-size: 22rpx;
- color: #888;
- }
- }
- }
- }
- }
- .comment {
- background: #fff;
- border-top-left-radius: 32rpx;
- border-top-right-radius: 32rpx;
- }
- }
- </style>
|