mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
update: 移除node_modules依赖
This commit is contained in:
@@ -174,38 +174,37 @@ export default {
|
||||
// #ifdef MP-WEIXIN
|
||||
_isWx = true;
|
||||
// #endif
|
||||
this.navList = [
|
||||
{
|
||||
key: 'archives',
|
||||
title: '文章归档',
|
||||
leftIcon: 'halocoloricon-classify',
|
||||
leftIconColor: 'red',
|
||||
rightText: '已归档的文章',
|
||||
path: '/pagesA/archives/archives',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: false
|
||||
}, {
|
||||
key: 'love',
|
||||
title: '恋爱日记',
|
||||
leftIcon: 'halocoloricon-attent',
|
||||
leftIconColor: 'red',
|
||||
rightText: '甜蜜恋人的专属',
|
||||
path: '/pagesA/love/love',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: this.haloConfigs.loveConfig.loveEnabled
|
||||
}, {
|
||||
key: 'disclaimers',
|
||||
title: '友情链接',
|
||||
leftIcon: 'icon-lianjie',
|
||||
leftIconColor: 'blue',
|
||||
rightText: '看看朋友们吧',
|
||||
path: '/pagesA/friend-links/friend-links',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: true
|
||||
},
|
||||
this.navList = [{
|
||||
key: 'archives',
|
||||
title: '文章归档',
|
||||
leftIcon: 'halocoloricon-classify',
|
||||
leftIconColor: 'red',
|
||||
rightText: '已归档的文章',
|
||||
path: '/pagesA/archives/archives',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: false
|
||||
}, {
|
||||
key: 'love',
|
||||
title: '恋爱日记',
|
||||
leftIcon: 'halocoloricon-attent',
|
||||
leftIconColor: 'red',
|
||||
rightText: '甜蜜恋人的专属',
|
||||
path: '/pagesA/love/love',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: this.haloConfigs.loveConfig.loveEnabled
|
||||
}, {
|
||||
key: 'disclaimers',
|
||||
title: '友情链接',
|
||||
leftIcon: 'icon-lianjie',
|
||||
leftIconColor: 'blue',
|
||||
rightText: '看看朋友们吧',
|
||||
path: '/pagesA/friend-links/friend-links',
|
||||
isAdmin: false,
|
||||
type: 'page',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: 'disclaimers',
|
||||
title: '免责声明',
|
||||
@@ -400,9 +399,9 @@ export default {
|
||||
break;
|
||||
}
|
||||
} else if (type == 'page') {
|
||||
this.$Router.push({
|
||||
path: path
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -90,7 +90,6 @@ import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
|
||||
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
||||
import qs from 'qs'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -209,15 +208,8 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
const paramsStr = qs.stringify(this.queryParams, {
|
||||
allowDots: true,
|
||||
encodeValuesOnly: true,
|
||||
skipNulls: true,
|
||||
encode: true,
|
||||
arrayFormat: 'repeat'
|
||||
})
|
||||
uni.request({
|
||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts',
|
||||
method: 'GET',
|
||||
params: this.queryParams,
|
||||
success: (res) => {
|
||||
@@ -241,25 +233,14 @@ export default {
|
||||
},
|
||||
// 文章列表
|
||||
fnGetArticleList() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
|
||||
const paramsStr = qs.stringify(this.queryParams, {
|
||||
allowDots: true,
|
||||
encodeValuesOnly: true,
|
||||
skipNulls: true,
|
||||
encode: true,
|
||||
arrayFormat: 'repeat'
|
||||
})
|
||||
uni.request({
|
||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?',
|
||||
method: 'GET',
|
||||
params: this.queryParams,
|
||||
success: (res) => {
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content">
|
||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<!-- 卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
||||
<!-- 列表项 -->
|
||||
{{ item }}
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
hasNext:false,
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...'
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle();
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
return;
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getXXX(this.queryParams)
|
||||
.then(res => {
|
||||
console.log('请求结果:');
|
||||
console.log(res);
|
||||
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
padding-bottom: 144rpx;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user