diff --git a/src/pages.json b/src/pages.json
index 6a0c3ac..3ed517c 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -627,7 +627,7 @@
"iconPath": "static/tabbar/healthy.png",
"selectedIconPath": "static/tabbar/healthy_sel.png",
"pagePath": "pages/healthy/index",
- "text": "健康"
+ "text": "文章"
},
{
"iconPath": "static/tabbar/my.png",
diff --git a/src/pages/article_details/article_details.vue b/src/pages/article_details/article_details.vue
index e41191d..5899a5b 100644
--- a/src/pages/article_details/article_details.vue
+++ b/src/pages/article_details/article_details.vue
@@ -33,20 +33,11 @@
{{info.subtitle}}
{{info.created_at}}
-
-
- {{info.likes}}
-
-
-
- {{Time}}
@@ -56,11 +47,7 @@
return {
swiperList: [], //轮播图
info: {},
- Time: 15,
- val: '',
- isShow: false,
style: {
- // img:'width:100% !important',
table: 'width:100% !important',
p: 'text-indent:20px'
},
@@ -68,21 +55,12 @@
audioCtx:''
};
},
- computed: {},
- async onLoad({
- id
- }) {
+ async onLoad({id}) {
await this.getDate(id)
- await this.getDown()
},
onReady() {
this.audioCtx = uni.createAudioContext('myAudio')
},
- onUnload() {
- clearInterval(this.val)
- this.Time = 15,
- this.isShow = false
- },
methods: {
audioClick(){
this.isPlaying=!this.isPlaying
@@ -98,49 +76,13 @@
if (resDate.media_type == 1) {
this.getSwiper(resDate.media_content)
}
- if (resDate.points > 0 && !resDate.has_read) {
- this.isShow = true
- }
this.info = resDate
},
getSwiper(val) {
let arr = val.split(',')
this.swiperList = arr
},
- //点赞
- async getThumbs() {
- await this.$api.post(`/v1/articles/${this.info.id}/like`, {}, {
- custom: {
- loading: true
- }
- });
- this.info.like_status = true;
- this.info.likes += 1
- this.$u.toast('点赞成功');
- uni.$emit('isUp', {
- id: this.info.id
- })
- },
- //倒计时
- getDown() {
- if (this.isShow && !this.info.has_read) {
- this.val = setInterval(() => {
- this.Time--
- if (this.Time == 0) {
- this.Time = 15
- clearInterval(this.val)
- this.isShow = false
- this.$api.post(`/v1/articles/${this.info.id}/read`).then(({
- points
- }) => {
- this.$store.dispatch('user/getUserInfo')
- this.$u.toast(`阅读成功,+${points}积分`);
- })
- }
- }, 1000)
- }
- }
- }
+ },
}
diff --git a/src/pages/healthy/index.vue b/src/pages/healthy/index.vue
index a31e3f0..76e1693 100644
--- a/src/pages/healthy/index.vue
+++ b/src/pages/healthy/index.vue
@@ -2,8 +2,8 @@
-
-
+
+
@@ -17,18 +17,10 @@
-
- {{item.title}}
-
- {{item.created_at}}
-
- 积分: {{item.points}}
-
-
- {{item.likes}}
-
+
+ {{item.title}}
+ {{item.created_at}}
@@ -42,28 +34,9 @@
mixins: [MescrollMixin, CartMixin],
data() {
return {
- list: [{
- name: '待收货'
- }, {
- name: '待付款'
- }, {
- name: '待评价',
- }, {
- name: '待收货'
- }, {
- name: '待付款'
- }, {
- name: '待评价',
- }, {
- name: '待收货'
- }, {
- name: '待付款'
- }, {
- name: '待评价',
- }],
+ tabbarList: [],
isFirstLoading: true,
article_banner: [], //广告位图片
- searchText: '',
downOption: {
auto: false,
},
@@ -74,10 +47,13 @@
noMoreSize: 1
},
dataList: [], //获取到的数据
- id: 0
+ current: 0
};
},
computed: {
+ isScroll(){
+ return this.tabbarList.length>5?true:false
+ },
height() {
const {
windowHeight,
@@ -87,30 +63,23 @@
},
cpaceImage() {
return this.article_banner.length > 0 ? this.article_banner[0] : {}
+ },
+ chooseItem(){
+ return this.tabbarList[this.current]
}
},
- onLoad({
- id
- }) {
- this.id = id
+ onLoad() {
setTimeout(() => {
this.isFirstLoading = false
}, 300)
this.getCpace()
- uni.$on('isUp', ({
- id
- }) => {
- this.dataList.forEach((item) => {
- if (item.id == id) {
- item.like_status = true;
- item.likes += 1
- }
- })
- })
+ this.getDate()
},
methods: {
change(e) {
- this.id = e
+ if(e==this.current) return
+ this.current=e
+ this.downCallback()
},
//获取广告位
async getCpace() {
@@ -121,8 +90,14 @@
}
})
this.article_banner = resDate.article_banner
- } catch (err) {} finally {}
+ } catch (err) {}
},
+ //获取文章分类
+ async getDate(){
+ const resData=await this.$api.get('/v1/articles/category')
+ this.tabbarList=resData
+ this.downCallback()
+ },
downCallback() {
this.mescroll.resetUpScroll();
this.dataList = []
@@ -135,12 +110,12 @@
size
}) {
let obj = {
- category: this.id,
- key: this.searchText,
+ cate: this.chooseItem?.id,
+ key:'',
page: num,
per_page: size
}
- this.$api.get(`/v1/articles/by-category/${ this.id}`, {
+ this.$api.get(`/v1/articles`, {
params: obj
}).then(res => {
this.mescroll.endSuccess(res.data.length)
@@ -159,7 +134,7 @@
}
}
},
- }
+ },
}