From 0368ec407f798662120c0ed9c07ec4e8a9d7c06e Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Tue, 8 Apr 2025 10:37:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(article=5Finfo):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了不必要的列表相关代码,简化了页面逻辑 - 优化了文章标题和内容的显示方式 -调整了页面样式,提高了可读性 --- pages/common/article_info.vue | 126 +++++++++------------------------- 1 file changed, 31 insertions(+), 95 deletions(-) diff --git a/pages/common/article_info.vue b/pages/common/article_info.vue index 7765b5f..e349042 100644 --- a/pages/common/article_info.vue +++ b/pages/common/article_info.vue @@ -4,8 +4,8 @@ - {{dataInfo.title}} - + {{infoData.title}} + @@ -21,99 +21,59 @@ export default { }, data() { return { - dataInfo: { - title: '',//文章标题 - content: '',//文章内容 + //筛选条件 + filteredData:{ + id: '1', + }, + + infoData: { + title: '文章标题xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx111111',//文章标题 + content: ` +

aspectFit:保持纵横比缩放图片,使图片的长边能完全显示出来

+

uniapp

+ `,//文章内容 },//文章详情 } }, 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' - }) - return - } - - if(data.page == 1){ - this.tableList = [] - } - - let res = await commonApi.getContactMessage(data)//获取消息列表 - this.loading = false - this.isReachedBottom = false; - if (res.code != 1){ + //获取文章详情 + //获取课程详情 + async getInfo(){ + let res = await memberApi.courseInfo({ + id: this.filteredData.id, + }) + 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++ + this.infoData = res.data }, - - //跳转文章详情 - openViewArticleInfo(item){ - uni.navigateTo({ - url: '/pages/common/article_info?id='+item.id - }) - }, - } }