You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
3.8 KiB
193 lines
3.8 KiB
<!--文章-详情-->
|
|
<template>
|
|
<view class="main_box">
|
|
|
|
<view class="main_section">
|
|
<view class="section_1">
|
|
<view class="titile">{{dataInfo.title}}</view>
|
|
<view class="content" v-html="dataInfo.content"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import commonApi from '@/api/common.js';
|
|
|
|
|
|
|
|
export default {
|
|
components: {
|
|
},
|
|
data() {
|
|
return {
|
|
dataInfo: {
|
|
title: '',//文章标题
|
|
content: '',//文章内容
|
|
},//文章详情
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.filteredData.hair_staff_id = options.hair_staff_id//发信人id
|
|
},
|
|
onShow(){
|
|
this.init()
|
|
},
|
|
//下拉刷新
|
|
async onPullDownRefresh() {
|
|
//重置为第一页
|
|
await this.resetFilteredData()
|
|
await this.getList()
|
|
},
|
|
methods: {
|
|
//初始化
|
|
async init(){
|
|
await this.getList();
|
|
},
|
|
//加载更多(下一页)
|
|
loadMoreData() {
|
|
//判断是否加载
|
|
if (!this.isReachedBottom) {
|
|
this.isReachedBottom = true;//设置为不可请求状态
|
|
this.getList();
|
|
}
|
|
},
|
|
//重置为第一页
|
|
async resetFilteredData() {
|
|
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
|
|
|
|
this.filteredData.page = 1//当前页码
|
|
this.filteredData.limit = 10//每页返回数据条数
|
|
this.filteredData.total = 10//数据总条数
|
|
},
|
|
|
|
//获取列表
|
|
async getList(){
|
|
this.loading = true
|
|
|
|
let data = {...this.filteredData}
|
|
|
|
//判断是否还有数据
|
|
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){
|
|
this.loading = false
|
|
uni.showToast({
|
|
title: '暂无更多',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
if(data.page == 1){
|
|
this.tableList = []
|
|
}
|
|
|
|
let res = await commonApi.getContactMessage(data)//获取消息列表
|
|
this.loading = false
|
|
this.isReachedBottom = false;
|
|
if (res.code != 1){
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
this.tableList = this.tableList.concat(res.data.data); // 使用 concat 方法 将新数据追加到数组中
|
|
// this.tableList.unshift(...res.data.data); // 将新数据插入到数组头部
|
|
|
|
console.log('列表',this.tableList)
|
|
this.filteredData.total = res.data.total
|
|
this.filteredData.page++
|
|
},
|
|
|
|
//跳转文章详情
|
|
openViewArticleInfo(item){
|
|
uni.navigateTo({
|
|
url: '/pages/common/article_info?id='+item.id
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.main_box {
|
|
background: #292929;
|
|
}
|
|
|
|
//自定义导航栏
|
|
.navbar_section {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background: #29d3b4;
|
|
|
|
.title {
|
|
padding: 20rpx 0;
|
|
font-size: 30rpx;
|
|
color: #315d55;
|
|
}
|
|
}
|
|
|
|
.main_section {
|
|
min-height: 100vh;
|
|
background: #292929 100%;
|
|
padding: 0 0rpx;
|
|
padding-top: 32rpx;
|
|
padding-bottom: 150rpx;
|
|
font-size: 28rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20rpx;
|
|
|
|
.section {
|
|
background-color: #434544;
|
|
padding: 40rpx 40rpx;
|
|
}
|
|
|
|
.section_1{
|
|
padding: 0 24rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.item{
|
|
margin-bottom: 38rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
padding: 32rpx 24rpx;
|
|
border-radius: 14rpx;
|
|
background-color: rgba(255,255,255,1);
|
|
border: 2rpx solid rgba(187,187,187,1);
|
|
|
|
color: #4F4F4F;
|
|
font-size: 32rpx;
|
|
|
|
.title{
|
|
}
|
|
.img_box{
|
|
margin-top: 30rpx;
|
|
width: 100%;
|
|
}
|
|
.content{
|
|
margin-top: 30rpx;
|
|
}
|
|
.time{
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
margin-top: 36rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
.describe {
|
|
color: #999999;
|
|
padding-left: 30rpx;
|
|
}
|
|
</style>
|