This commit is contained in:
2025-03-13 03:10:06 +08:00
parent 243279d067
commit ebc8c7bb26
455 changed files with 52968 additions and 419 deletions
@@ -4,46 +4,38 @@
:getone="true" :where="where" :manual="true" ref="detail" foreignKey="uni-cms-articles.user_id"
@load="loadData" class="article">
<template v-if="!loading && data">
<view class="meta">
<view class="title">
<text class="text">{{ data.title }}</text>
</view>
<view class="excerpt">
<text class="text">{{ data.excerpt }}</text>
</view>
<view @click="toPersonalpage">
<view class="meta">
<view class="title">
<text class="text">{{ data.title }}</text>
</view>
<view class="excerpt">
<text class="text">{{ data.excerpt }}</text>
</view>
<view class="author">
<template>
<cloud-image
height="64rpx"
width="64rpx"
borderRadius="50%"
:src="data.user_id[0].avatar_file.url"></cloud-image>
<text class="at">{{ data.user_id[0].nickname || '' }}</text>
<text class="split">·</text>
</template>
<text class="date">{{ publishTime( data.publish_date) }}</text>
<view class="author">
<template>
<cloud-image height="64rpx" width="64rpx" borderRadius="50%"
:src="data.user_id[0].avatar_file.url"></cloud-image>
<text class="at">{{ data.user_id[0].nickname || '' }}</text>
<text class="split">·</text>
</template>
<text class="date">{{ publishTime( data.publish_date) }}</text>
</view>
</view>
</view>
<render-article-detail :content="data.content" :content-images="data.content_images"
:ad-config="{ adpId, watchAdUniqueType }"></render-article-detail>
<!-- <view class="" style="font-size: 20rpx;color: #999;margin-left: 50rpx;margin-top: 20rpx;">
更新于 2024-12-26 {{ publishTime(data.last_modify_date) }}
</view> -->
</template>
<view class="detail-loading" v-else>
<uni-icons type="spinner-cycle" size="35px" />
</view>
<uni-grid :column="3" :highlight="true" @change="change" :show-border="false">
<uni-grid-item
v-for="(item, index) in gridLst"
:index="index"
:key="index">
<uni-grid-item v-for="(item, index) in gridLst" :index="index" :key="index">
<view class="grid-item-box" style="background-color: #fff;">
<uni-icons :type="item.icon" :size="30" :color="item.select_flag?'#e66':'#777'" />
<text class="text">{{item.value}}</text>
@@ -55,38 +47,72 @@
<text class="date" @click="complaint">投诉</text> | 阅读 {{ data.view_count }}
</view>
<view class="example-body" style="justify-content:center" v-for="(item, index) in cmsArticleLogList" :key="index">
<cloud-image
v-if="item1.user_id[0].avatar_file.url"
height="64rpx"
width="64rpx"
borderRadius="50%"
v-for="(item1, index1) in item"
:key="index1"
:src="item1.user_id[0].avatar_file.url"></cloud-image>
<image
v-else
src="https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f"
style="width: 64rpx;height: 64rpx;border-radius: 50%;"></image>
<view class="example-body" style="justify-content:center" v-for="(item, index) in cmsArticleLogList"
:key="index">
<cloud-image v-if="item1.user_id[0].avatar_file.url" height="64rpx" width="64rpx" borderRadius="50%"
v-for="(item1, index1) in item" :key="index1" :src="item1.user_id[0].avatar_file.url"></cloud-image>
<image v-else
src="https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f"
style="width: 64rpx;height: 64rpx;border-radius: 50%;"></image>
</view>
<uni-drawer ref="showLeft" mode="left" :width="320" @change="change($event,'showLeft')">
<view class="close">
<button @click="closeDrawer('showLeft')"><text class="word-btn-white">关闭Drawer</text></button>
</view>
</uni-drawer>
<!-- comment_count -->
<view class="comment-eg">
<hb-comment ref="hbComment" @add="add" @del="del" @like="like" @relike="relike" @focusOn="focusOn"
@replyAdd="replyAdd" @getTreeComment="getTreeComment" :deleteTip="'确认删除?'" :cmData="commentData"
<hb-comment ref="hbComment"
@add="add" @del="del" @like="like"
@relike="relike" @focusOn="focusOn"
@replyAdd="replyAdd"
@getTreeComment="getTreeComment"
:deleteTip="'确认删除?'" :cmData="commentData"
:articlesData="data" v-if="commentData">
</hb-comment>
</view>
</unicloud-db>
<uni-popup ref="popup" background-color="#fff">
<view class="">
<uni-swiper-dot class="uni-swiper-dot-box"
@clickItem=clickItem :info="info"
:current="current" :mode="mode"
field="content">
<swiper class="swiper" :indicator-dots="true">
<swiper-item>
<uni-grid :column="3" :highlight="true" >
<uni-grid-item v-for="(item, index) in giftList" :index="index" :key="index">
<view class="grid-item-box">
<image :src="item.url" class="image" mode="aspectFill" />
<text class="text">{{ item.text }}</text>
</view>
</uni-grid-item>
</uni-grid>
</swiper-item>
<swiper-item>
<uni-grid :column="3" :highlight="true" >
<uni-grid-item v-for="(item, index) in giftList" :index="index" :key="index">
<view class="grid-item-box">
<image :src="item.url" class="image" mode="aspectFill" />
<text class="text">{{ item.text }}</text>
</view>
</uni-grid-item>
</uni-grid>
</swiper-item>
<swiper-item>
<uni-grid :column="3" :highlight="true" >
<uni-grid-item v-for="(item, index) in giftList" :index="index" :key="index">
<view class="grid-item-box">
<image :src="item.url" class="image" mode="aspectFill" />
<text class="text">{{ item.text }}</text>
</view>
</uni-grid-item>
</uni-grid>
</swiper-item>
</swiper>
</uni-swiper-dot>
</view>
</uni-popup>
</view>
@@ -115,8 +141,27 @@
},
data() {
return {
gridLst:[
swiperDotIndex: 0,
giftList: [{
url: 'https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f',
text: 'Grid 1',
badge: '0',
type: "primary"
},
{
url: 'https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f',
text: 'Grid 2',
badge: '1',
type: "success"
},
{
url: 'https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f',
text: 'Grid 2',
badge: '1',
type: "success"
}
],
gridLst: [{
text: "点赞",
icon: "heart",
value: 0,
@@ -135,7 +180,7 @@
select_flag: false
}
],
cmsArticleLogList:[],
cmsArticleLogList: [],
templateSrc: "https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/bg.jpg?expire_at=1741101988&er_sign=c9732cddaaead925cf110d9a11751231",
"commentData": null,
"reqFlag": false,
@@ -196,7 +241,7 @@
if (event.id) {
this.id = event.id
}
await this.getArticleInfo();
await this.getCmsArticleLog(this.id);
@@ -220,23 +265,31 @@
}
},
async created() {
},
methods: {
toPersonalpage() {
uni.navigateTo({
url: "/uni_modules/zetank-personalpage/pages/personalpage/personalpage"
})
},
giftChange(e) {
console.log(e)
},
chunkDataIntoGroups(originalArray) {
const MAX_PER_GROUP = 7;
const MAX_TOTAL = 21;
const result = [];
const workingArray = originalArray.slice(0, MAX_TOTAL);
for (let i = 0; i < workingArray.length; i += MAX_PER_GROUP) {
const group = workingArray.slice(i, i + MAX_PER_GROUP);
result.push(group);
}
return result;
const MAX_PER_GROUP = 7;
const MAX_TOTAL = 21;
const result = [];
const workingArray = originalArray.slice(0, MAX_TOTAL);
for (let i = 0; i < workingArray.length; i += MAX_PER_GROUP) {
const group = workingArray.slice(i, i + MAX_PER_GROUP);
result.push(group);
}
return result;
},
async getCmsArticleLog(id) {
try {
@@ -244,16 +297,16 @@
article_id: id
});
console.log(res);
if (res.code === 200 ) {
if (res.cmsArticleLog.length > 0 ) {
if (res.code === 200) {
if (res.cmsArticleLog.length > 0) {
this.cmsArticleLogList = this.chunkDataIntoGroups(res.cmsArticleLog);
}
console.log(this.cmsArticleLogList);
}
console.log(this.cmsArticleLogList);
} catch(e) {
} catch (e) {
console.log(e.message);
}
},
@@ -263,20 +316,22 @@
user_id: this.userInfo._id,
article_id: this.id
});
console.log(res);
if (res.code === 200 ) {
if (res.code === 200) {
this.gridLst[0].select_flag = res.isLike;
this.gridLst[1].select_flag = res.isCollect;
}
} catch(e) {
} catch (e) {
console.log(e.message);
}
},
async change(e) {
console.log(e);
let index = e.detail.index;
console.log(index);
if (this.gridLst[index].text === "点赞") {
if (!this.gridLst[index].select_flag) {
let res = await uniCloud.importObject("cms-articles-like").likeArticle({
@@ -293,8 +348,8 @@
console.log(res);
this.gridLst[index].value--;
}
} else if(this.gridLst[index].text === "收藏") {
} else if (this.gridLst[index].text === "收藏") {
if (!this.gridLst[index].select_flag) {
let res = await uniCloud.importObject("cms-articles-collect").collectArticle({
user_id: this.userInfo._id,
@@ -310,13 +365,14 @@
console.log(res);
this.gridLst[index].value--;
}
} else if (this.gridLst[index].text === "送礼") {
console.log("点击了送礼");
} else if (this.gridLst[index].text === "打赏") {
console.log("点击了打赏");
this.$refs.popup.open("bottom")
}
this.gridLst[index].select_flag = !this.gridLst[index].select_flag;
},
async detailLog(id, uid) {
console.log(uid);
@@ -710,7 +766,7 @@
return;
}
console.log(item);
this.reqFlag = true;
uni.hideToast();
@@ -735,8 +791,8 @@
this._resetOperationState();
return;
}
let commentId = item.id;
// // 4. 更新加载状态(网页1)
@@ -1099,4 +1155,22 @@
height: 420px;
}
.gifImage {
width: 100rpx;
height: 100rpx;
}
.swiper-box {
height: 200px;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
height: 200px;
color: #fff;
}
</style>