|
@@ -1,19 +1,20 @@
|
|
|
<template>
|
|
|
- <view class="msilde">
|
|
|
- <view class="top">
|
|
|
- <u-search placeholder="搜索标题" bgColor="white" :showAction="false"></u-search>
|
|
|
+ <view>
|
|
|
+ <view class="search">
|
|
|
+ <u-search placeholder="搜索标题" v-model="param.title" bgColor="white" :showAction="false" @search="(current = 0), (param.type = ''), refresh()" @clear="(current = 0), (param.type = ''), (param.title = ''), refresh()"></u-search>
|
|
|
</view>
|
|
|
- <view class="left">
|
|
|
- <view class="item" :class="{ active: index == current }" v-for="(item, index) in type_list" :key="index" @click="selected(item, index)">{{ item.dictLabel }}</view>
|
|
|
+ <view class="tab">
|
|
|
+ <u-tabs :list="tab" :current="current" keyName="dictLabel" @click="click"></u-tabs>
|
|
|
</view>
|
|
|
- <view class="right">
|
|
|
- <view class="list">
|
|
|
- <view class="u_item" v-for="(item, index) in list" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
|
|
|
- <view class="con">
|
|
|
- <view class="name">{{ item.name }}</view>
|
|
|
- <view class="labels omit">{{ item.labels }}</view>
|
|
|
- <view class="labels">{{ item.columnName }}</view>
|
|
|
- </view>
|
|
|
+ <view class="list">
|
|
|
+ <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
|
|
|
+ <view class="title omit">
|
|
|
+ <text class="icon" v-if="item.top === 1"></text>
|
|
|
+ <text>{{ item.title }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="desc">
|
|
|
+ <text>{{ item.type }}</text>
|
|
|
+ <text>发布于 {{ item.createTime }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
|
|
@@ -26,7 +27,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- type_list: [],
|
|
|
+ tab: [],
|
|
|
current: 0,
|
|
|
list: [],
|
|
|
param: { pageNum: 1, pageSize: 10 },
|
|
@@ -38,6 +39,11 @@ export default {
|
|
|
this.getData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ click(e) {
|
|
|
+ this.current = e.index;
|
|
|
+ this.param.type = e.dictValue;
|
|
|
+ this.refresh();
|
|
|
+ },
|
|
|
getData() {
|
|
|
this.http.request({
|
|
|
url: '/app/knowledge/list',
|
|
@@ -55,21 +61,22 @@ export default {
|
|
|
getType() {
|
|
|
this.http.request({
|
|
|
url: '/app/common/type/knowledge_type',
|
|
|
+ loading: 'false',
|
|
|
success: (res) => {
|
|
|
- this.type_list = res.data.data;
|
|
|
- this.type_list.unshift({ dictLabel: '全部类型', dictValue: '' });
|
|
|
+ this.tab = res.data.data;
|
|
|
+ this.tab.unshift({ dictLabel: '全部类型', dictValue: '' });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ go(url) {
|
|
|
+ uni.navigateTo({ url: url });
|
|
|
+ },
|
|
|
//刷新数据
|
|
|
refresh() {
|
|
|
this.loadMore = true;
|
|
|
this.param.pageNum = 1;
|
|
|
this.list = [];
|
|
|
this.getData();
|
|
|
- },
|
|
|
- go(url) {
|
|
|
- uni.navigateTo({ url: url });
|
|
|
}
|
|
|
},
|
|
|
//下拉刷新
|
|
@@ -89,4 +96,31 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss"></style>
|
|
|
+<style lang="scss">
|
|
|
+.list {
|
|
|
+ padding: 10px 12px;
|
|
|
+ .item {
|
|
|
+ border-radius: 5px;
|
|
|
+ padding: 13px 12px 13px 12px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ overflow: hidden;
|
|
|
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
|
+ background-color: white;
|
|
|
+ .title {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: bold;
|
|
|
+ .icon {
|
|
|
+ color: orangered;
|
|
|
+ padding-right: 3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .desc {
|
|
|
+ font-size: 14px;
|
|
|
+ padding-top: 10px;
|
|
|
+ text {
|
|
|
+ padding-right: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|