Browse Source

refactor(article_info): 重构文章详情页面

- 移除了不必要的列表相关代码,简化了页面逻辑
- 优化了文章标题和内容的显示方式
-调整了页面样式,提高了可读性
master
liutong 12 months ago
parent
commit
0368ec407f
  1. 122
      pages/common/article_info.vue

122
pages/common/article_info.vue

@ -4,8 +4,8 @@
<view class="main_section">
<view class="section_1">
<view class="titile">{{dataInfo.title}}</view>
<view class="content" v-html="dataInfo.content"></view>
<view class="titile">{{infoData.title}}</view>
<view class="content" v-html="infoData.content"></view>
</view>
</view>
</view>
@ -21,69 +21,41 @@ export default {
},
data() {
return {
dataInfo: {
title: '',//
content: '',//
//
filteredData:{
id: '1',
},
infoData: {
title: '文章标题xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx111111',//
content: `
<p>aspectFit保持纵横比缩放图片使图片的长边能完全显示出来</p>
<p><img src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/cat-2.png" alt="uniapp" loading="lazy"></p>
`,//文章内容
},//
}
},
onLoad(options) {
this.filteredData.hair_staff_id = options.hair_staff_id//id
this.filteredData.id = options.id//id
},
onShow(){
this.init()
},
//
async onPullDownRefresh() {
//
await this.resetFilteredData()
await this.getList()
await this.getInfo()
},
methods: {
//
async init(){
await this.getList();
await this.getInfo();
},
//()
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'
//
//
async getInfo(){
let res = await memberApi.courseInfo({
id: this.filteredData.id,
})
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,
@ -91,29 +63,17 @@ export default {
})
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
})
this.infoData = res.data
},
}
}
</script>
<style lang="less" scoped>
.main_box {
background: #292929;
background: #fff;
word-wrap: break-word; /* 允许长单词或 URL 换行 */
word-break: break-all; /* 强制所有字符换行 */
}
//
@ -132,7 +92,7 @@ export default {
.main_section {
min-height: 100vh;
background: #292929 100%;
background: #fff;
padding: 0 0rpx;
padding-top: 32rpx;
padding-bottom: 150rpx;
@ -150,34 +110,10 @@ export default {
padding: 0 24rpx;
display: flex;
flex-direction: column;
gap: 30rpx;
.titile{
font-size: 40rpx;
.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;
}
}
}

Loading…
Cancel
Save