feat: add article demo videos and category counts
This commit is contained in:
@@ -24,23 +24,31 @@
|
||||
<view class="index-info">
|
||||
<view class="mt30 grid text-center col-4 bg-white" style="padding: 30rpx 0; border-radius: 15rpx;row-gap: 30rpx;">
|
||||
<view @click="Jump('/pages/tool/highQualityCode')">
|
||||
<image class="cell_3_icon flex justify-center align-center" style="height:65rpx;" src="https://img.yidaima.cn/feast/sjbz.png" mode="aspectFit">
|
||||
</image>
|
||||
<view class="category-icon-wrap">
|
||||
<image class="category-icon" src="https://img.yidaima.cn/feast/sjbz.png" mode="aspectFit"></image>
|
||||
<text v-if="categoryCounts.highQuality !== null" class="category-count-badge">{{formatCategoryCount(categoryCounts.highQuality)}}</text>
|
||||
</view>
|
||||
<view>精品源码</view>
|
||||
</view>
|
||||
<view @click="Jump('/pages/tool/resource')">
|
||||
<image class="cell_3_icon flex justify-center align-center" style="height: 65rpx;" src="https://img.yidaima.cn/feast/dnbz.png" mode="aspectFit">
|
||||
</image>
|
||||
<view class="category-icon-wrap">
|
||||
<image class="category-icon" src="https://img.yidaima.cn/feast/dnbz.png" mode="aspectFit"></image>
|
||||
<text v-if="categoryCounts.resource !== null" class="category-count-badge">{{formatCategoryCount(categoryCounts.resource)}}</text>
|
||||
</view>
|
||||
<view>资源分享</view>
|
||||
</view>
|
||||
<view @click="Jump('/pages/tool/integralCode')">
|
||||
<image class="cell_3_icon flex justify-center align-center" style="height: 65rpx;" src="https://img.yidaima.cn/feast/sp.png" mode="aspectFit">
|
||||
</image>
|
||||
<view class="category-icon-wrap">
|
||||
<image class="category-icon" src="https://img.yidaima.cn/feast/sp.png" mode="aspectFit"></image>
|
||||
<text v-if="categoryCounts.integral !== null" class="category-count-badge">{{formatCategoryCount(categoryCounts.integral)}}</text>
|
||||
</view>
|
||||
<view>积分源码</view>
|
||||
</view>
|
||||
<view @click="Jump('/pages/tool/freeCode')">
|
||||
<image class="cell_3_icon flex justify-center align-center" style="height: 65rpx;" src="https://img.yidaima.cn/feast/sycc.png" mode="aspectFit">
|
||||
</image>
|
||||
<view class="category-icon-wrap">
|
||||
<image class="category-icon" src="https://img.yidaima.cn/feast/sycc.png" mode="aspectFit"></image>
|
||||
<text v-if="categoryCounts.free !== null" class="category-count-badge">{{formatCategoryCount(categoryCounts.free)}}</text>
|
||||
</view>
|
||||
<view>免费源码</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -135,7 +143,7 @@
|
||||
getConfigKey
|
||||
} from "@/api/app/public.js"
|
||||
import {
|
||||
listArticle,newUser,wxLogin,getSysSet
|
||||
listArticle,newUser,wxLogin,getSysSet,getHomeCategoryCounts
|
||||
} from "@/api/app/index.js"
|
||||
import {
|
||||
getQiniuToken
|
||||
@@ -162,6 +170,12 @@
|
||||
swiperData: [],
|
||||
noticeStr:"",
|
||||
blogList:[],
|
||||
categoryCounts: {
|
||||
highQuality: null,
|
||||
resource: null,
|
||||
integral: null,
|
||||
free: null
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 6,
|
||||
@@ -239,6 +253,7 @@
|
||||
})
|
||||
//获取文章列表
|
||||
this.getBlogList()
|
||||
this.getCategoryCounts()
|
||||
//初始化插屏广告
|
||||
that.adUnitId = uni.getStorageSync("sysSet").homeAd
|
||||
this.getWxchaAd()
|
||||
@@ -274,6 +289,17 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getCategoryCounts() {
|
||||
getHomeCategoryCounts().then(response => {
|
||||
this.categoryCounts = Object.assign({}, this.categoryCounts, response.data || {})
|
||||
}).catch(error => {
|
||||
console.error('获取首页分类数量失败', error)
|
||||
})
|
||||
},
|
||||
formatCategoryCount(count) {
|
||||
const value = Number(count) || 0
|
||||
return value > 999 ? '999+' : String(value)
|
||||
},
|
||||
articleImage(item) {
|
||||
if (item && item.imageFallback) {
|
||||
return this.$image.original(item.showImg)
|
||||
@@ -397,6 +423,41 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.category-icon-wrap {
|
||||
position: relative;
|
||||
width: 80rpx;
|
||||
height: 65rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.category-icon {
|
||||
display: block;
|
||||
width: 80rpx;
|
||||
height: 65rpx;
|
||||
}
|
||||
|
||||
.category-count-badge {
|
||||
position: absolute;
|
||||
top: -8rpx;
|
||||
right: -12rpx;
|
||||
z-index: 2;
|
||||
box-sizing: border-box;
|
||||
min-width: 30rpx;
|
||||
height: 30rpx;
|
||||
padding: 0 7rpx;
|
||||
border: 1.5rpx solid rgba(255, 255, 255, 0.95);
|
||||
border-radius: 16rpx;
|
||||
background: linear-gradient(135deg, #8a8fff 0%, #6d52f5 100%);
|
||||
box-shadow: 0 5rpx 12rpx rgba(109, 82, 245, 0.24);
|
||||
color: #fff;
|
||||
font-size: 16rpx;
|
||||
font-weight: 500;
|
||||
line-height: 27rpx;
|
||||
text-align: center;
|
||||
letter-spacing: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 列表没有数据 */
|
||||
.no-list-data {
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user