feat: move project

This commit is contained in:
ckaaaa 2025-09-16 13:41:49 +08:00
commit 4a940f28ba
97 changed files with 5047 additions and 0 deletions

63
pages/news_list/home.js Normal file
View file

@ -0,0 +1,63 @@
import R from '../../utils/request';
import C from '../../utils/constant';
Page({
data: {
cdnHost: C.cdnHost,
list: [],
page: 1,
listEndText: '',
},
onShow() {
this.getTabBar().init();
},
onLoad() {
this.init();
},
init() {
this.fetchList(1);
},
fetchList(page) {
R.get('/index.php/api/v1/news_list', { page }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
});
});
if (list.length == 0) {
this.setData({ listEndText: '没有更多了' });
} else {
this.setData({ listEndText: '点击加载更多。。。' });
}
if (page == 1) {
this.setData({ list ,page});
} else {
const list2 = this.data.list.concat(list);
this.setData({ list: list2,page });
}
});
},
loadMore() {
const { page, listEndText } = this.data;
if (listEndText == '点击加载更多。。。') {
this.fetchList(page + 1);
}
},
goDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/detail/detail?id=${id}`
});
},
refresh() {
this.fetchList(1);
wx.showToast({ icon: 'none', title: '刷新成功' });
},
// 下拉刷新
onPullDownRefresh() {
this.init();
wx.stopPullDownRefresh();
},
});

10
pages/news_list/home.json Normal file
View file

@ -0,0 +1,10 @@
{
"navigationBarTitleText": "发现",
"backgroundTextStyle": "light",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-footer": "tdesign-miniprogram/footer/footer"
}
}

95
pages/news_list/home.less Normal file
View file

@ -0,0 +1,95 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
// background: url('http://cdn.zhonganonline.top/newslist/static/title.png') no-repeat;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-right: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
.t-image {
width: 100%;
}
}

28
pages/news_list/home.wxml Normal file
View file

@ -0,0 +1,28 @@
<view>
<view class="title_bar">
<view class="title">最新动态</view>
<view class="btn" bind:tap="refresh">
<t-icon name="refresh" size="28rpx" color="71737b"></t-icon>
刷新
</view>
</view>
<view class="list">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-id="{{item.id}}" bind:tap="goDetail">
<t-image mode="aspectFill" src="{{cdnHost+item.poster}}" width="108" height="72" shape="round" />
<view class="right">
<view class="text">{{item.title}}</view>
<view class="info">
<view>{{item.create_time}}</view>
<view class="viewcnt">
<t-icon name="browse" size="28rpx" color="71737b"></t-icon>
{{item.view_cnt}}
</view>
</view>
</view>
</view>
<t-divider />
</view>
<t-footer wx:if="{{listEndText}}" text="{{listEndText}}" bind:tap="loadMore"></t-footer>
</view>
</view>

78
pages/news_list/home.wxss Normal file
View file

@ -0,0 +1,78 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-right: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
}
.activity .t-image {
width: 100%;
}

8
pages/news_list/readme Normal file
View file

@ -0,0 +1,8 @@
首页功能设定
1. loading入场
2. 下拉刷新
3. 搜索栏
4. 分类切换
5. 商品列表
6. 规格弹层
7. 加载更多