yunshangxie/pages/index/knowledge_list.vue

106 lines
2.8 KiB
Vue
Raw Normal View History

2023-12-25 17:56:30 +08:00
<template>
2024-05-08 18:14:41 +08:00
<view style="background-color: #EBF4F7;letter-spacing: 1rpx;height: 100vh">
2023-12-25 17:56:30 +08:00
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="goBack()">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
<view class="tn-margin-top"
style="text-shadow: 1rpx 0 0 #FFF, 0 1rpx 0 #FFF, -1rpx 0 0 #FFF , 0 -1rpx 0 #FFF;">
<tn-tabs :list="[{name:'商学院'}]" :current="topCurrent" activeColor="#000" :bold="false"
:fontSize="36"></tn-tabs>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<view style="padding:10px 30rpx;">
2024-05-08 18:14:41 +08:00
<view v-for="(item,index) in news_list" class="tn-flex tn-flex-row-between"
@click="openUrl('/pages/index/new_info?id='+item.news_id)"
2023-12-25 17:56:30 +08:00
style="background-color: #ffffff;padding: 20rpx;border-radius: 10rpx;margin-bottom: 10rpx;">
<view style="position:relative;">
2024-05-08 18:14:41 +08:00
<view class="tn-text-ellipsis-2" style="font-size: 28rpx;">{{item.news_title}}</view>
2023-12-25 17:56:30 +08:00
<view class="tn-flex tn-flex-row-between"
style="position: absolute;bottom: 0rpx;width: 100%;color: #808080;">
<view>
<text class="tn-icon-eye"></text>
<text>568</text>
</view>
</view>
</view>
<view style="margin-left: 20rpx;">
2024-05-08 18:14:41 +08:00
<image :src="apiImgUrl+item.news_image" style="width: 200rpx;height: 135rpx;;border-radius: 10rpx;">
2023-12-25 17:56:30 +08:00
</image>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
2024-05-08 18:14:41 +08:00
import {newsList} from "@/util/api";
import store from "@/store";
export default {
2023-12-25 17:56:30 +08:00
data() {
return {
2024-05-08 18:14:41 +08:00
topCurrent: 0,
gory_id:53,
news_list:[],
apiImgUrl:this.$store.state.imgUrl,
page:1,
size:10
2023-12-25 17:56:30 +08:00
}
},
2024-05-08 18:14:41 +08:00
onLoad() {
this.getNewsList();
},
onReachBottom() {
this.page = this.page + 1;
this.getNewsList();
},
2023-12-25 17:56:30 +08:00
methods: {
2024-05-08 18:14:41 +08:00
getNewsList() {
newsList({
association_id: store.state.Gid,
gory_id: this.gory_id,
page: this.page,
size: this.size
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.news_list.push(...res.data.ret);
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
2023-12-25 17:56:30 +08:00
openUrl(url) {
uni.navigateTo({
url: url
})
},
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
}
}
}
</script>
<style>
2024-05-08 18:14:41 +08:00
</style>