This commit is contained in:
王鹏
2025-08-14 14:52:01 +08:00
commit 0c2edb6036
1551 changed files with 41152 additions and 0 deletions

112
pages/tabpages/org/org.js Normal file
View File

@@ -0,0 +1,112 @@
import articleApi from "../../../api/articleApi"
import clientConfig from "../../../config/index"
Page({
data: {
searchKey: '',
hotArticles:[],
rankType: 'all',
hasMore: true, // 是否有更多数据
loading: false, // 是否正在加载
pageSize: 10,
pageNum: 1,
sortField: '',
},
onSearch(){
this.data.hotArticles = []
this.data.pageNum = 1
this.data.hasMore = true
this.fetchData()
},
onLoad(options) {
this.fetchData()
},
onReachBottom: function () {
if (this.data.hasMore) {
this.fetchData(); // 触底时加载更多数据
}
},
fetchData(){
if (this.data.loading) {
return; // 如果正在加载,则不再加载
}
articleApi.projectPage({
pageNum: this.data.pageNum,
pageSize: this.data.pageSize,
searchKey: this.data.searchKey,
sortField: this.data.sortField,
sortOrder: 'descend'
}).then(res=>{
this.setData({
hotArticles: [...this.data.hotArticles, ...res.data.rows],
loading: false,
pageNum: this.data.pageNum + 1
})
if (res.data.rows.length < 10) {
console.log(res.data.rows)
this.setData({ hasMore: false });
}
})
},
rank(e){
let rankType = e.currentTarget.dataset.type
this.setData({rankType})
this.fetchData()
},
copyUrl: function(e) {
const url = e.currentTarget.dataset.url;
const name = e.currentTarget.dataset.name;
wx.setClipboardData({
data: name + ' 演示视频:' + url,
success: () => {
wx.showToast({
title: '已复制到剪贴板',
icon: 'success',
duration: 2000
});
}
});
},
// 分享给朋友
onShareAppMessage(res) {
return new Promise((resolve) => {
wx.showLoading({
title: '生成分享图片...'
})
// 获取页面截图
wx.createSelectorQuery()
.select('.card-blank') // 选择要截图的区域,这里选择了标题区域
.fields({
size: true,
scrollOffset: true
})
.exec((res) => {
wx.hideLoading()
resolve({
title: '南音源码资源搜索',
path: '/pages/tabpages/org/org',
imageUrl: '' // 微信会自动使用页面截图
})
})
})
},
// 分享到朋友圈
onShareTimeline() {
return {
title: '南音源码资源搜索',
query: '',
imageUrl: '' // 微信会自动使用页面截图
}
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"van-search": "@vant/weapp/search/index",
"van-tree-select": "@vant/weapp/tree-select/index",
"article-card": "/components/articlecard/articlecard",
"van-empty": "@vant/weapp/empty/index"
},
"navigationBarTitleText": "全部资源"
}

View File

@@ -0,0 +1,32 @@
<van-sticky>
<!-- 搜索框 -->
<van-search
model:value="{{searchKey}}"
input-align="center"
use-action-slot
placeholder="请输入搜索关键词"
bind:search="onSearch"
>
<view slot="action" bind:tap="onSearch" style="margin: 0 10px;">搜索</view>
</van-search>
</van-sticky>
<view class="card-blank hot_title">
<view>
<van-icon name="fire" color="#DD001B" size="18px" />
<text style="margin-left: 10px;">源码资源库</text>
</view>
</view>
<scroll-view scroll-y="true" scroll-x="false" bindscrolltolower="onReachBottom">
<view class="card info-list" wx:for="{{hotArticles}}" wx:key="{{index}}">
<view class="info-name">{{item.projectName1 || item.projectName}}</view>
<text bindtap="copyUrl" data-name="{{item.projectName1 || item.projectName}}" data-url="{{ item.projectVurl}}" class="info-copy">复制链接</text>
</view>
<view hidden="{{!hasMore}}" class="loading-more">加载中...</view>
<view hidden="{{!loading}}" class="loading-icon">loading...</view>
</scroll-view>
<van-empty wx:if="{{hotArticles.length==0}}" description="没有更多文章了~" />

View File

@@ -0,0 +1,44 @@
.hot_title{
display: flex;
align-items: center;
justify-content: space-between;
}
.hot_title>view{
flex: 1;
}
.hot_title van-button{
margin-left: 10px;
}
.hot_title .van-button{
background-color: #E9F2FF;
color: #1E80FF;
border: none;
font-size: 10px;
height: 22px;
line-height: 22px;
min-width: 50px;
padding: 0 4px;
}
.info-list {
height: 100rpx;
font-size: 29rpx;
}
.info-copy {
float: right;
color: #1E90FF;
}
.info-name {
overflow: hidden;
width: 530rpx;
display: inline-block;
color: #636363;
margin-left: 10rpx;
}