Merge pull request '更换新接口' (#97) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/97
This commit is contained in:
odjbin
2023-02-26 14:11:19 +00:00
3 changed files with 20 additions and 14 deletions

View File

@@ -43,11 +43,14 @@
}).then(res => {
let newsData = res.data.data
console.log('新闻', newsData);
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
if (newsData) {
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
}
// newsData = newsData.slice(0, 3)
this.newsList = newsData
}
// newsData = newsData.slice(0, 3)
this.newsList = newsData
}).finally(_ => {})
},
// 跳转到新闻详情页

View File

@@ -59,16 +59,19 @@
pageNum: this.pageNum
}).then(res => {
let tags = res.data.data
for (const item of tags) {
let tag = item.tags
this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0]
if (tags) {
for (const item of tags) {
let tag = item.tags
this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0]
}
this.$emit("getTimeLength", tags.length);
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
this.productList = [...this.productList, ...res.data.data]
//这用于上架时间和点赞量的数据切换
// this.productList = res.data.data
}
this.$emit("getTimeLength", tags.length);
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
this.productList = [...this.productList, ...res.data.data]
//这用于上架时间和点赞量的数据切换
// this.productList = res.data.data
}).finally(_ => {
})

View File

@@ -1,4 +1,4 @@
const serverHost = 'https://pupil.hchyun.com/api' // https://api-ugo-web.itheima.net'
const serverHost = 'https://www.foodtops.cn/api' // https://api-ugo-web.itheima.net'
function isOutTime(res) {
if (res.data.message === '请先登录') {
uni.showToast('登录信息已过期,请重新登录')